diff --git a/catalogmanagementv1/catalog_management_v1.go b/catalogmanagementv1/catalog_management_v1.go index 10ba35ff..04ab3739 100644 --- a/catalogmanagementv1/catalog_management_v1.go +++ b/catalogmanagementv1/catalog_management_v1.go @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2021. + * (C) Copyright IBM Corp. 2022. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ */ /* - * IBM OpenAPI SDK Code Generator Version: 3.43.0-49eab5c7-20211117-152138 + * IBM OpenAPI SDK Code Generator Version: 3.55.1-b24c7487-20220831-201343 */ // Package catalogmanagementv1 : Operations and models for the CatalogManagementV1 service @@ -217,12 +217,12 @@ func (catalogManagement *CatalogManagementV1) GetCatalogAccountWithContext(ctx c // UpdateCatalogAccount : Update account settings // Update the account level settings for the account for private catalog. -func (catalogManagement *CatalogManagementV1) UpdateCatalogAccount(updateCatalogAccountOptions *UpdateCatalogAccountOptions) (response *core.DetailedResponse, err error) { +func (catalogManagement *CatalogManagementV1) UpdateCatalogAccount(updateCatalogAccountOptions *UpdateCatalogAccountOptions) (result *Account, response *core.DetailedResponse, err error) { return catalogManagement.UpdateCatalogAccountWithContext(context.Background(), updateCatalogAccountOptions) } // UpdateCatalogAccountWithContext is an alternate form of the UpdateCatalogAccount method which supports a Context parameter -func (catalogManagement *CatalogManagementV1) UpdateCatalogAccountWithContext(ctx context.Context, updateCatalogAccountOptions *UpdateCatalogAccountOptions) (response *core.DetailedResponse, err error) { +func (catalogManagement *CatalogManagementV1) UpdateCatalogAccountWithContext(ctx context.Context, updateCatalogAccountOptions *UpdateCatalogAccountOptions) (result *Account, response *core.DetailedResponse, err error) { err = core.ValidateStruct(updateCatalogAccountOptions, "updateCatalogAccountOptions") if err != nil { return @@ -244,12 +244,16 @@ func (catalogManagement *CatalogManagementV1) UpdateCatalogAccountWithContext(ct for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") builder.AddHeader("Content-Type", "application/json") body := make(map[string]interface{}) if updateCatalogAccountOptions.ID != nil { body["id"] = updateCatalogAccountOptions.ID } + if updateCatalogAccountOptions.Rev != nil { + body["_rev"] = updateCatalogAccountOptions.Rev + } if updateCatalogAccountOptions.HideIBMCloudCatalog != nil { body["hide_IBM_cloud_catalog"] = updateCatalogAccountOptions.HideIBMCloudCatalog } @@ -266,28 +270,109 @@ func (catalogManagement *CatalogManagementV1) UpdateCatalogAccountWithContext(ct return } - response, err = catalogManagement.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = catalogManagement.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAccount) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListCatalogAccountAudits : Get catalog account audit logs +// Get the audit logs associated with a catalog account. +func (catalogManagement *CatalogManagementV1) ListCatalogAccountAudits(listCatalogAccountAuditsOptions *ListCatalogAccountAuditsOptions) (result *AuditLogs, response *core.DetailedResponse, err error) { + return catalogManagement.ListCatalogAccountAuditsWithContext(context.Background(), listCatalogAccountAuditsOptions) +} + +// ListCatalogAccountAuditsWithContext is an alternate form of the ListCatalogAccountAudits method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) ListCatalogAccountAuditsWithContext(ctx context.Context, listCatalogAccountAuditsOptions *ListCatalogAccountAuditsOptions) (result *AuditLogs, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listCatalogAccountAuditsOptions, "listCatalogAccountAuditsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/catalogaccount/audits`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listCatalogAccountAuditsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "ListCatalogAccountAudits") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + if listCatalogAccountAuditsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listCatalogAccountAuditsOptions.Start)) + } + if listCatalogAccountAuditsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listCatalogAccountAuditsOptions.Limit)) + } + if listCatalogAccountAuditsOptions.Lookupnames != nil { + builder.AddQuery("lookupnames", fmt.Sprint(*listCatalogAccountAuditsOptions.Lookupnames)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = catalogManagement.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAuditLogs) + if err != nil { + return + } + response.Result = result + } return } -// GetCatalogAccountAudit : Get catalog account audit log -// Get the audit log associated with a catalog account. +// GetCatalogAccountAudit : Get a catalog account audit log entry +// Get the full audit log entry associated with a catalog account. func (catalogManagement *CatalogManagementV1) GetCatalogAccountAudit(getCatalogAccountAuditOptions *GetCatalogAccountAuditOptions) (result *AuditLog, response *core.DetailedResponse, err error) { return catalogManagement.GetCatalogAccountAuditWithContext(context.Background(), getCatalogAccountAuditOptions) } // GetCatalogAccountAuditWithContext is an alternate form of the GetCatalogAccountAudit method which supports a Context parameter func (catalogManagement *CatalogManagementV1) GetCatalogAccountAuditWithContext(ctx context.Context, getCatalogAccountAuditOptions *GetCatalogAccountAuditOptions) (result *AuditLog, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getCatalogAccountAuditOptions, "getCatalogAccountAuditOptions cannot be nil") + if err != nil { + return + } err = core.ValidateStruct(getCatalogAccountAuditOptions, "getCatalogAccountAuditOptions") if err != nil { return } + pathParamsMap := map[string]string{ + "auditlog_identifier": *getCatalogAccountAuditOptions.AuditlogIdentifier, + } + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/catalogaccount/audit`, nil) + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/catalogaccount/audits/{auditlog_identifier}`, pathParamsMap) if err != nil { return } @@ -302,6 +387,10 @@ func (catalogManagement *CatalogManagementV1) GetCatalogAccountAuditWithContext( } builder.AddHeader("Accept", "application/json") + if getCatalogAccountAuditOptions.Lookupnames != nil { + builder.AddQuery("lookupnames", fmt.Sprint(*getCatalogAccountAuditOptions.Lookupnames)) + } + request, err := builder.Build() if err != nil { return @@ -474,9 +563,15 @@ func (catalogManagement *CatalogManagementV1) CreateCatalogWithContext(ctx conte if createCatalogOptions.Label != nil { body["label"] = createCatalogOptions.Label } + if createCatalogOptions.LabelI18n != nil { + body["label_i18n"] = createCatalogOptions.LabelI18n + } if createCatalogOptions.ShortDescription != nil { body["short_description"] = createCatalogOptions.ShortDescription } + if createCatalogOptions.ShortDescriptionI18n != nil { + body["short_description_i18n"] = createCatalogOptions.ShortDescriptionI18n + } if createCatalogOptions.CatalogIconURL != nil { body["catalog_icon_url"] = createCatalogOptions.CatalogIconURL } @@ -504,6 +599,9 @@ func (catalogManagement *CatalogManagementV1) CreateCatalogWithContext(ctx conte if createCatalogOptions.Kind != nil { body["kind"] = createCatalogOptions.Kind } + if createCatalogOptions.Metadata != nil { + body["metadata"] = createCatalogOptions.Metadata + } _, err = builder.SetBodyContentJSON(body) if err != nil { return @@ -640,9 +738,15 @@ func (catalogManagement *CatalogManagementV1) ReplaceCatalogWithContext(ctx cont if replaceCatalogOptions.Label != nil { body["label"] = replaceCatalogOptions.Label } + if replaceCatalogOptions.LabelI18n != nil { + body["label_i18n"] = replaceCatalogOptions.LabelI18n + } if replaceCatalogOptions.ShortDescription != nil { body["short_description"] = replaceCatalogOptions.ShortDescription } + if replaceCatalogOptions.ShortDescriptionI18n != nil { + body["short_description_i18n"] = replaceCatalogOptions.ShortDescriptionI18n + } if replaceCatalogOptions.CatalogIconURL != nil { body["catalog_icon_url"] = replaceCatalogOptions.CatalogIconURL } @@ -670,6 +774,9 @@ func (catalogManagement *CatalogManagementV1) ReplaceCatalogWithContext(ctx cont if replaceCatalogOptions.Kind != nil { body["kind"] = replaceCatalogOptions.Kind } + if replaceCatalogOptions.Metadata != nil { + body["metadata"] = replaceCatalogOptions.Metadata + } _, err = builder.SetBodyContentJSON(body) if err != nil { return @@ -744,8 +851,78 @@ func (catalogManagement *CatalogManagementV1) DeleteCatalogWithContext(ctx conte return } -// GetCatalogAudit : Get catalog audit log -// Get the audit log associated with a catalog. +// ListCatalogAudits : Get catalog audit logs +// Get the audit logs associated with a catalog. +func (catalogManagement *CatalogManagementV1) ListCatalogAudits(listCatalogAuditsOptions *ListCatalogAuditsOptions) (result *AuditLogs, response *core.DetailedResponse, err error) { + return catalogManagement.ListCatalogAuditsWithContext(context.Background(), listCatalogAuditsOptions) +} + +// ListCatalogAuditsWithContext is an alternate form of the ListCatalogAudits method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) ListCatalogAuditsWithContext(ctx context.Context, listCatalogAuditsOptions *ListCatalogAuditsOptions) (result *AuditLogs, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listCatalogAuditsOptions, "listCatalogAuditsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listCatalogAuditsOptions, "listCatalogAuditsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "catalog_identifier": *listCatalogAuditsOptions.CatalogIdentifier, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/catalogs/{catalog_identifier}/audits`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listCatalogAuditsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "ListCatalogAudits") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + if listCatalogAuditsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listCatalogAuditsOptions.Start)) + } + if listCatalogAuditsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listCatalogAuditsOptions.Limit)) + } + if listCatalogAuditsOptions.Lookupnames != nil { + builder.AddQuery("lookupnames", fmt.Sprint(*listCatalogAuditsOptions.Lookupnames)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = catalogManagement.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAuditLogs) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetCatalogAudit : Get a catalog audit log entry +// Get the full audit log entry associated with a catalog. func (catalogManagement *CatalogManagementV1) GetCatalogAudit(getCatalogAuditOptions *GetCatalogAuditOptions) (result *AuditLog, response *core.DetailedResponse, err error) { return catalogManagement.GetCatalogAuditWithContext(context.Background(), getCatalogAuditOptions) } @@ -763,12 +940,13 @@ func (catalogManagement *CatalogManagementV1) GetCatalogAuditWithContext(ctx con pathParamsMap := map[string]string{ "catalog_identifier": *getCatalogAuditOptions.CatalogIdentifier, + "auditlog_identifier": *getCatalogAuditOptions.AuditlogIdentifier, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/catalogs/{catalog_identifier}/audit`, pathParamsMap) + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/catalogs/{catalog_identifier}/audits/{auditlog_identifier}`, pathParamsMap) if err != nil { return } @@ -783,6 +961,145 @@ func (catalogManagement *CatalogManagementV1) GetCatalogAuditWithContext(ctx con } builder.AddHeader("Accept", "application/json") + if getCatalogAuditOptions.Lookupnames != nil { + builder.AddQuery("lookupnames", fmt.Sprint(*getCatalogAuditOptions.Lookupnames)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = catalogManagement.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAuditLog) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListEnterpriseAudits : Get enterprise audit logs +// Get the audit logs associated with an enterprise. +func (catalogManagement *CatalogManagementV1) ListEnterpriseAudits(listEnterpriseAuditsOptions *ListEnterpriseAuditsOptions) (result *AuditLogs, response *core.DetailedResponse, err error) { + return catalogManagement.ListEnterpriseAuditsWithContext(context.Background(), listEnterpriseAuditsOptions) +} + +// ListEnterpriseAuditsWithContext is an alternate form of the ListEnterpriseAudits method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) ListEnterpriseAuditsWithContext(ctx context.Context, listEnterpriseAuditsOptions *ListEnterpriseAuditsOptions) (result *AuditLogs, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listEnterpriseAuditsOptions, "listEnterpriseAuditsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listEnterpriseAuditsOptions, "listEnterpriseAuditsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "enterprise_identifier": *listEnterpriseAuditsOptions.EnterpriseIdentifier, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/enterprises/{enterprise_identifier}/audits`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listEnterpriseAuditsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "ListEnterpriseAudits") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + if listEnterpriseAuditsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listEnterpriseAuditsOptions.Start)) + } + if listEnterpriseAuditsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listEnterpriseAuditsOptions.Limit)) + } + if listEnterpriseAuditsOptions.Lookupnames != nil { + builder.AddQuery("lookupnames", fmt.Sprint(*listEnterpriseAuditsOptions.Lookupnames)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = catalogManagement.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAuditLogs) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetEnterpriseAudit : Get an enterprise audit log entry +// Get the full audit log entry associated with an enterprise. +func (catalogManagement *CatalogManagementV1) GetEnterpriseAudit(getEnterpriseAuditOptions *GetEnterpriseAuditOptions) (result *AuditLog, response *core.DetailedResponse, err error) { + return catalogManagement.GetEnterpriseAuditWithContext(context.Background(), getEnterpriseAuditOptions) +} + +// GetEnterpriseAuditWithContext is an alternate form of the GetEnterpriseAudit method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) GetEnterpriseAuditWithContext(ctx context.Context, getEnterpriseAuditOptions *GetEnterpriseAuditOptions) (result *AuditLog, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getEnterpriseAuditOptions, "getEnterpriseAuditOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getEnterpriseAuditOptions, "getEnterpriseAuditOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "enterprise_identifier": *getEnterpriseAuditOptions.EnterpriseIdentifier, + "auditlog_identifier": *getEnterpriseAuditOptions.AuditlogIdentifier, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/enterprises/{enterprise_identifier}/audits/{auditlog_identifier}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getEnterpriseAuditOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "GetEnterpriseAudit") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + if getEnterpriseAuditOptions.Lookupnames != nil { + builder.AddQuery("lookupnames", fmt.Sprint(*getEnterpriseAuditOptions.Lookupnames)) + } + request, err := builder.Build() if err != nil { return @@ -932,6 +1249,9 @@ func (catalogManagement *CatalogManagementV1) ListOfferingsWithContext(ctx conte if listOfferingsOptions.Sort != nil { builder.AddQuery("sort", fmt.Sprint(*listOfferingsOptions.Sort)) } + if listOfferingsOptions.IncludeHidden != nil { + builder.AddQuery("includeHidden", fmt.Sprint(*listOfferingsOptions.IncludeHidden)) + } request, err := builder.Build() if err != nil { @@ -1010,6 +1330,9 @@ func (catalogManagement *CatalogManagementV1) CreateOfferingWithContext(ctx cont if createOfferingOptions.Label != nil { body["label"] = createOfferingOptions.Label } + if createOfferingOptions.LabelI18n != nil { + body["label_i18n"] = createOfferingOptions.LabelI18n + } if createOfferingOptions.Name != nil { body["name"] = createOfferingOptions.Name } @@ -1040,15 +1363,36 @@ func (catalogManagement *CatalogManagementV1) CreateOfferingWithContext(ctx cont if createOfferingOptions.ShortDescription != nil { body["short_description"] = createOfferingOptions.ShortDescription } + if createOfferingOptions.ShortDescriptionI18n != nil { + body["short_description_i18n"] = createOfferingOptions.ShortDescriptionI18n + } if createOfferingOptions.LongDescription != nil { body["long_description"] = createOfferingOptions.LongDescription } + if createOfferingOptions.LongDescriptionI18n != nil { + body["long_description_i18n"] = createOfferingOptions.LongDescriptionI18n + } if createOfferingOptions.Features != nil { body["features"] = createOfferingOptions.Features } if createOfferingOptions.Kinds != nil { body["kinds"] = createOfferingOptions.Kinds } + if createOfferingOptions.PcManaged != nil { + body["pc_managed"] = createOfferingOptions.PcManaged + } + if createOfferingOptions.PublishApproved != nil { + body["publish_approved"] = createOfferingOptions.PublishApproved + } + if createOfferingOptions.ShareWithAll != nil { + body["share_with_all"] = createOfferingOptions.ShareWithAll + } + if createOfferingOptions.ShareWithIBM != nil { + body["share_with_ibm"] = createOfferingOptions.ShareWithIBM + } + if createOfferingOptions.ShareEnabled != nil { + body["share_enabled"] = createOfferingOptions.ShareEnabled + } if createOfferingOptions.PermitRequestIBMPublicPublish != nil { body["permit_request_ibm_public_publish"] = createOfferingOptions.PermitRequestIBMPublicPublish } @@ -1094,12 +1438,24 @@ func (catalogManagement *CatalogManagementV1) CreateOfferingWithContext(ctx cont if createOfferingOptions.RepoInfo != nil { body["repo_info"] = createOfferingOptions.RepoInfo } + if createOfferingOptions.ImagePullKeys != nil { + body["image_pull_keys"] = createOfferingOptions.ImagePullKeys + } if createOfferingOptions.Support != nil { body["support"] = createOfferingOptions.Support } if createOfferingOptions.Media != nil { body["media"] = createOfferingOptions.Media } + if createOfferingOptions.DeprecatePending != nil { + body["deprecate_pending"] = createOfferingOptions.DeprecatePending + } + if createOfferingOptions.ProductKind != nil { + body["product_kind"] = createOfferingOptions.ProductKind + } + if createOfferingOptions.Badges != nil { + body["badges"] = createOfferingOptions.Badges + } _, err = builder.SetBodyContentJSON(body) if err != nil { return @@ -1127,7 +1483,7 @@ func (catalogManagement *CatalogManagementV1) CreateOfferingWithContext(ctx cont } // ImportOfferingVersion : Import offering version -// Import new version to offering from a tgz. +// Import new version to an offering. func (catalogManagement *CatalogManagementV1) ImportOfferingVersion(importOfferingVersionOptions *ImportOfferingVersionOptions) (result *Offering, response *core.DetailedResponse, err error) { return catalogManagement.ImportOfferingVersionWithContext(context.Background(), importOfferingVersionOptions) } @@ -1166,6 +1522,9 @@ func (catalogManagement *CatalogManagementV1) ImportOfferingVersionWithContext(c } builder.AddHeader("Accept", "application/json") builder.AddHeader("Content-Type", "application/json") + if importOfferingVersionOptions.XAuthToken != nil { + builder.AddHeader("X-Auth-Token", fmt.Sprint(*importOfferingVersionOptions.XAuthToken)) + } if importOfferingVersionOptions.Zipurl != nil { builder.AddQuery("zipurl", fmt.Sprint(*importOfferingVersionOptions.Zipurl)) @@ -1179,19 +1538,49 @@ func (catalogManagement *CatalogManagementV1) ImportOfferingVersionWithContext(c if importOfferingVersionOptions.IsVsi != nil { builder.AddQuery("isVSI", fmt.Sprint(*importOfferingVersionOptions.IsVsi)) } - if importOfferingVersionOptions.RepoType != nil { - builder.AddQuery("repoType", fmt.Sprint(*importOfferingVersionOptions.RepoType)) + if importOfferingVersionOptions.Repotype != nil { + builder.AddQuery("repotype", fmt.Sprint(*importOfferingVersionOptions.Repotype)) } body := make(map[string]interface{}) if importOfferingVersionOptions.Tags != nil { body["tags"] = importOfferingVersionOptions.Tags } + if importOfferingVersionOptions.Content != nil { + body["content"] = importOfferingVersionOptions.Content + } + if importOfferingVersionOptions.Name != nil { + body["name"] = importOfferingVersionOptions.Name + } + if importOfferingVersionOptions.Label != nil { + body["label"] = importOfferingVersionOptions.Label + } + if importOfferingVersionOptions.InstallKind != nil { + body["install_kind"] = importOfferingVersionOptions.InstallKind + } if importOfferingVersionOptions.TargetKinds != nil { body["target_kinds"] = importOfferingVersionOptions.TargetKinds } - if importOfferingVersionOptions.Content != nil { - body["content"] = importOfferingVersionOptions.Content + if importOfferingVersionOptions.FormatKind != nil { + body["format_kind"] = importOfferingVersionOptions.FormatKind + } + if importOfferingVersionOptions.ProductKind != nil { + body["product_kind"] = importOfferingVersionOptions.ProductKind + } + if importOfferingVersionOptions.Sha != nil { + body["sha"] = importOfferingVersionOptions.Sha + } + if importOfferingVersionOptions.Version != nil { + body["version"] = importOfferingVersionOptions.Version + } + if importOfferingVersionOptions.Flavor != nil { + body["flavor"] = importOfferingVersionOptions.Flavor + } + if importOfferingVersionOptions.Metadata != nil { + body["metadata"] = importOfferingVersionOptions.Metadata + } + if importOfferingVersionOptions.WorkingDirectory != nil { + body["working_directory"] = importOfferingVersionOptions.WorkingDirectory } _, err = builder.SetBodyContentJSON(body) if err != nil { @@ -1220,7 +1609,7 @@ func (catalogManagement *CatalogManagementV1) ImportOfferingVersionWithContext(c } // ImportOffering : Import offering -// Import a new offering from a tgz. +// Import a new offering. func (catalogManagement *CatalogManagementV1) ImportOffering(importOfferingOptions *ImportOfferingOptions) (result *Offering, response *core.DetailedResponse, err error) { return catalogManagement.ImportOfferingWithContext(context.Background(), importOfferingOptions) } @@ -1277,19 +1666,49 @@ func (catalogManagement *CatalogManagementV1) ImportOfferingWithContext(ctx cont if importOfferingOptions.IsVsi != nil { builder.AddQuery("isVSI", fmt.Sprint(*importOfferingOptions.IsVsi)) } - if importOfferingOptions.RepoType != nil { - builder.AddQuery("repoType", fmt.Sprint(*importOfferingOptions.RepoType)) + if importOfferingOptions.Repotype != nil { + builder.AddQuery("repotype", fmt.Sprint(*importOfferingOptions.Repotype)) } body := make(map[string]interface{}) if importOfferingOptions.Tags != nil { body["tags"] = importOfferingOptions.Tags } + if importOfferingOptions.Content != nil { + body["content"] = importOfferingOptions.Content + } + if importOfferingOptions.Name != nil { + body["name"] = importOfferingOptions.Name + } + if importOfferingOptions.Label != nil { + body["label"] = importOfferingOptions.Label + } + if importOfferingOptions.InstallKind != nil { + body["install_kind"] = importOfferingOptions.InstallKind + } if importOfferingOptions.TargetKinds != nil { body["target_kinds"] = importOfferingOptions.TargetKinds } - if importOfferingOptions.Content != nil { - body["content"] = importOfferingOptions.Content + if importOfferingOptions.FormatKind != nil { + body["format_kind"] = importOfferingOptions.FormatKind + } + if importOfferingOptions.ProductKind != nil { + body["product_kind"] = importOfferingOptions.ProductKind + } + if importOfferingOptions.Sha != nil { + body["sha"] = importOfferingOptions.Sha + } + if importOfferingOptions.Version != nil { + body["version"] = importOfferingOptions.Version + } + if importOfferingOptions.Flavor != nil { + body["flavor"] = importOfferingOptions.Flavor + } + if importOfferingOptions.Metadata != nil { + body["metadata"] = importOfferingOptions.Metadata + } + if importOfferingOptions.WorkingDirectory != nil { + body["working_directory"] = importOfferingOptions.WorkingDirectory } _, err = builder.SetBodyContentJSON(body) if err != nil { @@ -1370,11 +1789,20 @@ func (catalogManagement *CatalogManagementV1) ReloadOfferingWithContext(ctx cont if reloadOfferingOptions.Tags != nil { body["tags"] = reloadOfferingOptions.Tags } + if reloadOfferingOptions.Content != nil { + body["content"] = reloadOfferingOptions.Content + } if reloadOfferingOptions.TargetKinds != nil { body["target_kinds"] = reloadOfferingOptions.TargetKinds } - if reloadOfferingOptions.Content != nil { - body["content"] = reloadOfferingOptions.Content + if reloadOfferingOptions.FormatKind != nil { + body["format_kind"] = reloadOfferingOptions.FormatKind + } + if reloadOfferingOptions.Flavor != nil { + body["flavor"] = reloadOfferingOptions.Flavor + } + if reloadOfferingOptions.WorkingDirectory != nil { + body["working_directory"] = reloadOfferingOptions.WorkingDirectory } _, err = builder.SetBodyContentJSON(body) if err != nil { @@ -1527,6 +1955,9 @@ func (catalogManagement *CatalogManagementV1) ReplaceOfferingWithContext(ctx con if replaceOfferingOptions.Label != nil { body["label"] = replaceOfferingOptions.Label } + if replaceOfferingOptions.LabelI18n != nil { + body["label_i18n"] = replaceOfferingOptions.LabelI18n + } if replaceOfferingOptions.Name != nil { body["name"] = replaceOfferingOptions.Name } @@ -1557,15 +1988,36 @@ func (catalogManagement *CatalogManagementV1) ReplaceOfferingWithContext(ctx con if replaceOfferingOptions.ShortDescription != nil { body["short_description"] = replaceOfferingOptions.ShortDescription } + if replaceOfferingOptions.ShortDescriptionI18n != nil { + body["short_description_i18n"] = replaceOfferingOptions.ShortDescriptionI18n + } if replaceOfferingOptions.LongDescription != nil { body["long_description"] = replaceOfferingOptions.LongDescription } + if replaceOfferingOptions.LongDescriptionI18n != nil { + body["long_description_i18n"] = replaceOfferingOptions.LongDescriptionI18n + } if replaceOfferingOptions.Features != nil { body["features"] = replaceOfferingOptions.Features } if replaceOfferingOptions.Kinds != nil { body["kinds"] = replaceOfferingOptions.Kinds } + if replaceOfferingOptions.PcManaged != nil { + body["pc_managed"] = replaceOfferingOptions.PcManaged + } + if replaceOfferingOptions.PublishApproved != nil { + body["publish_approved"] = replaceOfferingOptions.PublishApproved + } + if replaceOfferingOptions.ShareWithAll != nil { + body["share_with_all"] = replaceOfferingOptions.ShareWithAll + } + if replaceOfferingOptions.ShareWithIBM != nil { + body["share_with_ibm"] = replaceOfferingOptions.ShareWithIBM + } + if replaceOfferingOptions.ShareEnabled != nil { + body["share_enabled"] = replaceOfferingOptions.ShareEnabled + } if replaceOfferingOptions.PermitRequestIBMPublicPublish != nil { body["permit_request_ibm_public_publish"] = replaceOfferingOptions.PermitRequestIBMPublicPublish } @@ -1611,12 +2063,24 @@ func (catalogManagement *CatalogManagementV1) ReplaceOfferingWithContext(ctx con if replaceOfferingOptions.RepoInfo != nil { body["repo_info"] = replaceOfferingOptions.RepoInfo } + if replaceOfferingOptions.ImagePullKeys != nil { + body["image_pull_keys"] = replaceOfferingOptions.ImagePullKeys + } if replaceOfferingOptions.Support != nil { body["support"] = replaceOfferingOptions.Support } if replaceOfferingOptions.Media != nil { body["media"] = replaceOfferingOptions.Media } + if replaceOfferingOptions.DeprecatePending != nil { + body["deprecate_pending"] = replaceOfferingOptions.DeprecatePending + } + if replaceOfferingOptions.ProductKind != nil { + body["product_kind"] = replaceOfferingOptions.ProductKind + } + if replaceOfferingOptions.Badges != nil { + body["badges"] = replaceOfferingOptions.Badges + } _, err = builder.SetBodyContentJSON(body) if err != nil { return @@ -1762,46 +2226,56 @@ func (catalogManagement *CatalogManagementV1) DeleteOfferingWithContext(ctx cont return } -// GetOfferingAudit : Get offering audit log -// Get the audit log associated with an offering. -func (catalogManagement *CatalogManagementV1) GetOfferingAudit(getOfferingAuditOptions *GetOfferingAuditOptions) (result *AuditLog, response *core.DetailedResponse, err error) { - return catalogManagement.GetOfferingAuditWithContext(context.Background(), getOfferingAuditOptions) +// ListOfferingAudits : Get offering audit logs +// Get the audit logs associated with an offering. +func (catalogManagement *CatalogManagementV1) ListOfferingAudits(listOfferingAuditsOptions *ListOfferingAuditsOptions) (result *AuditLogs, response *core.DetailedResponse, err error) { + return catalogManagement.ListOfferingAuditsWithContext(context.Background(), listOfferingAuditsOptions) } -// GetOfferingAuditWithContext is an alternate form of the GetOfferingAudit method which supports a Context parameter -func (catalogManagement *CatalogManagementV1) GetOfferingAuditWithContext(ctx context.Context, getOfferingAuditOptions *GetOfferingAuditOptions) (result *AuditLog, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getOfferingAuditOptions, "getOfferingAuditOptions cannot be nil") +// ListOfferingAuditsWithContext is an alternate form of the ListOfferingAudits method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) ListOfferingAuditsWithContext(ctx context.Context, listOfferingAuditsOptions *ListOfferingAuditsOptions) (result *AuditLogs, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listOfferingAuditsOptions, "listOfferingAuditsOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getOfferingAuditOptions, "getOfferingAuditOptions") + err = core.ValidateStruct(listOfferingAuditsOptions, "listOfferingAuditsOptions") if err != nil { return } pathParamsMap := map[string]string{ - "catalog_identifier": *getOfferingAuditOptions.CatalogIdentifier, - "offering_id": *getOfferingAuditOptions.OfferingID, + "catalog_identifier": *listOfferingAuditsOptions.CatalogIdentifier, + "offering_id": *listOfferingAuditsOptions.OfferingID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/catalogs/{catalog_identifier}/offerings/{offering_id}/audit`, pathParamsMap) + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/catalogs/{catalog_identifier}/offerings/{offering_id}/audits`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getOfferingAuditOptions.Headers { + for headerName, headerValue := range listOfferingAuditsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "GetOfferingAudit") + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "ListOfferingAudits") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") + if listOfferingAuditsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listOfferingAuditsOptions.Start)) + } + if listOfferingAuditsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listOfferingAuditsOptions.Limit)) + } + if listOfferingAuditsOptions.Lookupnames != nil { + builder.AddQuery("lookupnames", fmt.Sprint(*listOfferingAuditsOptions.Lookupnames)) + } + request, err := builder.Build() if err != nil { return @@ -1813,7 +2287,7 @@ func (catalogManagement *CatalogManagementV1) GetOfferingAuditWithContext(ctx co return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAuditLog) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAuditLogs) if err != nil { return } @@ -1823,47 +2297,51 @@ func (catalogManagement *CatalogManagementV1) GetOfferingAuditWithContext(ctx co return } -// ReplaceOfferingIcon : Upload icon for offering -// Upload an icon file to be stored in GC. File is uploaded as a binary payload - not as a form. -func (catalogManagement *CatalogManagementV1) ReplaceOfferingIcon(replaceOfferingIconOptions *ReplaceOfferingIconOptions) (result *Offering, response *core.DetailedResponse, err error) { - return catalogManagement.ReplaceOfferingIconWithContext(context.Background(), replaceOfferingIconOptions) +// GetOfferingAudit : Get an offering audit log entry +// Get the full audit log entry associated with an offering. +func (catalogManagement *CatalogManagementV1) GetOfferingAudit(getOfferingAuditOptions *GetOfferingAuditOptions) (result *AuditLog, response *core.DetailedResponse, err error) { + return catalogManagement.GetOfferingAuditWithContext(context.Background(), getOfferingAuditOptions) } -// ReplaceOfferingIconWithContext is an alternate form of the ReplaceOfferingIcon method which supports a Context parameter -func (catalogManagement *CatalogManagementV1) ReplaceOfferingIconWithContext(ctx context.Context, replaceOfferingIconOptions *ReplaceOfferingIconOptions) (result *Offering, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(replaceOfferingIconOptions, "replaceOfferingIconOptions cannot be nil") +// GetOfferingAuditWithContext is an alternate form of the GetOfferingAudit method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) GetOfferingAuditWithContext(ctx context.Context, getOfferingAuditOptions *GetOfferingAuditOptions) (result *AuditLog, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getOfferingAuditOptions, "getOfferingAuditOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(replaceOfferingIconOptions, "replaceOfferingIconOptions") + err = core.ValidateStruct(getOfferingAuditOptions, "getOfferingAuditOptions") if err != nil { return } pathParamsMap := map[string]string{ - "catalog_identifier": *replaceOfferingIconOptions.CatalogIdentifier, - "offering_id": *replaceOfferingIconOptions.OfferingID, - "file_name": *replaceOfferingIconOptions.FileName, + "catalog_identifier": *getOfferingAuditOptions.CatalogIdentifier, + "offering_id": *getOfferingAuditOptions.OfferingID, + "auditlog_identifier": *getOfferingAuditOptions.AuditlogIdentifier, } - builder := core.NewRequestBuilder(core.PUT) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/catalogs/{catalog_identifier}/offerings/{offering_id}/icon/{file_name}`, pathParamsMap) + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/catalogs/{catalog_identifier}/offerings/{offering_id}/audits/{auditlog_identifier}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range replaceOfferingIconOptions.Headers { + for headerName, headerValue := range getOfferingAuditOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "ReplaceOfferingIcon") + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "GetOfferingAudit") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") + if getOfferingAuditOptions.Lookupnames != nil { + builder.AddQuery("lookupnames", fmt.Sprint(*getOfferingAuditOptions.Lookupnames)) + } + request, err := builder.Build() if err != nil { return @@ -1875,7 +2353,7 @@ func (catalogManagement *CatalogManagementV1) ReplaceOfferingIconWithContext(ctx return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalOffering) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAuditLog) if err != nil { return } @@ -1885,37 +2363,30 @@ func (catalogManagement *CatalogManagementV1) ReplaceOfferingIconWithContext(ctx return } -// UpdateOfferingIBM : Allow offering to be published -// Approve or disapprove the offering to be allowed to publish to the IBM Public Catalog. Options: -// * `allow_request` - (Allow requesting to publish to IBM) -// * `ibm` - (Allow publishing to be visible to IBM only) -// * `public` - (Allow publishing to be visible to everyone, including IBM) -// -// If disapprove `public`, then `ibm` approval will not be changed. If disapprove `ibm` then `public` will -// automatically be disapproved. if disapprove `allow_request` then all rights to publish will be removed. This is -// because the process steps always go first through `allow` to `ibm` and then to `public`. `ibm` cannot be skipped. -// Only users with Approval IAM authority can use this. Approvers should use the catalog and offering id from the public -// catalog since they wouldn't have access to the private offering. -func (catalogManagement *CatalogManagementV1) UpdateOfferingIBM(updateOfferingIBMOptions *UpdateOfferingIBMOptions) (result *ApprovalResult, response *core.DetailedResponse, err error) { - return catalogManagement.UpdateOfferingIBMWithContext(context.Background(), updateOfferingIBMOptions) +// SetOfferingPublish : Set offering publish approval settings +// Approve or disapprove the offering to be allowed to publish to the IBM Public Catalog. This is used only by Partner +// Center. Only users with Approval IAM authority can use this. Approvers should use the catalog and offering id from +// the public catalog since they wouldn't have access to the private offering. +func (catalogManagement *CatalogManagementV1) SetOfferingPublish(setOfferingPublishOptions *SetOfferingPublishOptions) (result *ApprovalResult, response *core.DetailedResponse, err error) { + return catalogManagement.SetOfferingPublishWithContext(context.Background(), setOfferingPublishOptions) } -// UpdateOfferingIBMWithContext is an alternate form of the UpdateOfferingIBM method which supports a Context parameter -func (catalogManagement *CatalogManagementV1) UpdateOfferingIBMWithContext(ctx context.Context, updateOfferingIBMOptions *UpdateOfferingIBMOptions) (result *ApprovalResult, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateOfferingIBMOptions, "updateOfferingIBMOptions cannot be nil") +// SetOfferingPublishWithContext is an alternate form of the SetOfferingPublish method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) SetOfferingPublishWithContext(ctx context.Context, setOfferingPublishOptions *SetOfferingPublishOptions) (result *ApprovalResult, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(setOfferingPublishOptions, "setOfferingPublishOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateOfferingIBMOptions, "updateOfferingIBMOptions") + err = core.ValidateStruct(setOfferingPublishOptions, "setOfferingPublishOptions") if err != nil { return } pathParamsMap := map[string]string{ - "catalog_identifier": *updateOfferingIBMOptions.CatalogIdentifier, - "offering_id": *updateOfferingIBMOptions.OfferingID, - "approval_type": *updateOfferingIBMOptions.ApprovalType, - "approved": *updateOfferingIBMOptions.Approved, + "catalog_identifier": *setOfferingPublishOptions.CatalogIdentifier, + "offering_id": *setOfferingPublishOptions.OfferingID, + "approval_type": *setOfferingPublishOptions.ApprovalType, + "approved": *setOfferingPublishOptions.Approved, } builder := core.NewRequestBuilder(core.POST) @@ -1926,15 +2397,25 @@ func (catalogManagement *CatalogManagementV1) UpdateOfferingIBMWithContext(ctx c return } - for headerName, headerValue := range updateOfferingIBMOptions.Headers { + for headerName, headerValue := range setOfferingPublishOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "UpdateOfferingIBM") + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "SetOfferingPublish") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") + if setOfferingPublishOptions.XApproverToken != nil { + builder.AddHeader("X-Approver-Token", fmt.Sprint(*setOfferingPublishOptions.XApproverToken)) + } + + if setOfferingPublishOptions.PortalRecord != nil { + builder.AddQuery("portal_record", fmt.Sprint(*setOfferingPublishOptions.PortalRecord)) + } + if setOfferingPublishOptions.PortalURL != nil { + builder.AddQuery("portal_url", fmt.Sprint(*setOfferingPublishOptions.PortalURL)) + } request, err := builder.Build() if err != nil { @@ -2020,79 +2501,60 @@ func (catalogManagement *CatalogManagementV1) DeprecateOfferingWithContext(ctx c return } -// GetOfferingUpdates : Get version updates -// Get available updates for the specified version. -func (catalogManagement *CatalogManagementV1) GetOfferingUpdates(getOfferingUpdatesOptions *GetOfferingUpdatesOptions) (result []VersionUpdateDescriptor, response *core.DetailedResponse, err error) { - return catalogManagement.GetOfferingUpdatesWithContext(context.Background(), getOfferingUpdatesOptions) +// ShareOffering : Allows offering to be shared +// Set the share options on an offering. +func (catalogManagement *CatalogManagementV1) ShareOffering(shareOfferingOptions *ShareOfferingOptions) (result *ShareSetting, response *core.DetailedResponse, err error) { + return catalogManagement.ShareOfferingWithContext(context.Background(), shareOfferingOptions) } -// GetOfferingUpdatesWithContext is an alternate form of the GetOfferingUpdates method which supports a Context parameter -func (catalogManagement *CatalogManagementV1) GetOfferingUpdatesWithContext(ctx context.Context, getOfferingUpdatesOptions *GetOfferingUpdatesOptions) (result []VersionUpdateDescriptor, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getOfferingUpdatesOptions, "getOfferingUpdatesOptions cannot be nil") +// ShareOfferingWithContext is an alternate form of the ShareOffering method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) ShareOfferingWithContext(ctx context.Context, shareOfferingOptions *ShareOfferingOptions) (result *ShareSetting, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(shareOfferingOptions, "shareOfferingOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getOfferingUpdatesOptions, "getOfferingUpdatesOptions") + err = core.ValidateStruct(shareOfferingOptions, "shareOfferingOptions") if err != nil { return } pathParamsMap := map[string]string{ - "catalog_identifier": *getOfferingUpdatesOptions.CatalogIdentifier, - "offering_id": *getOfferingUpdatesOptions.OfferingID, + "catalog_identifier": *shareOfferingOptions.CatalogIdentifier, + "offering_id": *shareOfferingOptions.OfferingID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/catalogs/{catalog_identifier}/offerings/{offering_id}/updates`, pathParamsMap) + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/catalogs/{catalog_identifier}/offerings/{offering_id}/share`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getOfferingUpdatesOptions.Headers { + for headerName, headerValue := range shareOfferingOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "GetOfferingUpdates") + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "ShareOffering") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if getOfferingUpdatesOptions.XAuthRefreshToken != nil { - builder.AddHeader("X-Auth-Refresh-Token", fmt.Sprint(*getOfferingUpdatesOptions.XAuthRefreshToken)) - } + builder.AddHeader("Content-Type", "application/json") - builder.AddQuery("kind", fmt.Sprint(*getOfferingUpdatesOptions.Kind)) - if getOfferingUpdatesOptions.Target != nil { - builder.AddQuery("target", fmt.Sprint(*getOfferingUpdatesOptions.Target)) - } - if getOfferingUpdatesOptions.Version != nil { - builder.AddQuery("version", fmt.Sprint(*getOfferingUpdatesOptions.Version)) - } - if getOfferingUpdatesOptions.ClusterID != nil { - builder.AddQuery("cluster_id", fmt.Sprint(*getOfferingUpdatesOptions.ClusterID)) - } - if getOfferingUpdatesOptions.Region != nil { - builder.AddQuery("region", fmt.Sprint(*getOfferingUpdatesOptions.Region)) - } - if getOfferingUpdatesOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group_id", fmt.Sprint(*getOfferingUpdatesOptions.ResourceGroupID)) - } - if getOfferingUpdatesOptions.Namespace != nil { - builder.AddQuery("namespace", fmt.Sprint(*getOfferingUpdatesOptions.Namespace)) - } - if getOfferingUpdatesOptions.Sha != nil { - builder.AddQuery("sha", fmt.Sprint(*getOfferingUpdatesOptions.Sha)) + body := make(map[string]interface{}) + if shareOfferingOptions.IBM != nil { + body["ibm"] = shareOfferingOptions.IBM } - if getOfferingUpdatesOptions.Channel != nil { - builder.AddQuery("channel", fmt.Sprint(*getOfferingUpdatesOptions.Channel)) + if shareOfferingOptions.Public != nil { + body["public"] = shareOfferingOptions.Public } - if getOfferingUpdatesOptions.Namespaces != nil { - builder.AddQuery("namespaces", strings.Join(getOfferingUpdatesOptions.Namespaces, ",")) + if shareOfferingOptions.Enabled != nil { + body["enabled"] = shareOfferingOptions.Enabled } - if getOfferingUpdatesOptions.AllNamespaces != nil { - builder.AddQuery("all_namespaces", fmt.Sprint(*getOfferingUpdatesOptions.AllNamespaces)) + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return } request, err := builder.Build() @@ -2100,13 +2562,13 @@ func (catalogManagement *CatalogManagementV1) GetOfferingUpdatesWithContext(ctx return } - var rawResponse []json.RawMessage + var rawResponse map[string]json.RawMessage response, err = catalogManagement.Service.Request(request, &rawResponse) if err != nil { return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVersionUpdateDescriptor) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareSetting) if err != nil { return } @@ -2116,209 +2578,248 @@ func (catalogManagement *CatalogManagementV1) GetOfferingUpdatesWithContext(ctx return } -// GetOfferingSource : Get offering source -// Get an offering's source. This request requires authorization, even for public offerings. -func (catalogManagement *CatalogManagementV1) GetOfferingSource(getOfferingSourceOptions *GetOfferingSourceOptions) (result io.ReadCloser, response *core.DetailedResponse, err error) { - return catalogManagement.GetOfferingSourceWithContext(context.Background(), getOfferingSourceOptions) +// GetOfferingAccess : Check for account ID in offering access list +// Determine if an account ID is in an offering's access list. +func (catalogManagement *CatalogManagementV1) GetOfferingAccess(getOfferingAccessOptions *GetOfferingAccessOptions) (result *Access, response *core.DetailedResponse, err error) { + return catalogManagement.GetOfferingAccessWithContext(context.Background(), getOfferingAccessOptions) } -// GetOfferingSourceWithContext is an alternate form of the GetOfferingSource method which supports a Context parameter -func (catalogManagement *CatalogManagementV1) GetOfferingSourceWithContext(ctx context.Context, getOfferingSourceOptions *GetOfferingSourceOptions) (result io.ReadCloser, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getOfferingSourceOptions, "getOfferingSourceOptions cannot be nil") +// GetOfferingAccessWithContext is an alternate form of the GetOfferingAccess method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) GetOfferingAccessWithContext(ctx context.Context, getOfferingAccessOptions *GetOfferingAccessOptions) (result *Access, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getOfferingAccessOptions, "getOfferingAccessOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getOfferingSourceOptions, "getOfferingSourceOptions") + err = core.ValidateStruct(getOfferingAccessOptions, "getOfferingAccessOptions") if err != nil { return } + pathParamsMap := map[string]string{ + "catalog_identifier": *getOfferingAccessOptions.CatalogIdentifier, + "offering_id": *getOfferingAccessOptions.OfferingID, + "access_identifier": *getOfferingAccessOptions.AccessIdentifier, + } + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/offering/source`, nil) + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/catalogs/{catalog_identifier}/offerings/{offering_id}/access/{access_identifier}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getOfferingSourceOptions.Headers { + for headerName, headerValue := range getOfferingAccessOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "GetOfferingSource") + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "GetOfferingAccess") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/yaml") - if getOfferingSourceOptions.Accept != nil { - builder.AddHeader("Accept", fmt.Sprint(*getOfferingSourceOptions.Accept)) - } - - builder.AddQuery("version", fmt.Sprint(*getOfferingSourceOptions.Version)) - if getOfferingSourceOptions.CatalogID != nil { - builder.AddQuery("catalogID", fmt.Sprint(*getOfferingSourceOptions.CatalogID)) - } - if getOfferingSourceOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*getOfferingSourceOptions.Name)) - } - if getOfferingSourceOptions.ID != nil { - builder.AddQuery("id", fmt.Sprint(*getOfferingSourceOptions.ID)) - } - if getOfferingSourceOptions.Kind != nil { - builder.AddQuery("kind", fmt.Sprint(*getOfferingSourceOptions.Kind)) - } - if getOfferingSourceOptions.Channel != nil { - builder.AddQuery("channel", fmt.Sprint(*getOfferingSourceOptions.Channel)) - } + builder.AddHeader("Accept", "application/json") request, err := builder.Build() if err != nil { return } - response, err = catalogManagement.Service.Request(request, &result) + var rawResponse map[string]json.RawMessage + response, err = catalogManagement.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAccess) + if err != nil { + return + } + response.Result = result + } return } -// GetOfferingAbout : Get version about information -// Get the about information, in markdown, for the current version. -func (catalogManagement *CatalogManagementV1) GetOfferingAbout(getOfferingAboutOptions *GetOfferingAboutOptions) (result *string, response *core.DetailedResponse, err error) { - return catalogManagement.GetOfferingAboutWithContext(context.Background(), getOfferingAboutOptions) +// GetOfferingAccessList : Get offering access list +// Get the access list associated with the specified offering. +func (catalogManagement *CatalogManagementV1) GetOfferingAccessList(getOfferingAccessListOptions *GetOfferingAccessListOptions) (result *AccessListResult, response *core.DetailedResponse, err error) { + return catalogManagement.GetOfferingAccessListWithContext(context.Background(), getOfferingAccessListOptions) } -// GetOfferingAboutWithContext is an alternate form of the GetOfferingAbout method which supports a Context parameter -func (catalogManagement *CatalogManagementV1) GetOfferingAboutWithContext(ctx context.Context, getOfferingAboutOptions *GetOfferingAboutOptions) (result *string, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getOfferingAboutOptions, "getOfferingAboutOptions cannot be nil") +// GetOfferingAccessListWithContext is an alternate form of the GetOfferingAccessList method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) GetOfferingAccessListWithContext(ctx context.Context, getOfferingAccessListOptions *GetOfferingAccessListOptions) (result *AccessListResult, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getOfferingAccessListOptions, "getOfferingAccessListOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getOfferingAboutOptions, "getOfferingAboutOptions") + err = core.ValidateStruct(getOfferingAccessListOptions, "getOfferingAccessListOptions") if err != nil { return } pathParamsMap := map[string]string{ - "version_loc_id": *getOfferingAboutOptions.VersionLocID, + "catalog_identifier": *getOfferingAccessListOptions.CatalogIdentifier, + "offering_id": *getOfferingAccessListOptions.OfferingID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/versions/{version_loc_id}/about`, pathParamsMap) + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/catalogs/{catalog_identifier}/offerings/{offering_id}/access`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getOfferingAboutOptions.Headers { + for headerName, headerValue := range getOfferingAccessListOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "GetOfferingAbout") + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "GetOfferingAccessList") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "text/markdown") + builder.AddHeader("Accept", "application/json") + + if getOfferingAccessListOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*getOfferingAccessListOptions.Start)) + } + if getOfferingAccessListOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*getOfferingAccessListOptions.Limit)) + } request, err := builder.Build() if err != nil { return } - response, err = catalogManagement.Service.Request(request, &result) + var rawResponse map[string]json.RawMessage + response, err = catalogManagement.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAccessListResult) + if err != nil { + return + } + response.Result = result + } return } -// GetOfferingLicense : Get version license content -// Get the license content for the specified license ID in the specified version. -func (catalogManagement *CatalogManagementV1) GetOfferingLicense(getOfferingLicenseOptions *GetOfferingLicenseOptions) (result *string, response *core.DetailedResponse, err error) { - return catalogManagement.GetOfferingLicenseWithContext(context.Background(), getOfferingLicenseOptions) +// DeleteOfferingAccessList : Delete accesses from offering access list +// Delete all or a set of accesses from an offering's access list. +func (catalogManagement *CatalogManagementV1) DeleteOfferingAccessList(deleteOfferingAccessListOptions *DeleteOfferingAccessListOptions) (result *AccessListBulkResponse, response *core.DetailedResponse, err error) { + return catalogManagement.DeleteOfferingAccessListWithContext(context.Background(), deleteOfferingAccessListOptions) } -// GetOfferingLicenseWithContext is an alternate form of the GetOfferingLicense method which supports a Context parameter -func (catalogManagement *CatalogManagementV1) GetOfferingLicenseWithContext(ctx context.Context, getOfferingLicenseOptions *GetOfferingLicenseOptions) (result *string, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getOfferingLicenseOptions, "getOfferingLicenseOptions cannot be nil") +// DeleteOfferingAccessListWithContext is an alternate form of the DeleteOfferingAccessList method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) DeleteOfferingAccessListWithContext(ctx context.Context, deleteOfferingAccessListOptions *DeleteOfferingAccessListOptions) (result *AccessListBulkResponse, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteOfferingAccessListOptions, "deleteOfferingAccessListOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getOfferingLicenseOptions, "getOfferingLicenseOptions") + err = core.ValidateStruct(deleteOfferingAccessListOptions, "deleteOfferingAccessListOptions") if err != nil { return } pathParamsMap := map[string]string{ - "version_loc_id": *getOfferingLicenseOptions.VersionLocID, - "license_id": *getOfferingLicenseOptions.LicenseID, + "catalog_identifier": *deleteOfferingAccessListOptions.CatalogIdentifier, + "offering_id": *deleteOfferingAccessListOptions.OfferingID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/versions/{version_loc_id}/licenses/{license_id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/catalogs/{catalog_identifier}/offerings/{offering_id}/access`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getOfferingLicenseOptions.Headers { + for headerName, headerValue := range deleteOfferingAccessListOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "GetOfferingLicense") + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "DeleteOfferingAccessList") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "text/plain") + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + _, err = builder.SetBodyContentJSON(deleteOfferingAccessListOptions.Accesses) + if err != nil { + return + } request, err := builder.Build() if err != nil { return } - response, err = catalogManagement.Service.Request(request, &result) + var rawResponse map[string]json.RawMessage + response, err = catalogManagement.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAccessListBulkResponse) + if err != nil { + return + } + response.Result = result + } return } -// GetOfferingContainerImages : Get version's container images -// Get the list of container images associated with the specified version. The "image_manifest_url" property of the -// version should be the URL for the image manifest, and the operation will return that content. -func (catalogManagement *CatalogManagementV1) GetOfferingContainerImages(getOfferingContainerImagesOptions *GetOfferingContainerImagesOptions) (result *ImageManifest, response *core.DetailedResponse, err error) { - return catalogManagement.GetOfferingContainerImagesWithContext(context.Background(), getOfferingContainerImagesOptions) +// AddOfferingAccessList : Add accesses to offering access list +// Add one or more accesses to the specified offering's access list. +func (catalogManagement *CatalogManagementV1) AddOfferingAccessList(addOfferingAccessListOptions *AddOfferingAccessListOptions) (result *AccessListResult, response *core.DetailedResponse, err error) { + return catalogManagement.AddOfferingAccessListWithContext(context.Background(), addOfferingAccessListOptions) } -// GetOfferingContainerImagesWithContext is an alternate form of the GetOfferingContainerImages method which supports a Context parameter -func (catalogManagement *CatalogManagementV1) GetOfferingContainerImagesWithContext(ctx context.Context, getOfferingContainerImagesOptions *GetOfferingContainerImagesOptions) (result *ImageManifest, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getOfferingContainerImagesOptions, "getOfferingContainerImagesOptions cannot be nil") +// AddOfferingAccessListWithContext is an alternate form of the AddOfferingAccessList method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) AddOfferingAccessListWithContext(ctx context.Context, addOfferingAccessListOptions *AddOfferingAccessListOptions) (result *AccessListResult, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(addOfferingAccessListOptions, "addOfferingAccessListOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getOfferingContainerImagesOptions, "getOfferingContainerImagesOptions") + err = core.ValidateStruct(addOfferingAccessListOptions, "addOfferingAccessListOptions") if err != nil { return } pathParamsMap := map[string]string{ - "version_loc_id": *getOfferingContainerImagesOptions.VersionLocID, + "catalog_identifier": *addOfferingAccessListOptions.CatalogIdentifier, + "offering_id": *addOfferingAccessListOptions.OfferingID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/versions/{version_loc_id}/containerImages`, pathParamsMap) + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/catalogs/{catalog_identifier}/offerings/{offering_id}/access`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getOfferingContainerImagesOptions.Headers { + for headerName, headerValue := range addOfferingAccessListOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "GetOfferingContainerImages") + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "AddOfferingAccessList") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + _, err = builder.SetBodyContentJSON(addOfferingAccessListOptions.Accesses) + if err != nil { + return + } request, err := builder.Build() if err != nil { @@ -2331,7 +2832,7 @@ func (catalogManagement *CatalogManagementV1) GetOfferingContainerImagesWithCont return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageManifest) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAccessListResult) if err != nil { return } @@ -2341,104 +2842,155 @@ func (catalogManagement *CatalogManagementV1) GetOfferingContainerImagesWithCont return } -// DeprecateVersion : Deprecate version immediately -// Deprecate the specified version. -func (catalogManagement *CatalogManagementV1) DeprecateVersion(deprecateVersionOptions *DeprecateVersionOptions) (response *core.DetailedResponse, err error) { - return catalogManagement.DeprecateVersionWithContext(context.Background(), deprecateVersionOptions) +// GetOfferingUpdates : Get version updates +// Get available updates for the specified version. +func (catalogManagement *CatalogManagementV1) GetOfferingUpdates(getOfferingUpdatesOptions *GetOfferingUpdatesOptions) (result []VersionUpdateDescriptor, response *core.DetailedResponse, err error) { + return catalogManagement.GetOfferingUpdatesWithContext(context.Background(), getOfferingUpdatesOptions) } -// DeprecateVersionWithContext is an alternate form of the DeprecateVersion method which supports a Context parameter -func (catalogManagement *CatalogManagementV1) DeprecateVersionWithContext(ctx context.Context, deprecateVersionOptions *DeprecateVersionOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deprecateVersionOptions, "deprecateVersionOptions cannot be nil") +// GetOfferingUpdatesWithContext is an alternate form of the GetOfferingUpdates method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) GetOfferingUpdatesWithContext(ctx context.Context, getOfferingUpdatesOptions *GetOfferingUpdatesOptions) (result []VersionUpdateDescriptor, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getOfferingUpdatesOptions, "getOfferingUpdatesOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deprecateVersionOptions, "deprecateVersionOptions") + err = core.ValidateStruct(getOfferingUpdatesOptions, "getOfferingUpdatesOptions") if err != nil { return } pathParamsMap := map[string]string{ - "version_loc_id": *deprecateVersionOptions.VersionLocID, + "catalog_identifier": *getOfferingUpdatesOptions.CatalogIdentifier, + "offering_id": *getOfferingUpdatesOptions.OfferingID, } - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/versions/{version_loc_id}/deprecate`, pathParamsMap) + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/catalogs/{catalog_identifier}/offerings/{offering_id}/updates`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deprecateVersionOptions.Headers { + for headerName, headerValue := range getOfferingUpdatesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "DeprecateVersion") + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "GetOfferingUpdates") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") + if getOfferingUpdatesOptions.XAuthRefreshToken != nil { + builder.AddHeader("X-Auth-Refresh-Token", fmt.Sprint(*getOfferingUpdatesOptions.XAuthRefreshToken)) + } + + builder.AddQuery("kind", fmt.Sprint(*getOfferingUpdatesOptions.Kind)) + if getOfferingUpdatesOptions.Target != nil { + builder.AddQuery("target", fmt.Sprint(*getOfferingUpdatesOptions.Target)) + } + if getOfferingUpdatesOptions.Version != nil { + builder.AddQuery("version", fmt.Sprint(*getOfferingUpdatesOptions.Version)) + } + if getOfferingUpdatesOptions.ClusterID != nil { + builder.AddQuery("cluster_id", fmt.Sprint(*getOfferingUpdatesOptions.ClusterID)) + } + if getOfferingUpdatesOptions.Region != nil { + builder.AddQuery("region", fmt.Sprint(*getOfferingUpdatesOptions.Region)) + } + if getOfferingUpdatesOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group_id", fmt.Sprint(*getOfferingUpdatesOptions.ResourceGroupID)) + } + if getOfferingUpdatesOptions.Namespace != nil { + builder.AddQuery("namespace", fmt.Sprint(*getOfferingUpdatesOptions.Namespace)) + } + if getOfferingUpdatesOptions.Sha != nil { + builder.AddQuery("sha", fmt.Sprint(*getOfferingUpdatesOptions.Sha)) + } + if getOfferingUpdatesOptions.Channel != nil { + builder.AddQuery("channel", fmt.Sprint(*getOfferingUpdatesOptions.Channel)) + } + if getOfferingUpdatesOptions.Namespaces != nil { + builder.AddQuery("namespaces", strings.Join(getOfferingUpdatesOptions.Namespaces, ",")) + } + if getOfferingUpdatesOptions.AllNamespaces != nil { + builder.AddQuery("all_namespaces", fmt.Sprint(*getOfferingUpdatesOptions.AllNamespaces)) + } request, err := builder.Build() if err != nil { return } - response, err = catalogManagement.Service.Request(request, nil) + var rawResponse []json.RawMessage + response, err = catalogManagement.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVersionUpdateDescriptor) + if err != nil { + return + } + response.Result = result + } return } -// SetDeprecateVersion : Sets version to be deprecated in a certain time period -// Set or cancel the version to be deprecated. -func (catalogManagement *CatalogManagementV1) SetDeprecateVersion(setDeprecateVersionOptions *SetDeprecateVersionOptions) (response *core.DetailedResponse, err error) { - return catalogManagement.SetDeprecateVersionWithContext(context.Background(), setDeprecateVersionOptions) +// GetOfferingSource : Get offering source +// Get an offering's source. This request requires authorization, even for public offerings. +func (catalogManagement *CatalogManagementV1) GetOfferingSource(getOfferingSourceOptions *GetOfferingSourceOptions) (result io.ReadCloser, response *core.DetailedResponse, err error) { + return catalogManagement.GetOfferingSourceWithContext(context.Background(), getOfferingSourceOptions) } -// SetDeprecateVersionWithContext is an alternate form of the SetDeprecateVersion method which supports a Context parameter -func (catalogManagement *CatalogManagementV1) SetDeprecateVersionWithContext(ctx context.Context, setDeprecateVersionOptions *SetDeprecateVersionOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(setDeprecateVersionOptions, "setDeprecateVersionOptions cannot be nil") +// GetOfferingSourceWithContext is an alternate form of the GetOfferingSource method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) GetOfferingSourceWithContext(ctx context.Context, getOfferingSourceOptions *GetOfferingSourceOptions) (result io.ReadCloser, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getOfferingSourceOptions, "getOfferingSourceOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(setDeprecateVersionOptions, "setDeprecateVersionOptions") + err = core.ValidateStruct(getOfferingSourceOptions, "getOfferingSourceOptions") if err != nil { return } - pathParamsMap := map[string]string{ - "version_loc_id": *setDeprecateVersionOptions.VersionLocID, - "setting": *setDeprecateVersionOptions.Setting, - } - - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/versions/{version_loc_id}/deprecate/{setting}`, pathParamsMap) + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/offering/source`, nil) if err != nil { return } - for headerName, headerValue := range setDeprecateVersionOptions.Headers { + for headerName, headerValue := range getOfferingSourceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "SetDeprecateVersion") + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "GetOfferingSource") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Content-Type", "application/json") + builder.AddHeader("Accept", "application/yaml") + if getOfferingSourceOptions.Accept != nil { + builder.AddHeader("Accept", fmt.Sprint(*getOfferingSourceOptions.Accept)) + } - body := make(map[string]interface{}) - if setDeprecateVersionOptions.Description != nil { - body["description"] = setDeprecateVersionOptions.Description + builder.AddQuery("version", fmt.Sprint(*getOfferingSourceOptions.Version)) + if getOfferingSourceOptions.CatalogID != nil { + builder.AddQuery("catalogID", fmt.Sprint(*getOfferingSourceOptions.CatalogID)) } - if setDeprecateVersionOptions.DaysUntilDeprecate != nil { - body["days_until_deprecate"] = setDeprecateVersionOptions.DaysUntilDeprecate + if getOfferingSourceOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*getOfferingSourceOptions.Name)) } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return + if getOfferingSourceOptions.ID != nil { + builder.AddQuery("id", fmt.Sprint(*getOfferingSourceOptions.ID)) + } + if getOfferingSourceOptions.Kind != nil { + builder.AddQuery("kind", fmt.Sprint(*getOfferingSourceOptions.Kind)) + } + if getOfferingSourceOptions.Channel != nil { + builder.AddQuery("channel", fmt.Sprint(*getOfferingSourceOptions.Channel)) } request, err := builder.Build() @@ -2446,256 +2998,270 @@ func (catalogManagement *CatalogManagementV1) SetDeprecateVersionWithContext(ctx return } - response, err = catalogManagement.Service.Request(request, nil) + response, err = catalogManagement.Service.Request(request, &result) return } -// AccountPublishVersion : Publish version to account members -// Publish the specified version so it is viewable by account members. -func (catalogManagement *CatalogManagementV1) AccountPublishVersion(accountPublishVersionOptions *AccountPublishVersionOptions) (response *core.DetailedResponse, err error) { - return catalogManagement.AccountPublishVersionWithContext(context.Background(), accountPublishVersionOptions) +// GetOfferingSourceURL : Get offering source URL +// Get an offering's private source image. +func (catalogManagement *CatalogManagementV1) GetOfferingSourceURL(getOfferingSourceURLOptions *GetOfferingSourceURLOptions) (result io.ReadCloser, response *core.DetailedResponse, err error) { + return catalogManagement.GetOfferingSourceURLWithContext(context.Background(), getOfferingSourceURLOptions) } -// AccountPublishVersionWithContext is an alternate form of the AccountPublishVersion method which supports a Context parameter -func (catalogManagement *CatalogManagementV1) AccountPublishVersionWithContext(ctx context.Context, accountPublishVersionOptions *AccountPublishVersionOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(accountPublishVersionOptions, "accountPublishVersionOptions cannot be nil") +// GetOfferingSourceURLWithContext is an alternate form of the GetOfferingSourceURL method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) GetOfferingSourceURLWithContext(ctx context.Context, getOfferingSourceURLOptions *GetOfferingSourceURLOptions) (result io.ReadCloser, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getOfferingSourceURLOptions, "getOfferingSourceURLOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(accountPublishVersionOptions, "accountPublishVersionOptions") + err = core.ValidateStruct(getOfferingSourceURLOptions, "getOfferingSourceURLOptions") if err != nil { return } pathParamsMap := map[string]string{ - "version_loc_id": *accountPublishVersionOptions.VersionLocID, + "key_identifier": *getOfferingSourceURLOptions.KeyIdentifier, } - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/versions/{version_loc_id}/account-publish`, pathParamsMap) + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/offering/source/url/{key_identifier}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range accountPublishVersionOptions.Headers { + for headerName, headerValue := range getOfferingSourceURLOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "AccountPublishVersion") + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "GetOfferingSourceURL") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/yaml") + if getOfferingSourceURLOptions.Accept != nil { + builder.AddHeader("Accept", fmt.Sprint(*getOfferingSourceURLOptions.Accept)) + } + + if getOfferingSourceURLOptions.CatalogID != nil { + builder.AddQuery("catalogID", fmt.Sprint(*getOfferingSourceURLOptions.CatalogID)) + } + if getOfferingSourceURLOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*getOfferingSourceURLOptions.Name)) + } + if getOfferingSourceURLOptions.ID != nil { + builder.AddQuery("id", fmt.Sprint(*getOfferingSourceURLOptions.ID)) + } request, err := builder.Build() if err != nil { return } - response, err = catalogManagement.Service.Request(request, nil) + response, err = catalogManagement.Service.Request(request, &result) return } -// IBMPublishVersion : Publish version to IBMers in public catalog -// Publish the specified version so that it is visible to IBMers in the public catalog. -func (catalogManagement *CatalogManagementV1) IBMPublishVersion(ibmPublishVersionOptions *IBMPublishVersionOptions) (response *core.DetailedResponse, err error) { - return catalogManagement.IBMPublishVersionWithContext(context.Background(), ibmPublishVersionOptions) +// GetOfferingAbout : Get version about information +// Get the about information, in markdown, for the current version. +func (catalogManagement *CatalogManagementV1) GetOfferingAbout(getOfferingAboutOptions *GetOfferingAboutOptions) (result *string, response *core.DetailedResponse, err error) { + return catalogManagement.GetOfferingAboutWithContext(context.Background(), getOfferingAboutOptions) } -// IBMPublishVersionWithContext is an alternate form of the IBMPublishVersion method which supports a Context parameter -func (catalogManagement *CatalogManagementV1) IBMPublishVersionWithContext(ctx context.Context, ibmPublishVersionOptions *IBMPublishVersionOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(ibmPublishVersionOptions, "ibmPublishVersionOptions cannot be nil") +// GetOfferingAboutWithContext is an alternate form of the GetOfferingAbout method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) GetOfferingAboutWithContext(ctx context.Context, getOfferingAboutOptions *GetOfferingAboutOptions) (result *string, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getOfferingAboutOptions, "getOfferingAboutOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(ibmPublishVersionOptions, "ibmPublishVersionOptions") + err = core.ValidateStruct(getOfferingAboutOptions, "getOfferingAboutOptions") if err != nil { return } pathParamsMap := map[string]string{ - "version_loc_id": *ibmPublishVersionOptions.VersionLocID, + "version_loc_id": *getOfferingAboutOptions.VersionLocID, } - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/versions/{version_loc_id}/ibm-publish`, pathParamsMap) + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/versions/{version_loc_id}/about`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range ibmPublishVersionOptions.Headers { + for headerName, headerValue := range getOfferingAboutOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "IBMPublishVersion") + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "GetOfferingAbout") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "text/markdown") request, err := builder.Build() if err != nil { return } - response, err = catalogManagement.Service.Request(request, nil) + response, err = catalogManagement.Service.Request(request, &result) return } -// PublicPublishVersion : Publish version to all users in public catalog -// Publish the specified version so it is visible to all users in the public catalog. -func (catalogManagement *CatalogManagementV1) PublicPublishVersion(publicPublishVersionOptions *PublicPublishVersionOptions) (response *core.DetailedResponse, err error) { - return catalogManagement.PublicPublishVersionWithContext(context.Background(), publicPublishVersionOptions) +// GetOfferingLicense : Get version license content +// Get the license content for the specified license ID in the specified version. +func (catalogManagement *CatalogManagementV1) GetOfferingLicense(getOfferingLicenseOptions *GetOfferingLicenseOptions) (result *string, response *core.DetailedResponse, err error) { + return catalogManagement.GetOfferingLicenseWithContext(context.Background(), getOfferingLicenseOptions) } -// PublicPublishVersionWithContext is an alternate form of the PublicPublishVersion method which supports a Context parameter -func (catalogManagement *CatalogManagementV1) PublicPublishVersionWithContext(ctx context.Context, publicPublishVersionOptions *PublicPublishVersionOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(publicPublishVersionOptions, "publicPublishVersionOptions cannot be nil") +// GetOfferingLicenseWithContext is an alternate form of the GetOfferingLicense method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) GetOfferingLicenseWithContext(ctx context.Context, getOfferingLicenseOptions *GetOfferingLicenseOptions) (result *string, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getOfferingLicenseOptions, "getOfferingLicenseOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(publicPublishVersionOptions, "publicPublishVersionOptions") + err = core.ValidateStruct(getOfferingLicenseOptions, "getOfferingLicenseOptions") if err != nil { return } pathParamsMap := map[string]string{ - "version_loc_id": *publicPublishVersionOptions.VersionLocID, + "version_loc_id": *getOfferingLicenseOptions.VersionLocID, + "license_id": *getOfferingLicenseOptions.LicenseID, } - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/versions/{version_loc_id}/public-publish`, pathParamsMap) + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/versions/{version_loc_id}/licenses/{license_id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range publicPublishVersionOptions.Headers { + for headerName, headerValue := range getOfferingLicenseOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "PublicPublishVersion") + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "GetOfferingLicense") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "text/plain") request, err := builder.Build() if err != nil { return } - response, err = catalogManagement.Service.Request(request, nil) + response, err = catalogManagement.Service.Request(request, &result) return } -// CommitVersion : Commit version -// Commit a working copy of the specified version. -func (catalogManagement *CatalogManagementV1) CommitVersion(commitVersionOptions *CommitVersionOptions) (response *core.DetailedResponse, err error) { - return catalogManagement.CommitVersionWithContext(context.Background(), commitVersionOptions) +// GetOfferingContainerImages : Get version's container images +// Get the list of container images associated with the specified version. The "image_manifest_url" property of the +// version should be the URL for the image manifest, and the operation will return that content. +func (catalogManagement *CatalogManagementV1) GetOfferingContainerImages(getOfferingContainerImagesOptions *GetOfferingContainerImagesOptions) (result *ImageManifest, response *core.DetailedResponse, err error) { + return catalogManagement.GetOfferingContainerImagesWithContext(context.Background(), getOfferingContainerImagesOptions) } -// CommitVersionWithContext is an alternate form of the CommitVersion method which supports a Context parameter -func (catalogManagement *CatalogManagementV1) CommitVersionWithContext(ctx context.Context, commitVersionOptions *CommitVersionOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(commitVersionOptions, "commitVersionOptions cannot be nil") +// GetOfferingContainerImagesWithContext is an alternate form of the GetOfferingContainerImages method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) GetOfferingContainerImagesWithContext(ctx context.Context, getOfferingContainerImagesOptions *GetOfferingContainerImagesOptions) (result *ImageManifest, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getOfferingContainerImagesOptions, "getOfferingContainerImagesOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(commitVersionOptions, "commitVersionOptions") + err = core.ValidateStruct(getOfferingContainerImagesOptions, "getOfferingContainerImagesOptions") if err != nil { return } pathParamsMap := map[string]string{ - "version_loc_id": *commitVersionOptions.VersionLocID, + "version_loc_id": *getOfferingContainerImagesOptions.VersionLocID, } - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/versions/{version_loc_id}/commit`, pathParamsMap) + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/versions/{version_loc_id}/containerImages`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range commitVersionOptions.Headers { + for headerName, headerValue := range getOfferingContainerImagesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "CommitVersion") + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "GetOfferingContainerImages") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") request, err := builder.Build() if err != nil { return } - response, err = catalogManagement.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = catalogManagement.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageManifest) + if err != nil { + return + } + response.Result = result + } return } -// CopyVersion : Copy version to new target kind -// Copy the specified version to a new target kind within the same offering. -func (catalogManagement *CatalogManagementV1) CopyVersion(copyVersionOptions *CopyVersionOptions) (response *core.DetailedResponse, err error) { - return catalogManagement.CopyVersionWithContext(context.Background(), copyVersionOptions) +// ArchiveVersion : Archive version immediately +// Archive the specified version. +func (catalogManagement *CatalogManagementV1) ArchiveVersion(archiveVersionOptions *ArchiveVersionOptions) (response *core.DetailedResponse, err error) { + return catalogManagement.ArchiveVersionWithContext(context.Background(), archiveVersionOptions) } -// CopyVersionWithContext is an alternate form of the CopyVersion method which supports a Context parameter -func (catalogManagement *CatalogManagementV1) CopyVersionWithContext(ctx context.Context, copyVersionOptions *CopyVersionOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(copyVersionOptions, "copyVersionOptions cannot be nil") +// ArchiveVersionWithContext is an alternate form of the ArchiveVersion method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) ArchiveVersionWithContext(ctx context.Context, archiveVersionOptions *ArchiveVersionOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(archiveVersionOptions, "archiveVersionOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(copyVersionOptions, "copyVersionOptions") + err = core.ValidateStruct(archiveVersionOptions, "archiveVersionOptions") if err != nil { return } pathParamsMap := map[string]string{ - "version_loc_id": *copyVersionOptions.VersionLocID, + "version_loc_id": *archiveVersionOptions.VersionLocID, } builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/versions/{version_loc_id}/copy`, pathParamsMap) + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/versions/{version_loc_id}/archive`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range copyVersionOptions.Headers { + for headerName, headerValue := range archiveVersionOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "CopyVersion") + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "ArchiveVersion") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Content-Type", "application/json") - - body := make(map[string]interface{}) - if copyVersionOptions.Tags != nil { - body["tags"] = copyVersionOptions.Tags - } - if copyVersionOptions.TargetKinds != nil { - body["target_kinds"] = copyVersionOptions.TargetKinds - } - if copyVersionOptions.Content != nil { - body["content"] = copyVersionOptions.Content - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return - } request, err := builder.Build() if err != nil { @@ -2707,161 +3273,150 @@ func (catalogManagement *CatalogManagementV1) CopyVersionWithContext(ctx context return } -// GetOfferingWorkingCopy : Create working copy of version -// Create a working copy of the specified version. -func (catalogManagement *CatalogManagementV1) GetOfferingWorkingCopy(getOfferingWorkingCopyOptions *GetOfferingWorkingCopyOptions) (result *Version, response *core.DetailedResponse, err error) { - return catalogManagement.GetOfferingWorkingCopyWithContext(context.Background(), getOfferingWorkingCopyOptions) +// SetDeprecateVersion : Sets version to be deprecated in a certain time period +// Set or cancel the version to be deprecated. +func (catalogManagement *CatalogManagementV1) SetDeprecateVersion(setDeprecateVersionOptions *SetDeprecateVersionOptions) (response *core.DetailedResponse, err error) { + return catalogManagement.SetDeprecateVersionWithContext(context.Background(), setDeprecateVersionOptions) } -// GetOfferingWorkingCopyWithContext is an alternate form of the GetOfferingWorkingCopy method which supports a Context parameter -func (catalogManagement *CatalogManagementV1) GetOfferingWorkingCopyWithContext(ctx context.Context, getOfferingWorkingCopyOptions *GetOfferingWorkingCopyOptions) (result *Version, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getOfferingWorkingCopyOptions, "getOfferingWorkingCopyOptions cannot be nil") +// SetDeprecateVersionWithContext is an alternate form of the SetDeprecateVersion method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) SetDeprecateVersionWithContext(ctx context.Context, setDeprecateVersionOptions *SetDeprecateVersionOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(setDeprecateVersionOptions, "setDeprecateVersionOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getOfferingWorkingCopyOptions, "getOfferingWorkingCopyOptions") + err = core.ValidateStruct(setDeprecateVersionOptions, "setDeprecateVersionOptions") if err != nil { return } pathParamsMap := map[string]string{ - "version_loc_id": *getOfferingWorkingCopyOptions.VersionLocID, + "version_loc_id": *setDeprecateVersionOptions.VersionLocID, + "setting": *setDeprecateVersionOptions.Setting, } builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/versions/{version_loc_id}/workingcopy`, pathParamsMap) + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/versions/{version_loc_id}/deprecate/{setting}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getOfferingWorkingCopyOptions.Headers { + for headerName, headerValue := range setDeprecateVersionOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "GetOfferingWorkingCopy") + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "SetDeprecateVersion") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") - request, err := builder.Build() + body := make(map[string]interface{}) + if setDeprecateVersionOptions.Description != nil { + body["description"] = setDeprecateVersionOptions.Description + } + if setDeprecateVersionOptions.DaysUntilDeprecate != nil { + body["days_until_deprecate"] = setDeprecateVersionOptions.DaysUntilDeprecate + } + _, err = builder.SetBodyContentJSON(body) if err != nil { return } - var rawResponse map[string]json.RawMessage - response, err = catalogManagement.Service.Request(request, &rawResponse) + request, err := builder.Build() if err != nil { return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVersion) - if err != nil { - return - } - response.Result = result - } + + response, err = catalogManagement.Service.Request(request, nil) return } -// GetVersion : Get offering/kind/version 'branch' -// Get the Offering/Kind/Version 'branch' for the specified locator ID. -func (catalogManagement *CatalogManagementV1) GetVersion(getVersionOptions *GetVersionOptions) (result *Offering, response *core.DetailedResponse, err error) { - return catalogManagement.GetVersionWithContext(context.Background(), getVersionOptions) +// ConsumableVersion : Make version consumable for sharing +// Set the version as consumable in order to inherit the offering sharing permissions. +func (catalogManagement *CatalogManagementV1) ConsumableVersion(consumableVersionOptions *ConsumableVersionOptions) (response *core.DetailedResponse, err error) { + return catalogManagement.ConsumableVersionWithContext(context.Background(), consumableVersionOptions) } -// GetVersionWithContext is an alternate form of the GetVersion method which supports a Context parameter -func (catalogManagement *CatalogManagementV1) GetVersionWithContext(ctx context.Context, getVersionOptions *GetVersionOptions) (result *Offering, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getVersionOptions, "getVersionOptions cannot be nil") +// ConsumableVersionWithContext is an alternate form of the ConsumableVersion method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) ConsumableVersionWithContext(ctx context.Context, consumableVersionOptions *ConsumableVersionOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(consumableVersionOptions, "consumableVersionOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getVersionOptions, "getVersionOptions") + err = core.ValidateStruct(consumableVersionOptions, "consumableVersionOptions") if err != nil { return } pathParamsMap := map[string]string{ - "version_loc_id": *getVersionOptions.VersionLocID, + "version_loc_id": *consumableVersionOptions.VersionLocID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/versions/{version_loc_id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/versions/{version_loc_id}/consume-publish`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getVersionOptions.Headers { + for headerName, headerValue := range consumableVersionOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "GetVersion") + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "ConsumableVersion") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") request, err := builder.Build() if err != nil { return } - var rawResponse map[string]json.RawMessage - response, err = catalogManagement.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalOffering) - if err != nil { - return - } - response.Result = result - } + response, err = catalogManagement.Service.Request(request, nil) return } -// DeleteVersion : Delete version -// Delete the specified version. If the version is an active version with a working copy, the working copy will be -// deleted as well. -func (catalogManagement *CatalogManagementV1) DeleteVersion(deleteVersionOptions *DeleteVersionOptions) (response *core.DetailedResponse, err error) { - return catalogManagement.DeleteVersionWithContext(context.Background(), deleteVersionOptions) +// SuspendVersion : Suspend a version +// Limits the visibility of a version by moving a version state from consumable back to validated. +func (catalogManagement *CatalogManagementV1) SuspendVersion(suspendVersionOptions *SuspendVersionOptions) (response *core.DetailedResponse, err error) { + return catalogManagement.SuspendVersionWithContext(context.Background(), suspendVersionOptions) } -// DeleteVersionWithContext is an alternate form of the DeleteVersion method which supports a Context parameter -func (catalogManagement *CatalogManagementV1) DeleteVersionWithContext(ctx context.Context, deleteVersionOptions *DeleteVersionOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteVersionOptions, "deleteVersionOptions cannot be nil") +// SuspendVersionWithContext is an alternate form of the SuspendVersion method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) SuspendVersionWithContext(ctx context.Context, suspendVersionOptions *SuspendVersionOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(suspendVersionOptions, "suspendVersionOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteVersionOptions, "deleteVersionOptions") + err = core.ValidateStruct(suspendVersionOptions, "suspendVersionOptions") if err != nil { return } pathParamsMap := map[string]string{ - "version_loc_id": *deleteVersionOptions.VersionLocID, + "version_loc_id": *suspendVersionOptions.VersionLocID, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/versions/{version_loc_id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/versions/{version_loc_id}/suspend`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteVersionOptions.Headers { + for headerName, headerValue := range suspendVersionOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "DeleteVersion") + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "SuspendVersion") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -2876,214 +3431,178 @@ func (catalogManagement *CatalogManagementV1) DeleteVersionWithContext(ctx conte return } -// GetCluster : Get kubernetes cluster -// Get the contents of the specified kubernetes cluster. -func (catalogManagement *CatalogManagementV1) GetCluster(getClusterOptions *GetClusterOptions) (result *ClusterInfo, response *core.DetailedResponse, err error) { - return catalogManagement.GetClusterWithContext(context.Background(), getClusterOptions) +// CommitVersion : Commit version +// Commit a working copy of the specified version. +func (catalogManagement *CatalogManagementV1) CommitVersion(commitVersionOptions *CommitVersionOptions) (response *core.DetailedResponse, err error) { + return catalogManagement.CommitVersionWithContext(context.Background(), commitVersionOptions) } -// GetClusterWithContext is an alternate form of the GetCluster method which supports a Context parameter -func (catalogManagement *CatalogManagementV1) GetClusterWithContext(ctx context.Context, getClusterOptions *GetClusterOptions) (result *ClusterInfo, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getClusterOptions, "getClusterOptions cannot be nil") +// CommitVersionWithContext is an alternate form of the CommitVersion method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) CommitVersionWithContext(ctx context.Context, commitVersionOptions *CommitVersionOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(commitVersionOptions, "commitVersionOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getClusterOptions, "getClusterOptions") + err = core.ValidateStruct(commitVersionOptions, "commitVersionOptions") if err != nil { return } pathParamsMap := map[string]string{ - "cluster_id": *getClusterOptions.ClusterID, + "version_loc_id": *commitVersionOptions.VersionLocID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/deploy/kubernetes/clusters/{cluster_id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/versions/{version_loc_id}/commit`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getClusterOptions.Headers { + for headerName, headerValue := range commitVersionOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "GetCluster") + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "CommitVersion") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - if getClusterOptions.XAuthRefreshToken != nil { - builder.AddHeader("X-Auth-Refresh-Token", fmt.Sprint(*getClusterOptions.XAuthRefreshToken)) - } - - builder.AddQuery("region", fmt.Sprint(*getClusterOptions.Region)) request, err := builder.Build() if err != nil { return } - var rawResponse map[string]json.RawMessage - response, err = catalogManagement.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalClusterInfo) - if err != nil { - return - } - response.Result = result - } + response, err = catalogManagement.Service.Request(request, nil) return } -// GetNamespaces : Get cluster namespaces -// Get the namespaces associated with the specified kubernetes cluster. -func (catalogManagement *CatalogManagementV1) GetNamespaces(getNamespacesOptions *GetNamespacesOptions) (result *NamespaceSearchResult, response *core.DetailedResponse, err error) { - return catalogManagement.GetNamespacesWithContext(context.Background(), getNamespacesOptions) +// CopyVersion : Copy version to new target kind +// Copy the specified version to a new target kind within the same offering. +func (catalogManagement *CatalogManagementV1) CopyVersion(copyVersionOptions *CopyVersionOptions) (response *core.DetailedResponse, err error) { + return catalogManagement.CopyVersionWithContext(context.Background(), copyVersionOptions) } -// GetNamespacesWithContext is an alternate form of the GetNamespaces method which supports a Context parameter -func (catalogManagement *CatalogManagementV1) GetNamespacesWithContext(ctx context.Context, getNamespacesOptions *GetNamespacesOptions) (result *NamespaceSearchResult, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getNamespacesOptions, "getNamespacesOptions cannot be nil") +// CopyVersionWithContext is an alternate form of the CopyVersion method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) CopyVersionWithContext(ctx context.Context, copyVersionOptions *CopyVersionOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(copyVersionOptions, "copyVersionOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getNamespacesOptions, "getNamespacesOptions") + err = core.ValidateStruct(copyVersionOptions, "copyVersionOptions") if err != nil { return } pathParamsMap := map[string]string{ - "cluster_id": *getNamespacesOptions.ClusterID, + "version_loc_id": *copyVersionOptions.VersionLocID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/deploy/kubernetes/clusters/{cluster_id}/namespaces`, pathParamsMap) + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/versions/{version_loc_id}/copy`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getNamespacesOptions.Headers { + for headerName, headerValue := range copyVersionOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "GetNamespaces") + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "CopyVersion") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - if getNamespacesOptions.XAuthRefreshToken != nil { - builder.AddHeader("X-Auth-Refresh-Token", fmt.Sprint(*getNamespacesOptions.XAuthRefreshToken)) - } + builder.AddHeader("Content-Type", "application/json") - builder.AddQuery("region", fmt.Sprint(*getNamespacesOptions.Region)) - if getNamespacesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*getNamespacesOptions.Limit)) + body := make(map[string]interface{}) + if copyVersionOptions.Tags != nil { + body["tags"] = copyVersionOptions.Tags } - if getNamespacesOptions.Offset != nil { - builder.AddQuery("offset", fmt.Sprint(*getNamespacesOptions.Offset)) + if copyVersionOptions.Content != nil { + body["content"] = copyVersionOptions.Content } - - request, err := builder.Build() + if copyVersionOptions.TargetKinds != nil { + body["target_kinds"] = copyVersionOptions.TargetKinds + } + if copyVersionOptions.FormatKind != nil { + body["format_kind"] = copyVersionOptions.FormatKind + } + if copyVersionOptions.Flavor != nil { + body["flavor"] = copyVersionOptions.Flavor + } + if copyVersionOptions.WorkingDirectory != nil { + body["working_directory"] = copyVersionOptions.WorkingDirectory + } + _, err = builder.SetBodyContentJSON(body) if err != nil { return } - var rawResponse map[string]json.RawMessage - response, err = catalogManagement.Service.Request(request, &rawResponse) + request, err := builder.Build() if err != nil { return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNamespaceSearchResult) - if err != nil { - return - } - response.Result = result - } + + response, err = catalogManagement.Service.Request(request, nil) return } -// DeployOperators : Deploy operators -// Deploy operators on a kubernetes cluster. -func (catalogManagement *CatalogManagementV1) DeployOperators(deployOperatorsOptions *DeployOperatorsOptions) (result []OperatorDeployResult, response *core.DetailedResponse, err error) { - return catalogManagement.DeployOperatorsWithContext(context.Background(), deployOperatorsOptions) +// GetOfferingWorkingCopy : Create working copy of version +// Create a working copy of the specified version. +func (catalogManagement *CatalogManagementV1) GetOfferingWorkingCopy(getOfferingWorkingCopyOptions *GetOfferingWorkingCopyOptions) (result *Version, response *core.DetailedResponse, err error) { + return catalogManagement.GetOfferingWorkingCopyWithContext(context.Background(), getOfferingWorkingCopyOptions) } -// DeployOperatorsWithContext is an alternate form of the DeployOperators method which supports a Context parameter -func (catalogManagement *CatalogManagementV1) DeployOperatorsWithContext(ctx context.Context, deployOperatorsOptions *DeployOperatorsOptions) (result []OperatorDeployResult, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deployOperatorsOptions, "deployOperatorsOptions cannot be nil") +// GetOfferingWorkingCopyWithContext is an alternate form of the GetOfferingWorkingCopy method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) GetOfferingWorkingCopyWithContext(ctx context.Context, getOfferingWorkingCopyOptions *GetOfferingWorkingCopyOptions) (result *Version, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getOfferingWorkingCopyOptions, "getOfferingWorkingCopyOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deployOperatorsOptions, "deployOperatorsOptions") + err = core.ValidateStruct(getOfferingWorkingCopyOptions, "getOfferingWorkingCopyOptions") if err != nil { return } + pathParamsMap := map[string]string{ + "version_loc_id": *getOfferingWorkingCopyOptions.VersionLocID, + } + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/deploy/kubernetes/olm/operator`, nil) + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/versions/{version_loc_id}/workingcopy`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deployOperatorsOptions.Headers { + for headerName, headerValue := range getOfferingWorkingCopyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "DeployOperators") + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "GetOfferingWorkingCopy") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - if deployOperatorsOptions.XAuthRefreshToken != nil { - builder.AddHeader("X-Auth-Refresh-Token", fmt.Sprint(*deployOperatorsOptions.XAuthRefreshToken)) + + request, err := builder.Build() + if err != nil { + return } - body := make(map[string]interface{}) - if deployOperatorsOptions.ClusterID != nil { - body["cluster_id"] = deployOperatorsOptions.ClusterID - } - if deployOperatorsOptions.Region != nil { - body["region"] = deployOperatorsOptions.Region - } - if deployOperatorsOptions.Namespaces != nil { - body["namespaces"] = deployOperatorsOptions.Namespaces - } - if deployOperatorsOptions.AllNamespaces != nil { - body["all_namespaces"] = deployOperatorsOptions.AllNamespaces - } - if deployOperatorsOptions.VersionLocatorID != nil { - body["version_locator_id"] = deployOperatorsOptions.VersionLocatorID - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return - } - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse []json.RawMessage + var rawResponse map[string]json.RawMessage response, err = catalogManagement.Service.Request(request, &rawResponse) if err != nil { return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalOperatorDeployResult) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVersion) if err != nil { return } @@ -3093,141 +3612,107 @@ func (catalogManagement *CatalogManagementV1) DeployOperatorsWithContext(ctx con return } -// ListOperators : List operators -// List the operators from a kubernetes cluster. -func (catalogManagement *CatalogManagementV1) ListOperators(listOperatorsOptions *ListOperatorsOptions) (result []OperatorDeployResult, response *core.DetailedResponse, err error) { - return catalogManagement.ListOperatorsWithContext(context.Background(), listOperatorsOptions) +// CopyFromPreviousVersion : Copy values from a previous version +// Copy values from a specified previous version. +func (catalogManagement *CatalogManagementV1) CopyFromPreviousVersion(copyFromPreviousVersionOptions *CopyFromPreviousVersionOptions) (response *core.DetailedResponse, err error) { + return catalogManagement.CopyFromPreviousVersionWithContext(context.Background(), copyFromPreviousVersionOptions) } -// ListOperatorsWithContext is an alternate form of the ListOperators method which supports a Context parameter -func (catalogManagement *CatalogManagementV1) ListOperatorsWithContext(ctx context.Context, listOperatorsOptions *ListOperatorsOptions) (result []OperatorDeployResult, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listOperatorsOptions, "listOperatorsOptions cannot be nil") +// CopyFromPreviousVersionWithContext is an alternate form of the CopyFromPreviousVersion method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) CopyFromPreviousVersionWithContext(ctx context.Context, copyFromPreviousVersionOptions *CopyFromPreviousVersionOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(copyFromPreviousVersionOptions, "copyFromPreviousVersionOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(listOperatorsOptions, "listOperatorsOptions") + err = core.ValidateStruct(copyFromPreviousVersionOptions, "copyFromPreviousVersionOptions") if err != nil { return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "version_loc_id": *copyFromPreviousVersionOptions.VersionLocID, + "type": *copyFromPreviousVersionOptions.Type, + "version_loc_id_to_copy_from": *copyFromPreviousVersionOptions.VersionLocIDToCopyFrom, + } + + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/deploy/kubernetes/olm/operator`, nil) + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/versions/{version_loc_id}/copy/{type}/{version_loc_id_to_copy_from}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listOperatorsOptions.Headers { + for headerName, headerValue := range copyFromPreviousVersionOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "ListOperators") + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "CopyFromPreviousVersion") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - if listOperatorsOptions.XAuthRefreshToken != nil { - builder.AddHeader("X-Auth-Refresh-Token", fmt.Sprint(*listOperatorsOptions.XAuthRefreshToken)) - } - - builder.AddQuery("cluster_id", fmt.Sprint(*listOperatorsOptions.ClusterID)) - builder.AddQuery("region", fmt.Sprint(*listOperatorsOptions.Region)) - builder.AddQuery("version_locator_id", fmt.Sprint(*listOperatorsOptions.VersionLocatorID)) request, err := builder.Build() if err != nil { return } - var rawResponse []json.RawMessage - response, err = catalogManagement.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalOperatorDeployResult) - if err != nil { - return - } - response.Result = result - } + response, err = catalogManagement.Service.Request(request, nil) return } -// ReplaceOperators : Update operators -// Update the operators on a kubernetes cluster. -func (catalogManagement *CatalogManagementV1) ReplaceOperators(replaceOperatorsOptions *ReplaceOperatorsOptions) (result []OperatorDeployResult, response *core.DetailedResponse, err error) { - return catalogManagement.ReplaceOperatorsWithContext(context.Background(), replaceOperatorsOptions) +// GetVersion : Get offering/kind/version 'branch' +// Get the Offering/Kind/Version 'branch' for the specified locator ID. +func (catalogManagement *CatalogManagementV1) GetVersion(getVersionOptions *GetVersionOptions) (result *Offering, response *core.DetailedResponse, err error) { + return catalogManagement.GetVersionWithContext(context.Background(), getVersionOptions) } -// ReplaceOperatorsWithContext is an alternate form of the ReplaceOperators method which supports a Context parameter -func (catalogManagement *CatalogManagementV1) ReplaceOperatorsWithContext(ctx context.Context, replaceOperatorsOptions *ReplaceOperatorsOptions) (result []OperatorDeployResult, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(replaceOperatorsOptions, "replaceOperatorsOptions cannot be nil") +// GetVersionWithContext is an alternate form of the GetVersion method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) GetVersionWithContext(ctx context.Context, getVersionOptions *GetVersionOptions) (result *Offering, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVersionOptions, "getVersionOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(replaceOperatorsOptions, "replaceOperatorsOptions") + err = core.ValidateStruct(getVersionOptions, "getVersionOptions") if err != nil { return } - builder := core.NewRequestBuilder(core.PUT) + pathParamsMap := map[string]string{ + "version_loc_id": *getVersionOptions.VersionLocID, + } + + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/deploy/kubernetes/olm/operator`, nil) + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/versions/{version_loc_id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range replaceOperatorsOptions.Headers { + for headerName, headerValue := range getVersionOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "ReplaceOperators") + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "GetVersion") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - if replaceOperatorsOptions.XAuthRefreshToken != nil { - builder.AddHeader("X-Auth-Refresh-Token", fmt.Sprint(*replaceOperatorsOptions.XAuthRefreshToken)) - } - - body := make(map[string]interface{}) - if replaceOperatorsOptions.ClusterID != nil { - body["cluster_id"] = replaceOperatorsOptions.ClusterID - } - if replaceOperatorsOptions.Region != nil { - body["region"] = replaceOperatorsOptions.Region - } - if replaceOperatorsOptions.Namespaces != nil { - body["namespaces"] = replaceOperatorsOptions.Namespaces - } - if replaceOperatorsOptions.AllNamespaces != nil { - body["all_namespaces"] = replaceOperatorsOptions.AllNamespaces - } - if replaceOperatorsOptions.VersionLocatorID != nil { - body["version_locator_id"] = replaceOperatorsOptions.VersionLocatorID - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return - } request, err := builder.Build() if err != nil { return } - var rawResponse []json.RawMessage + var rawResponse map[string]json.RawMessage response, err = catalogManagement.Service.Request(request, &rawResponse) if err != nil { return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalOperatorDeployResult) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalOffering) if err != nil { return } @@ -3237,46 +3722,44 @@ func (catalogManagement *CatalogManagementV1) ReplaceOperatorsWithContext(ctx co return } -// DeleteOperators : Delete operators -// Delete operators from a kubernetes cluster. -func (catalogManagement *CatalogManagementV1) DeleteOperators(deleteOperatorsOptions *DeleteOperatorsOptions) (response *core.DetailedResponse, err error) { - return catalogManagement.DeleteOperatorsWithContext(context.Background(), deleteOperatorsOptions) +// DeleteVersion : Delete version +// Delete the specified version. If the version is an active version with a working copy, the working copy will be +// deleted as well. +func (catalogManagement *CatalogManagementV1) DeleteVersion(deleteVersionOptions *DeleteVersionOptions) (response *core.DetailedResponse, err error) { + return catalogManagement.DeleteVersionWithContext(context.Background(), deleteVersionOptions) } -// DeleteOperatorsWithContext is an alternate form of the DeleteOperators method which supports a Context parameter -func (catalogManagement *CatalogManagementV1) DeleteOperatorsWithContext(ctx context.Context, deleteOperatorsOptions *DeleteOperatorsOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteOperatorsOptions, "deleteOperatorsOptions cannot be nil") +// DeleteVersionWithContext is an alternate form of the DeleteVersion method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) DeleteVersionWithContext(ctx context.Context, deleteVersionOptions *DeleteVersionOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVersionOptions, "deleteVersionOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteOperatorsOptions, "deleteOperatorsOptions") + err = core.ValidateStruct(deleteVersionOptions, "deleteVersionOptions") if err != nil { return } + pathParamsMap := map[string]string{ + "version_loc_id": *deleteVersionOptions.VersionLocID, + } + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/deploy/kubernetes/olm/operator`, nil) + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/versions/{version_loc_id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteOperatorsOptions.Headers { + for headerName, headerValue := range deleteVersionOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "DeleteOperators") + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "DeleteVersion") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - if deleteOperatorsOptions.XAuthRefreshToken != nil { - builder.AddHeader("X-Auth-Refresh-Token", fmt.Sprint(*deleteOperatorsOptions.XAuthRefreshToken)) - } - - builder.AddQuery("cluster_id", fmt.Sprint(*deleteOperatorsOptions.ClusterID)) - builder.AddQuery("region", fmt.Sprint(*deleteOperatorsOptions.Region)) - builder.AddQuery("version_locator_id", fmt.Sprint(*deleteOperatorsOptions.VersionLocatorID)) request, err := builder.Build() if err != nil { @@ -3288,95 +3771,43 @@ func (catalogManagement *CatalogManagementV1) DeleteOperatorsWithContext(ctx con return } -// InstallVersion : Install version -// Create an install for the specified version. -func (catalogManagement *CatalogManagementV1) InstallVersion(installVersionOptions *InstallVersionOptions) (response *core.DetailedResponse, err error) { - return catalogManagement.InstallVersionWithContext(context.Background(), installVersionOptions) +// DeprecateVersion : Deprecate version immediately - use /archive instead +// Deprecate the specified version. +func (catalogManagement *CatalogManagementV1) DeprecateVersion(deprecateVersionOptions *DeprecateVersionOptions) (response *core.DetailedResponse, err error) { + return catalogManagement.DeprecateVersionWithContext(context.Background(), deprecateVersionOptions) } -// InstallVersionWithContext is an alternate form of the InstallVersion method which supports a Context parameter -func (catalogManagement *CatalogManagementV1) InstallVersionWithContext(ctx context.Context, installVersionOptions *InstallVersionOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(installVersionOptions, "installVersionOptions cannot be nil") +// DeprecateVersionWithContext is an alternate form of the DeprecateVersion method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) DeprecateVersionWithContext(ctx context.Context, deprecateVersionOptions *DeprecateVersionOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deprecateVersionOptions, "deprecateVersionOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(installVersionOptions, "installVersionOptions") + err = core.ValidateStruct(deprecateVersionOptions, "deprecateVersionOptions") if err != nil { return } pathParamsMap := map[string]string{ - "version_loc_id": *installVersionOptions.VersionLocID, + "version_loc_id": *deprecateVersionOptions.VersionLocID, } builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/versions/{version_loc_id}/install`, pathParamsMap) + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/versions/{version_loc_id}/deprecate`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range installVersionOptions.Headers { + for headerName, headerValue := range deprecateVersionOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "InstallVersion") + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "DeprecateVersion") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Content-Type", "application/json") - if installVersionOptions.XAuthRefreshToken != nil { - builder.AddHeader("X-Auth-Refresh-Token", fmt.Sprint(*installVersionOptions.XAuthRefreshToken)) - } - - body := make(map[string]interface{}) - if installVersionOptions.ClusterID != nil { - body["cluster_id"] = installVersionOptions.ClusterID - } - if installVersionOptions.Region != nil { - body["region"] = installVersionOptions.Region - } - if installVersionOptions.Namespace != nil { - body["namespace"] = installVersionOptions.Namespace - } - if installVersionOptions.OverrideValues != nil { - body["override_values"] = installVersionOptions.OverrideValues - } - if installVersionOptions.EntitlementApikey != nil { - body["entitlement_apikey"] = installVersionOptions.EntitlementApikey - } - if installVersionOptions.Schematics != nil { - body["schematics"] = installVersionOptions.Schematics - } - if installVersionOptions.Script != nil { - body["script"] = installVersionOptions.Script - } - if installVersionOptions.ScriptID != nil { - body["script_id"] = installVersionOptions.ScriptID - } - if installVersionOptions.VersionLocatorID != nil { - body["version_locator_id"] = installVersionOptions.VersionLocatorID - } - if installVersionOptions.VcenterID != nil { - body["vcenter_id"] = installVersionOptions.VcenterID - } - if installVersionOptions.VcenterUser != nil { - body["vcenter_user"] = installVersionOptions.VcenterUser - } - if installVersionOptions.VcenterPassword != nil { - body["vcenter_password"] = installVersionOptions.VcenterPassword - } - if installVersionOptions.VcenterLocation != nil { - body["vcenter_location"] = installVersionOptions.VcenterLocation - } - if installVersionOptions.VcenterDatastore != nil { - body["vcenter_datastore"] = installVersionOptions.VcenterDatastore - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return - } request, err := builder.Build() if err != nil { @@ -3388,95 +3819,43 @@ func (catalogManagement *CatalogManagementV1) InstallVersionWithContext(ctx cont return } -// PreinstallVersion : Pre-install version -// Create a pre-install for the specified version. -func (catalogManagement *CatalogManagementV1) PreinstallVersion(preinstallVersionOptions *PreinstallVersionOptions) (response *core.DetailedResponse, err error) { - return catalogManagement.PreinstallVersionWithContext(context.Background(), preinstallVersionOptions) +// AccountPublishVersion : Publish version to account members +// Publish the specified version so it is viewable by account members. +func (catalogManagement *CatalogManagementV1) AccountPublishVersion(accountPublishVersionOptions *AccountPublishVersionOptions) (response *core.DetailedResponse, err error) { + return catalogManagement.AccountPublishVersionWithContext(context.Background(), accountPublishVersionOptions) } -// PreinstallVersionWithContext is an alternate form of the PreinstallVersion method which supports a Context parameter -func (catalogManagement *CatalogManagementV1) PreinstallVersionWithContext(ctx context.Context, preinstallVersionOptions *PreinstallVersionOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(preinstallVersionOptions, "preinstallVersionOptions cannot be nil") +// AccountPublishVersionWithContext is an alternate form of the AccountPublishVersion method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) AccountPublishVersionWithContext(ctx context.Context, accountPublishVersionOptions *AccountPublishVersionOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(accountPublishVersionOptions, "accountPublishVersionOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(preinstallVersionOptions, "preinstallVersionOptions") + err = core.ValidateStruct(accountPublishVersionOptions, "accountPublishVersionOptions") if err != nil { return } pathParamsMap := map[string]string{ - "version_loc_id": *preinstallVersionOptions.VersionLocID, + "version_loc_id": *accountPublishVersionOptions.VersionLocID, } builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/versions/{version_loc_id}/preinstall`, pathParamsMap) + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/versions/{version_loc_id}/account-publish`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range preinstallVersionOptions.Headers { + for headerName, headerValue := range accountPublishVersionOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "PreinstallVersion") + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "AccountPublishVersion") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Content-Type", "application/json") - if preinstallVersionOptions.XAuthRefreshToken != nil { - builder.AddHeader("X-Auth-Refresh-Token", fmt.Sprint(*preinstallVersionOptions.XAuthRefreshToken)) - } - - body := make(map[string]interface{}) - if preinstallVersionOptions.ClusterID != nil { - body["cluster_id"] = preinstallVersionOptions.ClusterID - } - if preinstallVersionOptions.Region != nil { - body["region"] = preinstallVersionOptions.Region - } - if preinstallVersionOptions.Namespace != nil { - body["namespace"] = preinstallVersionOptions.Namespace - } - if preinstallVersionOptions.OverrideValues != nil { - body["override_values"] = preinstallVersionOptions.OverrideValues - } - if preinstallVersionOptions.EntitlementApikey != nil { - body["entitlement_apikey"] = preinstallVersionOptions.EntitlementApikey - } - if preinstallVersionOptions.Schematics != nil { - body["schematics"] = preinstallVersionOptions.Schematics - } - if preinstallVersionOptions.Script != nil { - body["script"] = preinstallVersionOptions.Script - } - if preinstallVersionOptions.ScriptID != nil { - body["script_id"] = preinstallVersionOptions.ScriptID - } - if preinstallVersionOptions.VersionLocatorID != nil { - body["version_locator_id"] = preinstallVersionOptions.VersionLocatorID - } - if preinstallVersionOptions.VcenterID != nil { - body["vcenter_id"] = preinstallVersionOptions.VcenterID - } - if preinstallVersionOptions.VcenterUser != nil { - body["vcenter_user"] = preinstallVersionOptions.VcenterUser - } - if preinstallVersionOptions.VcenterPassword != nil { - body["vcenter_password"] = preinstallVersionOptions.VcenterPassword - } - if preinstallVersionOptions.VcenterLocation != nil { - body["vcenter_location"] = preinstallVersionOptions.VcenterLocation - } - if preinstallVersionOptions.VcenterDatastore != nil { - body["vcenter_datastore"] = preinstallVersionOptions.VcenterDatastore - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return - } request, err := builder.Build() if err != nil { @@ -3488,168 +3867,91 @@ func (catalogManagement *CatalogManagementV1) PreinstallVersionWithContext(ctx c return } -// GetPreinstall : Get version pre-install status -// Get the pre-install status for the specified version. -func (catalogManagement *CatalogManagementV1) GetPreinstall(getPreinstallOptions *GetPreinstallOptions) (result *InstallStatus, response *core.DetailedResponse, err error) { - return catalogManagement.GetPreinstallWithContext(context.Background(), getPreinstallOptions) +// IBMPublishVersion : Publish version to IBMers in public catalog +// Publish the specified version so that it is visible to IBMers in the public catalog. +func (catalogManagement *CatalogManagementV1) IBMPublishVersion(ibmPublishVersionOptions *IBMPublishVersionOptions) (response *core.DetailedResponse, err error) { + return catalogManagement.IBMPublishVersionWithContext(context.Background(), ibmPublishVersionOptions) } -// GetPreinstallWithContext is an alternate form of the GetPreinstall method which supports a Context parameter -func (catalogManagement *CatalogManagementV1) GetPreinstallWithContext(ctx context.Context, getPreinstallOptions *GetPreinstallOptions) (result *InstallStatus, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getPreinstallOptions, "getPreinstallOptions cannot be nil") +// IBMPublishVersionWithContext is an alternate form of the IBMPublishVersion method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) IBMPublishVersionWithContext(ctx context.Context, ibmPublishVersionOptions *IBMPublishVersionOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(ibmPublishVersionOptions, "ibmPublishVersionOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getPreinstallOptions, "getPreinstallOptions") + err = core.ValidateStruct(ibmPublishVersionOptions, "ibmPublishVersionOptions") if err != nil { return } pathParamsMap := map[string]string{ - "version_loc_id": *getPreinstallOptions.VersionLocID, + "version_loc_id": *ibmPublishVersionOptions.VersionLocID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/versions/{version_loc_id}/preinstall`, pathParamsMap) + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/versions/{version_loc_id}/ibm-publish`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getPreinstallOptions.Headers { + for headerName, headerValue := range ibmPublishVersionOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "GetPreinstall") + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "IBMPublishVersion") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - if getPreinstallOptions.XAuthRefreshToken != nil { - builder.AddHeader("X-Auth-Refresh-Token", fmt.Sprint(*getPreinstallOptions.XAuthRefreshToken)) - } - - if getPreinstallOptions.ClusterID != nil { - builder.AddQuery("cluster_id", fmt.Sprint(*getPreinstallOptions.ClusterID)) - } - if getPreinstallOptions.Region != nil { - builder.AddQuery("region", fmt.Sprint(*getPreinstallOptions.Region)) - } - if getPreinstallOptions.Namespace != nil { - builder.AddQuery("namespace", fmt.Sprint(*getPreinstallOptions.Namespace)) - } request, err := builder.Build() if err != nil { return } - var rawResponse map[string]json.RawMessage - response, err = catalogManagement.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstallStatus) - if err != nil { - return - } - response.Result = result - } + response, err = catalogManagement.Service.Request(request, nil) return } -// ValidateInstall : Validate offering -// Validate the offering associated with the specified version. -func (catalogManagement *CatalogManagementV1) ValidateInstall(validateInstallOptions *ValidateInstallOptions) (response *core.DetailedResponse, err error) { - return catalogManagement.ValidateInstallWithContext(context.Background(), validateInstallOptions) +// PublicPublishVersion : Publish version to all users in public catalog +// Publish the specified version so it is visible to all users in the public catalog. +func (catalogManagement *CatalogManagementV1) PublicPublishVersion(publicPublishVersionOptions *PublicPublishVersionOptions) (response *core.DetailedResponse, err error) { + return catalogManagement.PublicPublishVersionWithContext(context.Background(), publicPublishVersionOptions) } -// ValidateInstallWithContext is an alternate form of the ValidateInstall method which supports a Context parameter -func (catalogManagement *CatalogManagementV1) ValidateInstallWithContext(ctx context.Context, validateInstallOptions *ValidateInstallOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(validateInstallOptions, "validateInstallOptions cannot be nil") +// PublicPublishVersionWithContext is an alternate form of the PublicPublishVersion method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) PublicPublishVersionWithContext(ctx context.Context, publicPublishVersionOptions *PublicPublishVersionOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(publicPublishVersionOptions, "publicPublishVersionOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(validateInstallOptions, "validateInstallOptions") + err = core.ValidateStruct(publicPublishVersionOptions, "publicPublishVersionOptions") if err != nil { return } pathParamsMap := map[string]string{ - "version_loc_id": *validateInstallOptions.VersionLocID, + "version_loc_id": *publicPublishVersionOptions.VersionLocID, } builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/versions/{version_loc_id}/validation/install`, pathParamsMap) + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/versions/{version_loc_id}/public-publish`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range validateInstallOptions.Headers { + for headerName, headerValue := range publicPublishVersionOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "ValidateInstall") + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "PublicPublishVersion") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Content-Type", "application/json") - if validateInstallOptions.XAuthRefreshToken != nil { - builder.AddHeader("X-Auth-Refresh-Token", fmt.Sprint(*validateInstallOptions.XAuthRefreshToken)) - } - - body := make(map[string]interface{}) - if validateInstallOptions.ClusterID != nil { - body["cluster_id"] = validateInstallOptions.ClusterID - } - if validateInstallOptions.Region != nil { - body["region"] = validateInstallOptions.Region - } - if validateInstallOptions.Namespace != nil { - body["namespace"] = validateInstallOptions.Namespace - } - if validateInstallOptions.OverrideValues != nil { - body["override_values"] = validateInstallOptions.OverrideValues - } - if validateInstallOptions.EntitlementApikey != nil { - body["entitlement_apikey"] = validateInstallOptions.EntitlementApikey - } - if validateInstallOptions.Schematics != nil { - body["schematics"] = validateInstallOptions.Schematics - } - if validateInstallOptions.Script != nil { - body["script"] = validateInstallOptions.Script - } - if validateInstallOptions.ScriptID != nil { - body["script_id"] = validateInstallOptions.ScriptID - } - if validateInstallOptions.VersionLocatorID != nil { - body["version_locator_id"] = validateInstallOptions.VersionLocatorID - } - if validateInstallOptions.VcenterID != nil { - body["vcenter_id"] = validateInstallOptions.VcenterID - } - if validateInstallOptions.VcenterUser != nil { - body["vcenter_user"] = validateInstallOptions.VcenterUser - } - if validateInstallOptions.VcenterPassword != nil { - body["vcenter_password"] = validateInstallOptions.VcenterPassword - } - if validateInstallOptions.VcenterLocation != nil { - body["vcenter_location"] = validateInstallOptions.VcenterLocation - } - if validateInstallOptions.VcenterDatastore != nil { - body["vcenter_datastore"] = validateInstallOptions.VcenterDatastore - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return - } request, err := builder.Build() if err != nil { @@ -3661,48 +3963,50 @@ func (catalogManagement *CatalogManagementV1) ValidateInstallWithContext(ctx con return } -// GetValidationStatus : Get offering install status -// Returns the install status for the specified offering version. -func (catalogManagement *CatalogManagementV1) GetValidationStatus(getValidationStatusOptions *GetValidationStatusOptions) (result *Validation, response *core.DetailedResponse, err error) { - return catalogManagement.GetValidationStatusWithContext(context.Background(), getValidationStatusOptions) +// GetCluster : Get kubernetes cluster +// Get the contents of the specified kubernetes cluster. +func (catalogManagement *CatalogManagementV1) GetCluster(getClusterOptions *GetClusterOptions) (result *ClusterInfo, response *core.DetailedResponse, err error) { + return catalogManagement.GetClusterWithContext(context.Background(), getClusterOptions) } -// GetValidationStatusWithContext is an alternate form of the GetValidationStatus method which supports a Context parameter -func (catalogManagement *CatalogManagementV1) GetValidationStatusWithContext(ctx context.Context, getValidationStatusOptions *GetValidationStatusOptions) (result *Validation, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getValidationStatusOptions, "getValidationStatusOptions cannot be nil") +// GetClusterWithContext is an alternate form of the GetCluster method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) GetClusterWithContext(ctx context.Context, getClusterOptions *GetClusterOptions) (result *ClusterInfo, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getClusterOptions, "getClusterOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getValidationStatusOptions, "getValidationStatusOptions") + err = core.ValidateStruct(getClusterOptions, "getClusterOptions") if err != nil { return } pathParamsMap := map[string]string{ - "version_loc_id": *getValidationStatusOptions.VersionLocID, + "cluster_id": *getClusterOptions.ClusterID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/versions/{version_loc_id}/validation/install`, pathParamsMap) + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/deploy/kubernetes/clusters/{cluster_id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getValidationStatusOptions.Headers { + for headerName, headerValue := range getClusterOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "GetValidationStatus") + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "GetCluster") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if getValidationStatusOptions.XAuthRefreshToken != nil { - builder.AddHeader("X-Auth-Refresh-Token", fmt.Sprint(*getValidationStatusOptions.XAuthRefreshToken)) + if getClusterOptions.XAuthRefreshToken != nil { + builder.AddHeader("X-Auth-Refresh-Token", fmt.Sprint(*getClusterOptions.XAuthRefreshToken)) } + builder.AddQuery("region", fmt.Sprint(*getClusterOptions.Region)) + request, err := builder.Build() if err != nil { return @@ -3714,7 +4018,7 @@ func (catalogManagement *CatalogManagementV1) GetValidationStatusWithContext(ctx return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalValidation) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalClusterInfo) if err != nil { return } @@ -3724,103 +4028,141 @@ func (catalogManagement *CatalogManagementV1) GetValidationStatusWithContext(ctx return } -// GetOverrideValues : Get override values -// Returns the override values that were used to validate the specified offering version. -func (catalogManagement *CatalogManagementV1) GetOverrideValues(getOverrideValuesOptions *GetOverrideValuesOptions) (result map[string]interface{}, response *core.DetailedResponse, err error) { - return catalogManagement.GetOverrideValuesWithContext(context.Background(), getOverrideValuesOptions) +// GetNamespaces : Get cluster namespaces +// Get the namespaces associated with the specified kubernetes cluster. +func (catalogManagement *CatalogManagementV1) GetNamespaces(getNamespacesOptions *GetNamespacesOptions) (result *NamespaceSearchResult, response *core.DetailedResponse, err error) { + return catalogManagement.GetNamespacesWithContext(context.Background(), getNamespacesOptions) } -// GetOverrideValuesWithContext is an alternate form of the GetOverrideValues method which supports a Context parameter -func (catalogManagement *CatalogManagementV1) GetOverrideValuesWithContext(ctx context.Context, getOverrideValuesOptions *GetOverrideValuesOptions) (result map[string]interface{}, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getOverrideValuesOptions, "getOverrideValuesOptions cannot be nil") +// GetNamespacesWithContext is an alternate form of the GetNamespaces method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) GetNamespacesWithContext(ctx context.Context, getNamespacesOptions *GetNamespacesOptions) (result *NamespaceSearchResult, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getNamespacesOptions, "getNamespacesOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getOverrideValuesOptions, "getOverrideValuesOptions") + err = core.ValidateStruct(getNamespacesOptions, "getNamespacesOptions") if err != nil { return } pathParamsMap := map[string]string{ - "version_loc_id": *getOverrideValuesOptions.VersionLocID, + "cluster_id": *getNamespacesOptions.ClusterID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/versions/{version_loc_id}/validation/overridevalues`, pathParamsMap) + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/deploy/kubernetes/clusters/{cluster_id}/namespaces`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getOverrideValuesOptions.Headers { + for headerName, headerValue := range getNamespacesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "GetOverrideValues") + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "GetNamespaces") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") + if getNamespacesOptions.XAuthRefreshToken != nil { + builder.AddHeader("X-Auth-Refresh-Token", fmt.Sprint(*getNamespacesOptions.XAuthRefreshToken)) + } + + builder.AddQuery("region", fmt.Sprint(*getNamespacesOptions.Region)) + if getNamespacesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*getNamespacesOptions.Limit)) + } + if getNamespacesOptions.Offset != nil { + builder.AddQuery("offset", fmt.Sprint(*getNamespacesOptions.Offset)) + } request, err := builder.Build() if err != nil { return } - response, err = catalogManagement.Service.Request(request, &result) - - return -} - -// SearchObjects : List objects across catalogs -// List the available objects from both public and private catalogs. These copies cannot be used for updating. They are -// not complete and only return what is visible to the caller. -func (catalogManagement *CatalogManagementV1) SearchObjects(searchObjectsOptions *SearchObjectsOptions) (result *ObjectSearchResult, response *core.DetailedResponse, err error) { - return catalogManagement.SearchObjectsWithContext(context.Background(), searchObjectsOptions) + var rawResponse map[string]json.RawMessage + response, err = catalogManagement.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNamespaceSearchResult) + if err != nil { + return + } + response.Result = result + } + + return } -// SearchObjectsWithContext is an alternate form of the SearchObjects method which supports a Context parameter -func (catalogManagement *CatalogManagementV1) SearchObjectsWithContext(ctx context.Context, searchObjectsOptions *SearchObjectsOptions) (result *ObjectSearchResult, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(searchObjectsOptions, "searchObjectsOptions cannot be nil") +// DeployOperators : Deploy operators +// Deploy operators on a kubernetes cluster. +func (catalogManagement *CatalogManagementV1) DeployOperators(deployOperatorsOptions *DeployOperatorsOptions) (result []OperatorDeployResult, response *core.DetailedResponse, err error) { + return catalogManagement.DeployOperatorsWithContext(context.Background(), deployOperatorsOptions) +} + +// DeployOperatorsWithContext is an alternate form of the DeployOperators method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) DeployOperatorsWithContext(ctx context.Context, deployOperatorsOptions *DeployOperatorsOptions) (result []OperatorDeployResult, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deployOperatorsOptions, "deployOperatorsOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(searchObjectsOptions, "searchObjectsOptions") + err = core.ValidateStruct(deployOperatorsOptions, "deployOperatorsOptions") if err != nil { return } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/objects`, nil) + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/deploy/kubernetes/olm/operator`, nil) if err != nil { return } - for headerName, headerValue := range searchObjectsOptions.Headers { + for headerName, headerValue := range deployOperatorsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "SearchObjects") + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "DeployOperators") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + if deployOperatorsOptions.XAuthRefreshToken != nil { + builder.AddHeader("X-Auth-Refresh-Token", fmt.Sprint(*deployOperatorsOptions.XAuthRefreshToken)) + } - builder.AddQuery("query", fmt.Sprint(*searchObjectsOptions.Query)) - if searchObjectsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*searchObjectsOptions.Limit)) + body := make(map[string]interface{}) + if deployOperatorsOptions.ClusterID != nil { + body["cluster_id"] = deployOperatorsOptions.ClusterID } - if searchObjectsOptions.Offset != nil { - builder.AddQuery("offset", fmt.Sprint(*searchObjectsOptions.Offset)) + if deployOperatorsOptions.Region != nil { + body["region"] = deployOperatorsOptions.Region } - if searchObjectsOptions.Collapse != nil { - builder.AddQuery("collapse", fmt.Sprint(*searchObjectsOptions.Collapse)) + if deployOperatorsOptions.Namespaces != nil { + body["namespaces"] = deployOperatorsOptions.Namespaces } - if searchObjectsOptions.Digest != nil { - builder.AddQuery("digest", fmt.Sprint(*searchObjectsOptions.Digest)) + if deployOperatorsOptions.AllNamespaces != nil { + body["all_namespaces"] = deployOperatorsOptions.AllNamespaces + } + if deployOperatorsOptions.VersionLocatorID != nil { + body["version_locator_id"] = deployOperatorsOptions.VersionLocatorID + } + if deployOperatorsOptions.Channel != nil { + body["channel"] = deployOperatorsOptions.Channel + } + if deployOperatorsOptions.InstallPlan != nil { + body["install_plan"] = deployOperatorsOptions.InstallPlan + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return } request, err := builder.Build() @@ -3828,13 +4170,13 @@ func (catalogManagement *CatalogManagementV1) SearchObjectsWithContext(ctx conte return } - var rawResponse map[string]json.RawMessage + var rawResponse []json.RawMessage response, err = catalogManagement.Service.Request(request, &rawResponse) if err != nil { return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalObjectSearchResult) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalOperatorDeployResult) if err != nil { return } @@ -3844,70 +4186,60 @@ func (catalogManagement *CatalogManagementV1) SearchObjectsWithContext(ctx conte return } -// ListObjects : List objects within a catalog -// List the available objects within the specified catalog. -func (catalogManagement *CatalogManagementV1) ListObjects(listObjectsOptions *ListObjectsOptions) (result *ObjectListResult, response *core.DetailedResponse, err error) { - return catalogManagement.ListObjectsWithContext(context.Background(), listObjectsOptions) +// ListOperators : List operators +// List the operators from a kubernetes cluster. +func (catalogManagement *CatalogManagementV1) ListOperators(listOperatorsOptions *ListOperatorsOptions) (result []OperatorDeployResult, response *core.DetailedResponse, err error) { + return catalogManagement.ListOperatorsWithContext(context.Background(), listOperatorsOptions) } -// ListObjectsWithContext is an alternate form of the ListObjects method which supports a Context parameter -func (catalogManagement *CatalogManagementV1) ListObjectsWithContext(ctx context.Context, listObjectsOptions *ListObjectsOptions) (result *ObjectListResult, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listObjectsOptions, "listObjectsOptions cannot be nil") +// ListOperatorsWithContext is an alternate form of the ListOperators method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) ListOperatorsWithContext(ctx context.Context, listOperatorsOptions *ListOperatorsOptions) (result []OperatorDeployResult, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listOperatorsOptions, "listOperatorsOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(listObjectsOptions, "listObjectsOptions") + err = core.ValidateStruct(listOperatorsOptions, "listOperatorsOptions") if err != nil { return } - pathParamsMap := map[string]string{ - "catalog_identifier": *listObjectsOptions.CatalogIdentifier, - } - builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/catalogs/{catalog_identifier}/objects`, pathParamsMap) + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/deploy/kubernetes/olm/operator`, nil) if err != nil { return } - for headerName, headerValue := range listObjectsOptions.Headers { + for headerName, headerValue := range listOperatorsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "ListObjects") + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "ListOperators") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - - if listObjectsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listObjectsOptions.Limit)) - } - if listObjectsOptions.Offset != nil { - builder.AddQuery("offset", fmt.Sprint(*listObjectsOptions.Offset)) - } - if listObjectsOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listObjectsOptions.Name)) - } - if listObjectsOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listObjectsOptions.Sort)) + if listOperatorsOptions.XAuthRefreshToken != nil { + builder.AddHeader("X-Auth-Refresh-Token", fmt.Sprint(*listOperatorsOptions.XAuthRefreshToken)) } + builder.AddQuery("cluster_id", fmt.Sprint(*listOperatorsOptions.ClusterID)) + builder.AddQuery("region", fmt.Sprint(*listOperatorsOptions.Region)) + builder.AddQuery("version_locator_id", fmt.Sprint(*listOperatorsOptions.VersionLocatorID)) + request, err := builder.Build() if err != nil { return } - var rawResponse map[string]json.RawMessage + var rawResponse []json.RawMessage response, err = catalogManagement.Service.Request(request, &rawResponse) if err != nil { return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalObjectListResult) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalOperatorDeployResult) if err != nil { return } @@ -3917,103 +4249,66 @@ func (catalogManagement *CatalogManagementV1) ListObjectsWithContext(ctx context return } -// CreateObject : Create catalog object -// Create an object with a specific catalog. -func (catalogManagement *CatalogManagementV1) CreateObject(createObjectOptions *CreateObjectOptions) (result *CatalogObject, response *core.DetailedResponse, err error) { - return catalogManagement.CreateObjectWithContext(context.Background(), createObjectOptions) +// ReplaceOperators : Update operators +// Update the operators on a kubernetes cluster. +func (catalogManagement *CatalogManagementV1) ReplaceOperators(replaceOperatorsOptions *ReplaceOperatorsOptions) (result []OperatorDeployResult, response *core.DetailedResponse, err error) { + return catalogManagement.ReplaceOperatorsWithContext(context.Background(), replaceOperatorsOptions) } -// CreateObjectWithContext is an alternate form of the CreateObject method which supports a Context parameter -func (catalogManagement *CatalogManagementV1) CreateObjectWithContext(ctx context.Context, createObjectOptions *CreateObjectOptions) (result *CatalogObject, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createObjectOptions, "createObjectOptions cannot be nil") +// ReplaceOperatorsWithContext is an alternate form of the ReplaceOperators method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) ReplaceOperatorsWithContext(ctx context.Context, replaceOperatorsOptions *ReplaceOperatorsOptions) (result []OperatorDeployResult, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(replaceOperatorsOptions, "replaceOperatorsOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createObjectOptions, "createObjectOptions") + err = core.ValidateStruct(replaceOperatorsOptions, "replaceOperatorsOptions") if err != nil { return } - pathParamsMap := map[string]string{ - "catalog_identifier": *createObjectOptions.CatalogIdentifier, - } - - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.PUT) builder = builder.WithContext(ctx) builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/catalogs/{catalog_identifier}/objects`, pathParamsMap) + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/deploy/kubernetes/olm/operator`, nil) if err != nil { return } - for headerName, headerValue := range createObjectOptions.Headers { + for headerName, headerValue := range replaceOperatorsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "CreateObject") + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "ReplaceOperators") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") builder.AddHeader("Content-Type", "application/json") + if replaceOperatorsOptions.XAuthRefreshToken != nil { + builder.AddHeader("X-Auth-Refresh-Token", fmt.Sprint(*replaceOperatorsOptions.XAuthRefreshToken)) + } body := make(map[string]interface{}) - if createObjectOptions.ID != nil { - body["id"] = createObjectOptions.ID - } - if createObjectOptions.Name != nil { - body["name"] = createObjectOptions.Name - } - if createObjectOptions.Rev != nil { - body["_rev"] = createObjectOptions.Rev - } - if createObjectOptions.CRN != nil { - body["crn"] = createObjectOptions.CRN - } - if createObjectOptions.URL != nil { - body["url"] = createObjectOptions.URL - } - if createObjectOptions.ParentID != nil { - body["parent_id"] = createObjectOptions.ParentID - } - if createObjectOptions.LabelI18n != nil { - body["label_i18n"] = createObjectOptions.LabelI18n - } - if createObjectOptions.Label != nil { - body["label"] = createObjectOptions.Label - } - if createObjectOptions.Tags != nil { - body["tags"] = createObjectOptions.Tags - } - if createObjectOptions.Created != nil { - body["created"] = createObjectOptions.Created - } - if createObjectOptions.Updated != nil { - body["updated"] = createObjectOptions.Updated - } - if createObjectOptions.ShortDescription != nil { - body["short_description"] = createObjectOptions.ShortDescription - } - if createObjectOptions.ShortDescriptionI18n != nil { - body["short_description_i18n"] = createObjectOptions.ShortDescriptionI18n + if replaceOperatorsOptions.ClusterID != nil { + body["cluster_id"] = replaceOperatorsOptions.ClusterID } - if createObjectOptions.Kind != nil { - body["kind"] = createObjectOptions.Kind + if replaceOperatorsOptions.Region != nil { + body["region"] = replaceOperatorsOptions.Region } - if createObjectOptions.Publish != nil { - body["publish"] = createObjectOptions.Publish + if replaceOperatorsOptions.Namespaces != nil { + body["namespaces"] = replaceOperatorsOptions.Namespaces } - if createObjectOptions.State != nil { - body["state"] = createObjectOptions.State + if replaceOperatorsOptions.AllNamespaces != nil { + body["all_namespaces"] = replaceOperatorsOptions.AllNamespaces } - if createObjectOptions.CatalogID != nil { - body["catalog_id"] = createObjectOptions.CatalogID + if replaceOperatorsOptions.VersionLocatorID != nil { + body["version_locator_id"] = replaceOperatorsOptions.VersionLocatorID } - if createObjectOptions.CatalogName != nil { - body["catalog_name"] = createObjectOptions.CatalogName + if replaceOperatorsOptions.Channel != nil { + body["channel"] = replaceOperatorsOptions.Channel } - if createObjectOptions.Data != nil { - body["data"] = createObjectOptions.Data + if replaceOperatorsOptions.InstallPlan != nil { + body["install_plan"] = replaceOperatorsOptions.InstallPlan } _, err = builder.SetBodyContentJSON(body) if err != nil { @@ -4025,13 +4320,13 @@ func (catalogManagement *CatalogManagementV1) CreateObjectWithContext(ctx contex return } - var rawResponse map[string]json.RawMessage + var rawResponse []json.RawMessage response, err = catalogManagement.Service.Request(request, &rawResponse) if err != nil { return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalCatalogObject) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalOperatorDeployResult) if err != nil { return } @@ -4041,165 +4336,144 @@ func (catalogManagement *CatalogManagementV1) CreateObjectWithContext(ctx contex return } -// GetObject : Get catalog object -// Get the specified object from within the specified catalog. -func (catalogManagement *CatalogManagementV1) GetObject(getObjectOptions *GetObjectOptions) (result *CatalogObject, response *core.DetailedResponse, err error) { - return catalogManagement.GetObjectWithContext(context.Background(), getObjectOptions) +// DeleteOperators : Delete operators +// Delete operators from a kubernetes cluster. +func (catalogManagement *CatalogManagementV1) DeleteOperators(deleteOperatorsOptions *DeleteOperatorsOptions) (response *core.DetailedResponse, err error) { + return catalogManagement.DeleteOperatorsWithContext(context.Background(), deleteOperatorsOptions) } -// GetObjectWithContext is an alternate form of the GetObject method which supports a Context parameter -func (catalogManagement *CatalogManagementV1) GetObjectWithContext(ctx context.Context, getObjectOptions *GetObjectOptions) (result *CatalogObject, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getObjectOptions, "getObjectOptions cannot be nil") +// DeleteOperatorsWithContext is an alternate form of the DeleteOperators method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) DeleteOperatorsWithContext(ctx context.Context, deleteOperatorsOptions *DeleteOperatorsOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteOperatorsOptions, "deleteOperatorsOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getObjectOptions, "getObjectOptions") + err = core.ValidateStruct(deleteOperatorsOptions, "deleteOperatorsOptions") if err != nil { return } - pathParamsMap := map[string]string{ - "catalog_identifier": *getObjectOptions.CatalogIdentifier, - "object_identifier": *getObjectOptions.ObjectIdentifier, - } - - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/catalogs/{catalog_identifier}/objects/{object_identifier}`, pathParamsMap) + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/deploy/kubernetes/olm/operator`, nil) if err != nil { return } - for headerName, headerValue := range getObjectOptions.Headers { + for headerName, headerValue := range deleteOperatorsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "GetObject") + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "DeleteOperators") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") + if deleteOperatorsOptions.XAuthRefreshToken != nil { + builder.AddHeader("X-Auth-Refresh-Token", fmt.Sprint(*deleteOperatorsOptions.XAuthRefreshToken)) + } + + builder.AddQuery("cluster_id", fmt.Sprint(*deleteOperatorsOptions.ClusterID)) + builder.AddQuery("region", fmt.Sprint(*deleteOperatorsOptions.Region)) + builder.AddQuery("version_locator_id", fmt.Sprint(*deleteOperatorsOptions.VersionLocatorID)) request, err := builder.Build() if err != nil { return } - var rawResponse map[string]json.RawMessage - response, err = catalogManagement.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalCatalogObject) - if err != nil { - return - } - response.Result = result - } + response, err = catalogManagement.Service.Request(request, nil) return } -// ReplaceObject : Update catalog object -// Update an object within a specific catalog. -func (catalogManagement *CatalogManagementV1) ReplaceObject(replaceObjectOptions *ReplaceObjectOptions) (result *CatalogObject, response *core.DetailedResponse, err error) { - return catalogManagement.ReplaceObjectWithContext(context.Background(), replaceObjectOptions) +// InstallVersion : Install version +// Create an install for the specified version. +func (catalogManagement *CatalogManagementV1) InstallVersion(installVersionOptions *InstallVersionOptions) (response *core.DetailedResponse, err error) { + return catalogManagement.InstallVersionWithContext(context.Background(), installVersionOptions) } -// ReplaceObjectWithContext is an alternate form of the ReplaceObject method which supports a Context parameter -func (catalogManagement *CatalogManagementV1) ReplaceObjectWithContext(ctx context.Context, replaceObjectOptions *ReplaceObjectOptions) (result *CatalogObject, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(replaceObjectOptions, "replaceObjectOptions cannot be nil") +// InstallVersionWithContext is an alternate form of the InstallVersion method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) InstallVersionWithContext(ctx context.Context, installVersionOptions *InstallVersionOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(installVersionOptions, "installVersionOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(replaceObjectOptions, "replaceObjectOptions") + err = core.ValidateStruct(installVersionOptions, "installVersionOptions") if err != nil { return } pathParamsMap := map[string]string{ - "catalog_identifier": *replaceObjectOptions.CatalogIdentifier, - "object_identifier": *replaceObjectOptions.ObjectIdentifier, + "version_loc_id": *installVersionOptions.VersionLocID, } - builder := core.NewRequestBuilder(core.PUT) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/catalogs/{catalog_identifier}/objects/{object_identifier}`, pathParamsMap) + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/versions/{version_loc_id}/install`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range replaceObjectOptions.Headers { + for headerName, headerValue := range installVersionOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "ReplaceObject") + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "InstallVersion") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") builder.AddHeader("Content-Type", "application/json") + if installVersionOptions.XAuthRefreshToken != nil { + builder.AddHeader("X-Auth-Refresh-Token", fmt.Sprint(*installVersionOptions.XAuthRefreshToken)) + } body := make(map[string]interface{}) - if replaceObjectOptions.ID != nil { - body["id"] = replaceObjectOptions.ID - } - if replaceObjectOptions.Name != nil { - body["name"] = replaceObjectOptions.Name - } - if replaceObjectOptions.Rev != nil { - body["_rev"] = replaceObjectOptions.Rev - } - if replaceObjectOptions.CRN != nil { - body["crn"] = replaceObjectOptions.CRN - } - if replaceObjectOptions.URL != nil { - body["url"] = replaceObjectOptions.URL + if installVersionOptions.ClusterID != nil { + body["cluster_id"] = installVersionOptions.ClusterID } - if replaceObjectOptions.ParentID != nil { - body["parent_id"] = replaceObjectOptions.ParentID + if installVersionOptions.Region != nil { + body["region"] = installVersionOptions.Region } - if replaceObjectOptions.LabelI18n != nil { - body["label_i18n"] = replaceObjectOptions.LabelI18n + if installVersionOptions.Namespace != nil { + body["namespace"] = installVersionOptions.Namespace } - if replaceObjectOptions.Label != nil { - body["label"] = replaceObjectOptions.Label + if installVersionOptions.OverrideValues != nil { + body["override_values"] = installVersionOptions.OverrideValues } - if replaceObjectOptions.Tags != nil { - body["tags"] = replaceObjectOptions.Tags + if installVersionOptions.EnvironmentVariables != nil { + body["environment_variables"] = installVersionOptions.EnvironmentVariables } - if replaceObjectOptions.Created != nil { - body["created"] = replaceObjectOptions.Created + if installVersionOptions.EntitlementApikey != nil { + body["entitlement_apikey"] = installVersionOptions.EntitlementApikey } - if replaceObjectOptions.Updated != nil { - body["updated"] = replaceObjectOptions.Updated + if installVersionOptions.Schematics != nil { + body["schematics"] = installVersionOptions.Schematics } - if replaceObjectOptions.ShortDescription != nil { - body["short_description"] = replaceObjectOptions.ShortDescription + if installVersionOptions.Script != nil { + body["script"] = installVersionOptions.Script } - if replaceObjectOptions.ShortDescriptionI18n != nil { - body["short_description_i18n"] = replaceObjectOptions.ShortDescriptionI18n + if installVersionOptions.ScriptID != nil { + body["script_id"] = installVersionOptions.ScriptID } - if replaceObjectOptions.Kind != nil { - body["kind"] = replaceObjectOptions.Kind + if installVersionOptions.VersionLocatorID != nil { + body["version_locator_id"] = installVersionOptions.VersionLocatorID } - if replaceObjectOptions.Publish != nil { - body["publish"] = replaceObjectOptions.Publish + if installVersionOptions.VcenterID != nil { + body["vcenter_id"] = installVersionOptions.VcenterID } - if replaceObjectOptions.State != nil { - body["state"] = replaceObjectOptions.State + if installVersionOptions.VcenterLocation != nil { + body["vcenter_location"] = installVersionOptions.VcenterLocation } - if replaceObjectOptions.CatalogID != nil { - body["catalog_id"] = replaceObjectOptions.CatalogID + if installVersionOptions.VcenterUser != nil { + body["vcenter_user"] = installVersionOptions.VcenterUser } - if replaceObjectOptions.CatalogName != nil { - body["catalog_name"] = replaceObjectOptions.CatalogName + if installVersionOptions.VcenterPassword != nil { + body["vcenter_password"] = installVersionOptions.VcenterPassword } - if replaceObjectOptions.Data != nil { - body["data"] = replaceObjectOptions.Data + if installVersionOptions.VcenterDatastore != nil { + body["vcenter_datastore"] = installVersionOptions.VcenterDatastore } _, err = builder.SetBodyContentJSON(body) if err != nil { @@ -4211,60 +4485,103 @@ func (catalogManagement *CatalogManagementV1) ReplaceObjectWithContext(ctx conte return } - var rawResponse map[string]json.RawMessage - response, err = catalogManagement.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalCatalogObject) - if err != nil { - return - } - response.Result = result - } + response, err = catalogManagement.Service.Request(request, nil) return } -// DeleteObject : Delete catalog object -// Delete a specific object within a specific catalog. -func (catalogManagement *CatalogManagementV1) DeleteObject(deleteObjectOptions *DeleteObjectOptions) (response *core.DetailedResponse, err error) { - return catalogManagement.DeleteObjectWithContext(context.Background(), deleteObjectOptions) +// PreinstallVersion : Pre-install version +// Create a pre-install for the specified version. +func (catalogManagement *CatalogManagementV1) PreinstallVersion(preinstallVersionOptions *PreinstallVersionOptions) (response *core.DetailedResponse, err error) { + return catalogManagement.PreinstallVersionWithContext(context.Background(), preinstallVersionOptions) } -// DeleteObjectWithContext is an alternate form of the DeleteObject method which supports a Context parameter -func (catalogManagement *CatalogManagementV1) DeleteObjectWithContext(ctx context.Context, deleteObjectOptions *DeleteObjectOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteObjectOptions, "deleteObjectOptions cannot be nil") +// PreinstallVersionWithContext is an alternate form of the PreinstallVersion method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) PreinstallVersionWithContext(ctx context.Context, preinstallVersionOptions *PreinstallVersionOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(preinstallVersionOptions, "preinstallVersionOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteObjectOptions, "deleteObjectOptions") + err = core.ValidateStruct(preinstallVersionOptions, "preinstallVersionOptions") if err != nil { return } pathParamsMap := map[string]string{ - "catalog_identifier": *deleteObjectOptions.CatalogIdentifier, - "object_identifier": *deleteObjectOptions.ObjectIdentifier, + "version_loc_id": *preinstallVersionOptions.VersionLocID, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/catalogs/{catalog_identifier}/objects/{object_identifier}`, pathParamsMap) + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/versions/{version_loc_id}/preinstall`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteObjectOptions.Headers { + for headerName, headerValue := range preinstallVersionOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "DeleteObject") + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "PreinstallVersion") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Content-Type", "application/json") + if preinstallVersionOptions.XAuthRefreshToken != nil { + builder.AddHeader("X-Auth-Refresh-Token", fmt.Sprint(*preinstallVersionOptions.XAuthRefreshToken)) + } + + body := make(map[string]interface{}) + if preinstallVersionOptions.ClusterID != nil { + body["cluster_id"] = preinstallVersionOptions.ClusterID + } + if preinstallVersionOptions.Region != nil { + body["region"] = preinstallVersionOptions.Region + } + if preinstallVersionOptions.Namespace != nil { + body["namespace"] = preinstallVersionOptions.Namespace + } + if preinstallVersionOptions.OverrideValues != nil { + body["override_values"] = preinstallVersionOptions.OverrideValues + } + if preinstallVersionOptions.EnvironmentVariables != nil { + body["environment_variables"] = preinstallVersionOptions.EnvironmentVariables + } + if preinstallVersionOptions.EntitlementApikey != nil { + body["entitlement_apikey"] = preinstallVersionOptions.EntitlementApikey + } + if preinstallVersionOptions.Schematics != nil { + body["schematics"] = preinstallVersionOptions.Schematics + } + if preinstallVersionOptions.Script != nil { + body["script"] = preinstallVersionOptions.Script + } + if preinstallVersionOptions.ScriptID != nil { + body["script_id"] = preinstallVersionOptions.ScriptID + } + if preinstallVersionOptions.VersionLocatorID != nil { + body["version_locator_id"] = preinstallVersionOptions.VersionLocatorID + } + if preinstallVersionOptions.VcenterID != nil { + body["vcenter_id"] = preinstallVersionOptions.VcenterID + } + if preinstallVersionOptions.VcenterLocation != nil { + body["vcenter_location"] = preinstallVersionOptions.VcenterLocation + } + if preinstallVersionOptions.VcenterUser != nil { + body["vcenter_user"] = preinstallVersionOptions.VcenterUser + } + if preinstallVersionOptions.VcenterPassword != nil { + body["vcenter_password"] = preinstallVersionOptions.VcenterPassword + } + if preinstallVersionOptions.VcenterDatastore != nil { + body["vcenter_datastore"] = preinstallVersionOptions.VcenterDatastore + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } request, err := builder.Build() if err != nil { @@ -4276,45 +4593,57 @@ func (catalogManagement *CatalogManagementV1) DeleteObjectWithContext(ctx contex return } -// GetObjectAudit : Get catalog object audit log -// Get the audit log associated with a specific catalog object. -func (catalogManagement *CatalogManagementV1) GetObjectAudit(getObjectAuditOptions *GetObjectAuditOptions) (result *AuditLog, response *core.DetailedResponse, err error) { - return catalogManagement.GetObjectAuditWithContext(context.Background(), getObjectAuditOptions) +// GetPreinstall : Get version pre-install status +// Get the pre-install status for the specified version. +func (catalogManagement *CatalogManagementV1) GetPreinstall(getPreinstallOptions *GetPreinstallOptions) (result *InstallStatus, response *core.DetailedResponse, err error) { + return catalogManagement.GetPreinstallWithContext(context.Background(), getPreinstallOptions) } -// GetObjectAuditWithContext is an alternate form of the GetObjectAudit method which supports a Context parameter -func (catalogManagement *CatalogManagementV1) GetObjectAuditWithContext(ctx context.Context, getObjectAuditOptions *GetObjectAuditOptions) (result *AuditLog, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getObjectAuditOptions, "getObjectAuditOptions cannot be nil") +// GetPreinstallWithContext is an alternate form of the GetPreinstall method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) GetPreinstallWithContext(ctx context.Context, getPreinstallOptions *GetPreinstallOptions) (result *InstallStatus, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getPreinstallOptions, "getPreinstallOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getObjectAuditOptions, "getObjectAuditOptions") + err = core.ValidateStruct(getPreinstallOptions, "getPreinstallOptions") if err != nil { return } pathParamsMap := map[string]string{ - "catalog_identifier": *getObjectAuditOptions.CatalogIdentifier, - "object_identifier": *getObjectAuditOptions.ObjectIdentifier, + "version_loc_id": *getPreinstallOptions.VersionLocID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/catalogs/{catalog_identifier}/objects/{object_identifier}/audit`, pathParamsMap) + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/versions/{version_loc_id}/preinstall`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getObjectAuditOptions.Headers { + for headerName, headerValue := range getPreinstallOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "GetObjectAudit") + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "GetPreinstall") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") + if getPreinstallOptions.XAuthRefreshToken != nil { + builder.AddHeader("X-Auth-Refresh-Token", fmt.Sprint(*getPreinstallOptions.XAuthRefreshToken)) + } + + if getPreinstallOptions.ClusterID != nil { + builder.AddQuery("cluster_id", fmt.Sprint(*getPreinstallOptions.ClusterID)) + } + if getPreinstallOptions.Region != nil { + builder.AddQuery("region", fmt.Sprint(*getPreinstallOptions.Region)) + } + if getPreinstallOptions.Namespace != nil { + builder.AddQuery("namespace", fmt.Sprint(*getPreinstallOptions.Namespace)) + } request, err := builder.Build() if err != nil { @@ -4327,7 +4656,7 @@ func (catalogManagement *CatalogManagementV1) GetObjectAuditWithContext(ctx cont return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAuditLog) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstallStatus) if err != nil { return } @@ -4337,92 +4666,97 @@ func (catalogManagement *CatalogManagementV1) GetObjectAuditWithContext(ctx cont return } -// AccountPublishObject : Publish object to account -// Publish a catalog object to account. -func (catalogManagement *CatalogManagementV1) AccountPublishObject(accountPublishObjectOptions *AccountPublishObjectOptions) (response *core.DetailedResponse, err error) { - return catalogManagement.AccountPublishObjectWithContext(context.Background(), accountPublishObjectOptions) +// ValidateInstall : Validate offering +// Validate the offering associated with the specified version. +func (catalogManagement *CatalogManagementV1) ValidateInstall(validateInstallOptions *ValidateInstallOptions) (response *core.DetailedResponse, err error) { + return catalogManagement.ValidateInstallWithContext(context.Background(), validateInstallOptions) } -// AccountPublishObjectWithContext is an alternate form of the AccountPublishObject method which supports a Context parameter -func (catalogManagement *CatalogManagementV1) AccountPublishObjectWithContext(ctx context.Context, accountPublishObjectOptions *AccountPublishObjectOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(accountPublishObjectOptions, "accountPublishObjectOptions cannot be nil") +// ValidateInstallWithContext is an alternate form of the ValidateInstall method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) ValidateInstallWithContext(ctx context.Context, validateInstallOptions *ValidateInstallOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(validateInstallOptions, "validateInstallOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(accountPublishObjectOptions, "accountPublishObjectOptions") + err = core.ValidateStruct(validateInstallOptions, "validateInstallOptions") if err != nil { return } pathParamsMap := map[string]string{ - "catalog_identifier": *accountPublishObjectOptions.CatalogIdentifier, - "object_identifier": *accountPublishObjectOptions.ObjectIdentifier, + "version_loc_id": *validateInstallOptions.VersionLocID, } builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/catalogs/{catalog_identifier}/objects/{object_identifier}/account-publish`, pathParamsMap) + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/versions/{version_loc_id}/validation/install`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range accountPublishObjectOptions.Headers { + for headerName, headerValue := range validateInstallOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "AccountPublishObject") + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "ValidateInstall") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - - request, err := builder.Build() - if err != nil { - return + builder.AddHeader("Content-Type", "application/json") + if validateInstallOptions.XAuthRefreshToken != nil { + builder.AddHeader("X-Auth-Refresh-Token", fmt.Sprint(*validateInstallOptions.XAuthRefreshToken)) } - response, err = catalogManagement.Service.Request(request, nil) - - return -} - -// SharedPublishObject : Publish object to share with allow list -// Publish the specified object so that it is visible to those in the allow list. -func (catalogManagement *CatalogManagementV1) SharedPublishObject(sharedPublishObjectOptions *SharedPublishObjectOptions) (response *core.DetailedResponse, err error) { - return catalogManagement.SharedPublishObjectWithContext(context.Background(), sharedPublishObjectOptions) -} - -// SharedPublishObjectWithContext is an alternate form of the SharedPublishObject method which supports a Context parameter -func (catalogManagement *CatalogManagementV1) SharedPublishObjectWithContext(ctx context.Context, sharedPublishObjectOptions *SharedPublishObjectOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(sharedPublishObjectOptions, "sharedPublishObjectOptions cannot be nil") - if err != nil { - return + body := make(map[string]interface{}) + if validateInstallOptions.ClusterID != nil { + body["cluster_id"] = validateInstallOptions.ClusterID } - err = core.ValidateStruct(sharedPublishObjectOptions, "sharedPublishObjectOptions") - if err != nil { - return + if validateInstallOptions.Region != nil { + body["region"] = validateInstallOptions.Region } - - pathParamsMap := map[string]string{ - "catalog_identifier": *sharedPublishObjectOptions.CatalogIdentifier, - "object_identifier": *sharedPublishObjectOptions.ObjectIdentifier, + if validateInstallOptions.Namespace != nil { + body["namespace"] = validateInstallOptions.Namespace } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/catalogs/{catalog_identifier}/objects/{object_identifier}/shared-publish`, pathParamsMap) - if err != nil { - return + if validateInstallOptions.OverrideValues != nil { + body["override_values"] = validateInstallOptions.OverrideValues } - - for headerName, headerValue := range sharedPublishObjectOptions.Headers { - builder.AddHeader(headerName, headerValue) + if validateInstallOptions.EnvironmentVariables != nil { + body["environment_variables"] = validateInstallOptions.EnvironmentVariables } - - sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "SharedPublishObject") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) + if validateInstallOptions.EntitlementApikey != nil { + body["entitlement_apikey"] = validateInstallOptions.EntitlementApikey + } + if validateInstallOptions.Schematics != nil { + body["schematics"] = validateInstallOptions.Schematics + } + if validateInstallOptions.Script != nil { + body["script"] = validateInstallOptions.Script + } + if validateInstallOptions.ScriptID != nil { + body["script_id"] = validateInstallOptions.ScriptID + } + if validateInstallOptions.VersionLocatorID != nil { + body["version_locator_id"] = validateInstallOptions.VersionLocatorID + } + if validateInstallOptions.VcenterID != nil { + body["vcenter_id"] = validateInstallOptions.VcenterID + } + if validateInstallOptions.VcenterLocation != nil { + body["vcenter_location"] = validateInstallOptions.VcenterLocation + } + if validateInstallOptions.VcenterUser != nil { + body["vcenter_user"] = validateInstallOptions.VcenterUser + } + if validateInstallOptions.VcenterPassword != nil { + body["vcenter_password"] = validateInstallOptions.VcenterPassword + } + if validateInstallOptions.VcenterDatastore != nil { + body["vcenter_datastore"] = validateInstallOptions.VcenterDatastore + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return } request, err := builder.Build() @@ -4435,198 +4769,247 @@ func (catalogManagement *CatalogManagementV1) SharedPublishObjectWithContext(ctx return } -// IBMPublishObject : Publish object to share with IBMers -// Publish the specified object so that it is visible to IBMers in the public catalog. -func (catalogManagement *CatalogManagementV1) IBMPublishObject(ibmPublishObjectOptions *IBMPublishObjectOptions) (response *core.DetailedResponse, err error) { - return catalogManagement.IBMPublishObjectWithContext(context.Background(), ibmPublishObjectOptions) +// GetValidationStatus : Get offering install status +// Returns the install status for the specified offering version. +func (catalogManagement *CatalogManagementV1) GetValidationStatus(getValidationStatusOptions *GetValidationStatusOptions) (result *Validation, response *core.DetailedResponse, err error) { + return catalogManagement.GetValidationStatusWithContext(context.Background(), getValidationStatusOptions) } -// IBMPublishObjectWithContext is an alternate form of the IBMPublishObject method which supports a Context parameter -func (catalogManagement *CatalogManagementV1) IBMPublishObjectWithContext(ctx context.Context, ibmPublishObjectOptions *IBMPublishObjectOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(ibmPublishObjectOptions, "ibmPublishObjectOptions cannot be nil") +// GetValidationStatusWithContext is an alternate form of the GetValidationStatus method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) GetValidationStatusWithContext(ctx context.Context, getValidationStatusOptions *GetValidationStatusOptions) (result *Validation, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getValidationStatusOptions, "getValidationStatusOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(ibmPublishObjectOptions, "ibmPublishObjectOptions") + err = core.ValidateStruct(getValidationStatusOptions, "getValidationStatusOptions") if err != nil { return } pathParamsMap := map[string]string{ - "catalog_identifier": *ibmPublishObjectOptions.CatalogIdentifier, - "object_identifier": *ibmPublishObjectOptions.ObjectIdentifier, + "version_loc_id": *getValidationStatusOptions.VersionLocID, } - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/catalogs/{catalog_identifier}/objects/{object_identifier}/ibm-publish`, pathParamsMap) + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/versions/{version_loc_id}/validation/install`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range ibmPublishObjectOptions.Headers { + for headerName, headerValue := range getValidationStatusOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "IBMPublishObject") + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "GetValidationStatus") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") + if getValidationStatusOptions.XAuthRefreshToken != nil { + builder.AddHeader("X-Auth-Refresh-Token", fmt.Sprint(*getValidationStatusOptions.XAuthRefreshToken)) + } request, err := builder.Build() if err != nil { return } - response, err = catalogManagement.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = catalogManagement.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalValidation) + if err != nil { + return + } + response.Result = result + } return } -// PublicPublishObject : Publish object to share with all users -// Publish the specified object so it is visible to all users in the public catalog. -func (catalogManagement *CatalogManagementV1) PublicPublishObject(publicPublishObjectOptions *PublicPublishObjectOptions) (response *core.DetailedResponse, err error) { - return catalogManagement.PublicPublishObjectWithContext(context.Background(), publicPublishObjectOptions) +// GetOverrideValues : Get override values +// Returns the override values that were used to validate the specified offering version. +func (catalogManagement *CatalogManagementV1) GetOverrideValues(getOverrideValuesOptions *GetOverrideValuesOptions) (result map[string]interface{}, response *core.DetailedResponse, err error) { + return catalogManagement.GetOverrideValuesWithContext(context.Background(), getOverrideValuesOptions) } -// PublicPublishObjectWithContext is an alternate form of the PublicPublishObject method which supports a Context parameter -func (catalogManagement *CatalogManagementV1) PublicPublishObjectWithContext(ctx context.Context, publicPublishObjectOptions *PublicPublishObjectOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(publicPublishObjectOptions, "publicPublishObjectOptions cannot be nil") +// GetOverrideValuesWithContext is an alternate form of the GetOverrideValues method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) GetOverrideValuesWithContext(ctx context.Context, getOverrideValuesOptions *GetOverrideValuesOptions) (result map[string]interface{}, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getOverrideValuesOptions, "getOverrideValuesOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(publicPublishObjectOptions, "publicPublishObjectOptions") + err = core.ValidateStruct(getOverrideValuesOptions, "getOverrideValuesOptions") if err != nil { return } pathParamsMap := map[string]string{ - "catalog_identifier": *publicPublishObjectOptions.CatalogIdentifier, - "object_identifier": *publicPublishObjectOptions.ObjectIdentifier, + "version_loc_id": *getOverrideValuesOptions.VersionLocID, } - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/catalogs/{catalog_identifier}/objects/{object_identifier}/public-publish`, pathParamsMap) + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/versions/{version_loc_id}/validation/overridevalues`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range publicPublishObjectOptions.Headers { + for headerName, headerValue := range getOverrideValuesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "PublicPublishObject") + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "GetOverrideValues") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") request, err := builder.Build() if err != nil { return } - response, err = catalogManagement.Service.Request(request, nil) + response, err = catalogManagement.Service.Request(request, &result) return } -// CreateObjectAccess : Add account ID to object access list -// Add an account ID to an object's access list. -func (catalogManagement *CatalogManagementV1) CreateObjectAccess(createObjectAccessOptions *CreateObjectAccessOptions) (response *core.DetailedResponse, err error) { - return catalogManagement.CreateObjectAccessWithContext(context.Background(), createObjectAccessOptions) +// SearchObjects : List objects across catalogs +// List the available objects from both public and private catalogs. These copies cannot be used for updating. They are +// not complete and only return what is visible to the caller. +func (catalogManagement *CatalogManagementV1) SearchObjects(searchObjectsOptions *SearchObjectsOptions) (result *ObjectSearchResult, response *core.DetailedResponse, err error) { + return catalogManagement.SearchObjectsWithContext(context.Background(), searchObjectsOptions) } -// CreateObjectAccessWithContext is an alternate form of the CreateObjectAccess method which supports a Context parameter -func (catalogManagement *CatalogManagementV1) CreateObjectAccessWithContext(ctx context.Context, createObjectAccessOptions *CreateObjectAccessOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createObjectAccessOptions, "createObjectAccessOptions cannot be nil") +// SearchObjectsWithContext is an alternate form of the SearchObjects method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) SearchObjectsWithContext(ctx context.Context, searchObjectsOptions *SearchObjectsOptions) (result *ObjectSearchResult, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(searchObjectsOptions, "searchObjectsOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createObjectAccessOptions, "createObjectAccessOptions") + err = core.ValidateStruct(searchObjectsOptions, "searchObjectsOptions") if err != nil { return } - pathParamsMap := map[string]string{ - "catalog_identifier": *createObjectAccessOptions.CatalogIdentifier, - "object_identifier": *createObjectAccessOptions.ObjectIdentifier, - "account_identifier": *createObjectAccessOptions.AccountIdentifier, - } - - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/catalogs/{catalog_identifier}/objects/{object_identifier}/access/{account_identifier}`, pathParamsMap) + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/objects`, nil) if err != nil { return } - for headerName, headerValue := range createObjectAccessOptions.Headers { + for headerName, headerValue := range searchObjectsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "CreateObjectAccess") + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "SearchObjects") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("query", fmt.Sprint(*searchObjectsOptions.Query)) + if searchObjectsOptions.Kind != nil { + builder.AddQuery("kind", fmt.Sprint(*searchObjectsOptions.Kind)) + } + if searchObjectsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*searchObjectsOptions.Limit)) + } + if searchObjectsOptions.Offset != nil { + builder.AddQuery("offset", fmt.Sprint(*searchObjectsOptions.Offset)) + } + if searchObjectsOptions.Collapse != nil { + builder.AddQuery("collapse", fmt.Sprint(*searchObjectsOptions.Collapse)) + } + if searchObjectsOptions.Digest != nil { + builder.AddQuery("digest", fmt.Sprint(*searchObjectsOptions.Digest)) + } request, err := builder.Build() if err != nil { return } - response, err = catalogManagement.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = catalogManagement.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalObjectSearchResult) + if err != nil { + return + } + response.Result = result + } return } -// GetObjectAccess : Check for account ID in object access list -// Determine if an account ID is in an object's access list. -func (catalogManagement *CatalogManagementV1) GetObjectAccess(getObjectAccessOptions *GetObjectAccessOptions) (result *ObjectAccess, response *core.DetailedResponse, err error) { - return catalogManagement.GetObjectAccessWithContext(context.Background(), getObjectAccessOptions) +// ListObjects : List objects within a catalog +// List the available objects within the specified catalog. +func (catalogManagement *CatalogManagementV1) ListObjects(listObjectsOptions *ListObjectsOptions) (result *ObjectListResult, response *core.DetailedResponse, err error) { + return catalogManagement.ListObjectsWithContext(context.Background(), listObjectsOptions) } -// GetObjectAccessWithContext is an alternate form of the GetObjectAccess method which supports a Context parameter -func (catalogManagement *CatalogManagementV1) GetObjectAccessWithContext(ctx context.Context, getObjectAccessOptions *GetObjectAccessOptions) (result *ObjectAccess, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getObjectAccessOptions, "getObjectAccessOptions cannot be nil") +// ListObjectsWithContext is an alternate form of the ListObjects method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) ListObjectsWithContext(ctx context.Context, listObjectsOptions *ListObjectsOptions) (result *ObjectListResult, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listObjectsOptions, "listObjectsOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getObjectAccessOptions, "getObjectAccessOptions") + err = core.ValidateStruct(listObjectsOptions, "listObjectsOptions") if err != nil { return } pathParamsMap := map[string]string{ - "catalog_identifier": *getObjectAccessOptions.CatalogIdentifier, - "object_identifier": *getObjectAccessOptions.ObjectIdentifier, - "account_identifier": *getObjectAccessOptions.AccountIdentifier, + "catalog_identifier": *listObjectsOptions.CatalogIdentifier, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/catalogs/{catalog_identifier}/objects/{object_identifier}/access/{account_identifier}`, pathParamsMap) + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/catalogs/{catalog_identifier}/objects`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getObjectAccessOptions.Headers { + for headerName, headerValue := range listObjectsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "GetObjectAccess") + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "ListObjects") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - request, err := builder.Build() - if err != nil { - return + if listObjectsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listObjectsOptions.Limit)) + } + if listObjectsOptions.Offset != nil { + builder.AddQuery("offset", fmt.Sprint(*listObjectsOptions.Offset)) + } + if listObjectsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listObjectsOptions.Name)) + } + if listObjectsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listObjectsOptions.Sort)) + } + + request, err := builder.Build() + if err != nil { + return } var rawResponse map[string]json.RawMessage @@ -4635,7 +5018,7 @@ func (catalogManagement *CatalogManagementV1) GetObjectAccessWithContext(ctx con return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalObjectAccess) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalObjectListResult) if err != nil { return } @@ -4645,103 +5028,170 @@ func (catalogManagement *CatalogManagementV1) GetObjectAccessWithContext(ctx con return } -// DeleteObjectAccess : Remove account ID from object access list -// Delete the specified account ID from the specified object's access list. -func (catalogManagement *CatalogManagementV1) DeleteObjectAccess(deleteObjectAccessOptions *DeleteObjectAccessOptions) (response *core.DetailedResponse, err error) { - return catalogManagement.DeleteObjectAccessWithContext(context.Background(), deleteObjectAccessOptions) +// CreateObject : Create catalog object +// Create an object with a specific catalog. +func (catalogManagement *CatalogManagementV1) CreateObject(createObjectOptions *CreateObjectOptions) (result *CatalogObject, response *core.DetailedResponse, err error) { + return catalogManagement.CreateObjectWithContext(context.Background(), createObjectOptions) } -// DeleteObjectAccessWithContext is an alternate form of the DeleteObjectAccess method which supports a Context parameter -func (catalogManagement *CatalogManagementV1) DeleteObjectAccessWithContext(ctx context.Context, deleteObjectAccessOptions *DeleteObjectAccessOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteObjectAccessOptions, "deleteObjectAccessOptions cannot be nil") +// CreateObjectWithContext is an alternate form of the CreateObject method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) CreateObjectWithContext(ctx context.Context, createObjectOptions *CreateObjectOptions) (result *CatalogObject, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createObjectOptions, "createObjectOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteObjectAccessOptions, "deleteObjectAccessOptions") + err = core.ValidateStruct(createObjectOptions, "createObjectOptions") if err != nil { return } pathParamsMap := map[string]string{ - "catalog_identifier": *deleteObjectAccessOptions.CatalogIdentifier, - "object_identifier": *deleteObjectAccessOptions.ObjectIdentifier, - "account_identifier": *deleteObjectAccessOptions.AccountIdentifier, + "catalog_identifier": *createObjectOptions.CatalogIdentifier, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/catalogs/{catalog_identifier}/objects/{object_identifier}/access/{account_identifier}`, pathParamsMap) + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/catalogs/{catalog_identifier}/objects`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteObjectAccessOptions.Headers { + for headerName, headerValue := range createObjectOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "DeleteObjectAccess") + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "CreateObject") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + body := make(map[string]interface{}) + if createObjectOptions.ID != nil { + body["id"] = createObjectOptions.ID + } + if createObjectOptions.Name != nil { + body["name"] = createObjectOptions.Name + } + if createObjectOptions.Rev != nil { + body["_rev"] = createObjectOptions.Rev + } + if createObjectOptions.CRN != nil { + body["crn"] = createObjectOptions.CRN + } + if createObjectOptions.URL != nil { + body["url"] = createObjectOptions.URL + } + if createObjectOptions.ParentID != nil { + body["parent_id"] = createObjectOptions.ParentID + } + if createObjectOptions.LabelI18n != nil { + body["label_i18n"] = createObjectOptions.LabelI18n + } + if createObjectOptions.Label != nil { + body["label"] = createObjectOptions.Label + } + if createObjectOptions.Tags != nil { + body["tags"] = createObjectOptions.Tags + } + if createObjectOptions.Created != nil { + body["created"] = createObjectOptions.Created + } + if createObjectOptions.Updated != nil { + body["updated"] = createObjectOptions.Updated + } + if createObjectOptions.ShortDescription != nil { + body["short_description"] = createObjectOptions.ShortDescription + } + if createObjectOptions.ShortDescriptionI18n != nil { + body["short_description_i18n"] = createObjectOptions.ShortDescriptionI18n + } + if createObjectOptions.Kind != nil { + body["kind"] = createObjectOptions.Kind + } + if createObjectOptions.Publish != nil { + body["publish"] = createObjectOptions.Publish + } + if createObjectOptions.State != nil { + body["state"] = createObjectOptions.State + } + if createObjectOptions.CatalogID != nil { + body["catalog_id"] = createObjectOptions.CatalogID + } + if createObjectOptions.CatalogName != nil { + body["catalog_name"] = createObjectOptions.CatalogName + } + if createObjectOptions.Data != nil { + body["data"] = createObjectOptions.Data + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } request, err := builder.Build() if err != nil { return } - response, err = catalogManagement.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = catalogManagement.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalCatalogObject) + if err != nil { + return + } + response.Result = result + } return } -// GetObjectAccessList : Get object access list -// Get the access list associated with the specified object. -func (catalogManagement *CatalogManagementV1) GetObjectAccessList(getObjectAccessListOptions *GetObjectAccessListOptions) (result *ObjectAccessListResult, response *core.DetailedResponse, err error) { - return catalogManagement.GetObjectAccessListWithContext(context.Background(), getObjectAccessListOptions) +// GetObject : Get catalog object +// Get the specified object from within the specified catalog. +func (catalogManagement *CatalogManagementV1) GetObject(getObjectOptions *GetObjectOptions) (result *CatalogObject, response *core.DetailedResponse, err error) { + return catalogManagement.GetObjectWithContext(context.Background(), getObjectOptions) } -// GetObjectAccessListWithContext is an alternate form of the GetObjectAccessList method which supports a Context parameter -func (catalogManagement *CatalogManagementV1) GetObjectAccessListWithContext(ctx context.Context, getObjectAccessListOptions *GetObjectAccessListOptions) (result *ObjectAccessListResult, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getObjectAccessListOptions, "getObjectAccessListOptions cannot be nil") +// GetObjectWithContext is an alternate form of the GetObject method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) GetObjectWithContext(ctx context.Context, getObjectOptions *GetObjectOptions) (result *CatalogObject, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getObjectOptions, "getObjectOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getObjectAccessListOptions, "getObjectAccessListOptions") + err = core.ValidateStruct(getObjectOptions, "getObjectOptions") if err != nil { return } pathParamsMap := map[string]string{ - "catalog_identifier": *getObjectAccessListOptions.CatalogIdentifier, - "object_identifier": *getObjectAccessListOptions.ObjectIdentifier, + "catalog_identifier": *getObjectOptions.CatalogIdentifier, + "object_identifier": *getObjectOptions.ObjectIdentifier, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/catalogs/{catalog_identifier}/objects/{object_identifier}/access`, pathParamsMap) + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/catalogs/{catalog_identifier}/objects/{object_identifier}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getObjectAccessListOptions.Headers { + for headerName, headerValue := range getObjectOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "GetObjectAccessList") + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "GetObject") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if getObjectAccessListOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*getObjectAccessListOptions.Limit)) - } - if getObjectAccessListOptions.Offset != nil { - builder.AddQuery("offset", fmt.Sprint(*getObjectAccessListOptions.Offset)) - } - request, err := builder.Build() if err != nil { return @@ -4753,7 +5203,7 @@ func (catalogManagement *CatalogManagementV1) GetObjectAccessListWithContext(ctx return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalObjectAccessListResult) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalCatalogObject) if err != nil { return } @@ -4763,48 +5213,106 @@ func (catalogManagement *CatalogManagementV1) GetObjectAccessListWithContext(ctx return } -// DeleteObjectAccessList : Delete accounts from object access list -// Delete all or a set of accounts from an object's access list. -func (catalogManagement *CatalogManagementV1) DeleteObjectAccessList(deleteObjectAccessListOptions *DeleteObjectAccessListOptions) (result *AccessListBulkResponse, response *core.DetailedResponse, err error) { - return catalogManagement.DeleteObjectAccessListWithContext(context.Background(), deleteObjectAccessListOptions) +// ReplaceObject : Update catalog object +// Update an object within a specific catalog. +func (catalogManagement *CatalogManagementV1) ReplaceObject(replaceObjectOptions *ReplaceObjectOptions) (result *CatalogObject, response *core.DetailedResponse, err error) { + return catalogManagement.ReplaceObjectWithContext(context.Background(), replaceObjectOptions) } -// DeleteObjectAccessListWithContext is an alternate form of the DeleteObjectAccessList method which supports a Context parameter -func (catalogManagement *CatalogManagementV1) DeleteObjectAccessListWithContext(ctx context.Context, deleteObjectAccessListOptions *DeleteObjectAccessListOptions) (result *AccessListBulkResponse, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteObjectAccessListOptions, "deleteObjectAccessListOptions cannot be nil") +// ReplaceObjectWithContext is an alternate form of the ReplaceObject method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) ReplaceObjectWithContext(ctx context.Context, replaceObjectOptions *ReplaceObjectOptions) (result *CatalogObject, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(replaceObjectOptions, "replaceObjectOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteObjectAccessListOptions, "deleteObjectAccessListOptions") + err = core.ValidateStruct(replaceObjectOptions, "replaceObjectOptions") if err != nil { return } pathParamsMap := map[string]string{ - "catalog_identifier": *deleteObjectAccessListOptions.CatalogIdentifier, - "object_identifier": *deleteObjectAccessListOptions.ObjectIdentifier, + "catalog_identifier": *replaceObjectOptions.CatalogIdentifier, + "object_identifier": *replaceObjectOptions.ObjectIdentifier, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.PUT) builder = builder.WithContext(ctx) builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/catalogs/{catalog_identifier}/objects/{object_identifier}/access`, pathParamsMap) + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/catalogs/{catalog_identifier}/objects/{object_identifier}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteObjectAccessListOptions.Headers { + for headerName, headerValue := range replaceObjectOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "DeleteObjectAccessList") + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "ReplaceObject") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") builder.AddHeader("Content-Type", "application/json") - _, err = builder.SetBodyContentJSON(deleteObjectAccessListOptions.Accounts) + body := make(map[string]interface{}) + if replaceObjectOptions.ID != nil { + body["id"] = replaceObjectOptions.ID + } + if replaceObjectOptions.Name != nil { + body["name"] = replaceObjectOptions.Name + } + if replaceObjectOptions.Rev != nil { + body["_rev"] = replaceObjectOptions.Rev + } + if replaceObjectOptions.CRN != nil { + body["crn"] = replaceObjectOptions.CRN + } + if replaceObjectOptions.URL != nil { + body["url"] = replaceObjectOptions.URL + } + if replaceObjectOptions.ParentID != nil { + body["parent_id"] = replaceObjectOptions.ParentID + } + if replaceObjectOptions.LabelI18n != nil { + body["label_i18n"] = replaceObjectOptions.LabelI18n + } + if replaceObjectOptions.Label != nil { + body["label"] = replaceObjectOptions.Label + } + if replaceObjectOptions.Tags != nil { + body["tags"] = replaceObjectOptions.Tags + } + if replaceObjectOptions.Created != nil { + body["created"] = replaceObjectOptions.Created + } + if replaceObjectOptions.Updated != nil { + body["updated"] = replaceObjectOptions.Updated + } + if replaceObjectOptions.ShortDescription != nil { + body["short_description"] = replaceObjectOptions.ShortDescription + } + if replaceObjectOptions.ShortDescriptionI18n != nil { + body["short_description_i18n"] = replaceObjectOptions.ShortDescriptionI18n + } + if replaceObjectOptions.Kind != nil { + body["kind"] = replaceObjectOptions.Kind + } + if replaceObjectOptions.Publish != nil { + body["publish"] = replaceObjectOptions.Publish + } + if replaceObjectOptions.State != nil { + body["state"] = replaceObjectOptions.State + } + if replaceObjectOptions.CatalogID != nil { + body["catalog_id"] = replaceObjectOptions.CatalogID + } + if replaceObjectOptions.CatalogName != nil { + body["catalog_name"] = replaceObjectOptions.CatalogName + } + if replaceObjectOptions.Data != nil { + body["data"] = replaceObjectOptions.Data + } + _, err = builder.SetBodyContentJSON(body) if err != nil { return } @@ -4820,7 +5328,7 @@ func (catalogManagement *CatalogManagementV1) DeleteObjectAccessListWithContext( return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAccessListBulkResponse) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalCatalogObject) if err != nil { return } @@ -4830,173 +5338,103 @@ func (catalogManagement *CatalogManagementV1) DeleteObjectAccessListWithContext( return } -// AddObjectAccessList : Add accounts to object access list -// Add one or more accounts to the specified object's access list. -func (catalogManagement *CatalogManagementV1) AddObjectAccessList(addObjectAccessListOptions *AddObjectAccessListOptions) (result *AccessListBulkResponse, response *core.DetailedResponse, err error) { - return catalogManagement.AddObjectAccessListWithContext(context.Background(), addObjectAccessListOptions) +// DeleteObject : Delete catalog object +// Delete a specific object within a specific catalog. +func (catalogManagement *CatalogManagementV1) DeleteObject(deleteObjectOptions *DeleteObjectOptions) (response *core.DetailedResponse, err error) { + return catalogManagement.DeleteObjectWithContext(context.Background(), deleteObjectOptions) } -// AddObjectAccessListWithContext is an alternate form of the AddObjectAccessList method which supports a Context parameter -func (catalogManagement *CatalogManagementV1) AddObjectAccessListWithContext(ctx context.Context, addObjectAccessListOptions *AddObjectAccessListOptions) (result *AccessListBulkResponse, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(addObjectAccessListOptions, "addObjectAccessListOptions cannot be nil") +// DeleteObjectWithContext is an alternate form of the DeleteObject method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) DeleteObjectWithContext(ctx context.Context, deleteObjectOptions *DeleteObjectOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteObjectOptions, "deleteObjectOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(addObjectAccessListOptions, "addObjectAccessListOptions") + err = core.ValidateStruct(deleteObjectOptions, "deleteObjectOptions") if err != nil { return } pathParamsMap := map[string]string{ - "catalog_identifier": *addObjectAccessListOptions.CatalogIdentifier, - "object_identifier": *addObjectAccessListOptions.ObjectIdentifier, + "catalog_identifier": *deleteObjectOptions.CatalogIdentifier, + "object_identifier": *deleteObjectOptions.ObjectIdentifier, } - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/catalogs/{catalog_identifier}/objects/{object_identifier}/access`, pathParamsMap) + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/catalogs/{catalog_identifier}/objects/{object_identifier}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range addObjectAccessListOptions.Headers { + for headerName, headerValue := range deleteObjectOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "AddObjectAccessList") + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "DeleteObject") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - - _, err = builder.SetBodyContentJSON(addObjectAccessListOptions.Accounts) - if err != nil { - return - } request, err := builder.Build() if err != nil { return } - var rawResponse map[string]json.RawMessage - response, err = catalogManagement.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAccessListBulkResponse) - if err != nil { - return - } - response.Result = result - } + response, err = catalogManagement.Service.Request(request, nil) return } -// CreateOfferingInstance : Create an offering resource instance -// Provision a new offering in a given account, and return its resource instance. -func (catalogManagement *CatalogManagementV1) CreateOfferingInstance(createOfferingInstanceOptions *CreateOfferingInstanceOptions) (result *OfferingInstance, response *core.DetailedResponse, err error) { - return catalogManagement.CreateOfferingInstanceWithContext(context.Background(), createOfferingInstanceOptions) +// ListObjectAudits : Get object audit logs +// Get the audit logs associated with an object. +func (catalogManagement *CatalogManagementV1) ListObjectAudits(listObjectAuditsOptions *ListObjectAuditsOptions) (result *AuditLogs, response *core.DetailedResponse, err error) { + return catalogManagement.ListObjectAuditsWithContext(context.Background(), listObjectAuditsOptions) } -// CreateOfferingInstanceWithContext is an alternate form of the CreateOfferingInstance method which supports a Context parameter -func (catalogManagement *CatalogManagementV1) CreateOfferingInstanceWithContext(ctx context.Context, createOfferingInstanceOptions *CreateOfferingInstanceOptions) (result *OfferingInstance, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createOfferingInstanceOptions, "createOfferingInstanceOptions cannot be nil") +// ListObjectAuditsWithContext is an alternate form of the ListObjectAudits method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) ListObjectAuditsWithContext(ctx context.Context, listObjectAuditsOptions *ListObjectAuditsOptions) (result *AuditLogs, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listObjectAuditsOptions, "listObjectAuditsOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createOfferingInstanceOptions, "createOfferingInstanceOptions") + err = core.ValidateStruct(listObjectAuditsOptions, "listObjectAuditsOptions") if err != nil { return } - builder := core.NewRequestBuilder(core.POST) + pathParamsMap := map[string]string{ + "catalog_identifier": *listObjectAuditsOptions.CatalogIdentifier, + "object_identifier": *listObjectAuditsOptions.ObjectIdentifier, + } + + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/instances/offerings`, nil) + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/catalogs/{catalog_identifier}/objects/{object_identifier}/audits`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createOfferingInstanceOptions.Headers { + for headerName, headerValue := range listObjectAuditsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "CreateOfferingInstance") + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "ListObjectAudits") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - if createOfferingInstanceOptions.XAuthRefreshToken != nil { - builder.AddHeader("X-Auth-Refresh-Token", fmt.Sprint(*createOfferingInstanceOptions.XAuthRefreshToken)) - } - body := make(map[string]interface{}) - if createOfferingInstanceOptions.ID != nil { - body["id"] = createOfferingInstanceOptions.ID - } - if createOfferingInstanceOptions.Rev != nil { - body["_rev"] = createOfferingInstanceOptions.Rev - } - if createOfferingInstanceOptions.URL != nil { - body["url"] = createOfferingInstanceOptions.URL - } - if createOfferingInstanceOptions.CRN != nil { - body["crn"] = createOfferingInstanceOptions.CRN - } - if createOfferingInstanceOptions.Label != nil { - body["label"] = createOfferingInstanceOptions.Label - } - if createOfferingInstanceOptions.CatalogID != nil { - body["catalog_id"] = createOfferingInstanceOptions.CatalogID + if listObjectAuditsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listObjectAuditsOptions.Start)) } - if createOfferingInstanceOptions.OfferingID != nil { - body["offering_id"] = createOfferingInstanceOptions.OfferingID - } - if createOfferingInstanceOptions.KindFormat != nil { - body["kind_format"] = createOfferingInstanceOptions.KindFormat - } - if createOfferingInstanceOptions.Version != nil { - body["version"] = createOfferingInstanceOptions.Version - } - if createOfferingInstanceOptions.ClusterID != nil { - body["cluster_id"] = createOfferingInstanceOptions.ClusterID - } - if createOfferingInstanceOptions.ClusterRegion != nil { - body["cluster_region"] = createOfferingInstanceOptions.ClusterRegion - } - if createOfferingInstanceOptions.ClusterNamespaces != nil { - body["cluster_namespaces"] = createOfferingInstanceOptions.ClusterNamespaces - } - if createOfferingInstanceOptions.ClusterAllNamespaces != nil { - body["cluster_all_namespaces"] = createOfferingInstanceOptions.ClusterAllNamespaces - } - if createOfferingInstanceOptions.SchematicsWorkspaceID != nil { - body["schematics_workspace_id"] = createOfferingInstanceOptions.SchematicsWorkspaceID - } - if createOfferingInstanceOptions.ResourceGroupID != nil { - body["resource_group_id"] = createOfferingInstanceOptions.ResourceGroupID - } - if createOfferingInstanceOptions.InstallPlan != nil { - body["install_plan"] = createOfferingInstanceOptions.InstallPlan - } - if createOfferingInstanceOptions.Channel != nil { - body["channel"] = createOfferingInstanceOptions.Channel + if listObjectAuditsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listObjectAuditsOptions.Limit)) } - if createOfferingInstanceOptions.Metadata != nil { - body["metadata"] = createOfferingInstanceOptions.Metadata - } - if createOfferingInstanceOptions.LastOperation != nil { - body["last_operation"] = createOfferingInstanceOptions.LastOperation - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return + if listObjectAuditsOptions.Lookupnames != nil { + builder.AddQuery("lookupnames", fmt.Sprint(*listObjectAuditsOptions.Lookupnames)) } request, err := builder.Build() @@ -5010,7 +5448,7 @@ func (catalogManagement *CatalogManagementV1) CreateOfferingInstanceWithContext( return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalOfferingInstance) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAuditLogs) if err != nil { return } @@ -5020,45 +5458,51 @@ func (catalogManagement *CatalogManagementV1) CreateOfferingInstanceWithContext( return } -// GetOfferingInstance : Get Offering Instance -// Get the resource associated with an installed offering instance. -func (catalogManagement *CatalogManagementV1) GetOfferingInstance(getOfferingInstanceOptions *GetOfferingInstanceOptions) (result *OfferingInstance, response *core.DetailedResponse, err error) { - return catalogManagement.GetOfferingInstanceWithContext(context.Background(), getOfferingInstanceOptions) +// GetObjectAudit : Get an object audit log entry +// Get the full audit log entry associated with an object. +func (catalogManagement *CatalogManagementV1) GetObjectAudit(getObjectAuditOptions *GetObjectAuditOptions) (result *AuditLog, response *core.DetailedResponse, err error) { + return catalogManagement.GetObjectAuditWithContext(context.Background(), getObjectAuditOptions) } -// GetOfferingInstanceWithContext is an alternate form of the GetOfferingInstance method which supports a Context parameter -func (catalogManagement *CatalogManagementV1) GetOfferingInstanceWithContext(ctx context.Context, getOfferingInstanceOptions *GetOfferingInstanceOptions) (result *OfferingInstance, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getOfferingInstanceOptions, "getOfferingInstanceOptions cannot be nil") +// GetObjectAuditWithContext is an alternate form of the GetObjectAudit method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) GetObjectAuditWithContext(ctx context.Context, getObjectAuditOptions *GetObjectAuditOptions) (result *AuditLog, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getObjectAuditOptions, "getObjectAuditOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getOfferingInstanceOptions, "getOfferingInstanceOptions") + err = core.ValidateStruct(getObjectAuditOptions, "getObjectAuditOptions") if err != nil { return } pathParamsMap := map[string]string{ - "instance_identifier": *getOfferingInstanceOptions.InstanceIdentifier, + "catalog_identifier": *getObjectAuditOptions.CatalogIdentifier, + "object_identifier": *getObjectAuditOptions.ObjectIdentifier, + "auditlog_identifier": *getObjectAuditOptions.AuditlogIdentifier, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/instances/offerings/{instance_identifier}`, pathParamsMap) + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/catalogs/{catalog_identifier}/objects/{object_identifier}/audits/{auditlog_identifier}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getOfferingInstanceOptions.Headers { + for headerName, headerValue := range getObjectAuditOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "GetOfferingInstance") + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "GetObjectAudit") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") + if getObjectAuditOptions.Lookupnames != nil { + builder.AddQuery("lookupnames", fmt.Sprint(*getObjectAuditOptions.Lookupnames)) + } + request, err := builder.Build() if err != nil { return @@ -5070,7 +5514,7 @@ func (catalogManagement *CatalogManagementV1) GetOfferingInstanceWithContext(ctx return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalOfferingInstance) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAuditLog) if err != nil { return } @@ -5080,106 +5524,105 @@ func (catalogManagement *CatalogManagementV1) GetOfferingInstanceWithContext(ctx return } -// PutOfferingInstance : Update Offering Instance -// Update an installed offering instance. -func (catalogManagement *CatalogManagementV1) PutOfferingInstance(putOfferingInstanceOptions *PutOfferingInstanceOptions) (result *OfferingInstance, response *core.DetailedResponse, err error) { - return catalogManagement.PutOfferingInstanceWithContext(context.Background(), putOfferingInstanceOptions) +// ConsumableShareObject : Make object consumable for sharing +// Set the object as consumable in order to use the object sharing permissions. +func (catalogManagement *CatalogManagementV1) ConsumableShareObject(consumableShareObjectOptions *ConsumableShareObjectOptions) (response *core.DetailedResponse, err error) { + return catalogManagement.ConsumableShareObjectWithContext(context.Background(), consumableShareObjectOptions) } -// PutOfferingInstanceWithContext is an alternate form of the PutOfferingInstance method which supports a Context parameter -func (catalogManagement *CatalogManagementV1) PutOfferingInstanceWithContext(ctx context.Context, putOfferingInstanceOptions *PutOfferingInstanceOptions) (result *OfferingInstance, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(putOfferingInstanceOptions, "putOfferingInstanceOptions cannot be nil") +// ConsumableShareObjectWithContext is an alternate form of the ConsumableShareObject method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) ConsumableShareObjectWithContext(ctx context.Context, consumableShareObjectOptions *ConsumableShareObjectOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(consumableShareObjectOptions, "consumableShareObjectOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(putOfferingInstanceOptions, "putOfferingInstanceOptions") + err = core.ValidateStruct(consumableShareObjectOptions, "consumableShareObjectOptions") if err != nil { return } pathParamsMap := map[string]string{ - "instance_identifier": *putOfferingInstanceOptions.InstanceIdentifier, + "catalog_identifier": *consumableShareObjectOptions.CatalogIdentifier, + "object_identifier": *consumableShareObjectOptions.ObjectIdentifier, } - builder := core.NewRequestBuilder(core.PUT) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/instances/offerings/{instance_identifier}`, pathParamsMap) + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/catalogs/{catalog_identifier}/objects/{object_identifier}/consume-publish`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range putOfferingInstanceOptions.Headers { + for headerName, headerValue := range consumableShareObjectOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "PutOfferingInstance") + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "ConsumableShareObject") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - if putOfferingInstanceOptions.XAuthRefreshToken != nil { - builder.AddHeader("X-Auth-Refresh-Token", fmt.Sprint(*putOfferingInstanceOptions.XAuthRefreshToken)) - } - body := make(map[string]interface{}) - if putOfferingInstanceOptions.ID != nil { - body["id"] = putOfferingInstanceOptions.ID - } - if putOfferingInstanceOptions.Rev != nil { - body["_rev"] = putOfferingInstanceOptions.Rev - } - if putOfferingInstanceOptions.URL != nil { - body["url"] = putOfferingInstanceOptions.URL - } - if putOfferingInstanceOptions.CRN != nil { - body["crn"] = putOfferingInstanceOptions.CRN - } - if putOfferingInstanceOptions.Label != nil { - body["label"] = putOfferingInstanceOptions.Label - } - if putOfferingInstanceOptions.CatalogID != nil { - body["catalog_id"] = putOfferingInstanceOptions.CatalogID - } - if putOfferingInstanceOptions.OfferingID != nil { - body["offering_id"] = putOfferingInstanceOptions.OfferingID - } - if putOfferingInstanceOptions.KindFormat != nil { - body["kind_format"] = putOfferingInstanceOptions.KindFormat - } - if putOfferingInstanceOptions.Version != nil { - body["version"] = putOfferingInstanceOptions.Version - } - if putOfferingInstanceOptions.ClusterID != nil { - body["cluster_id"] = putOfferingInstanceOptions.ClusterID + request, err := builder.Build() + if err != nil { + return } - if putOfferingInstanceOptions.ClusterRegion != nil { - body["cluster_region"] = putOfferingInstanceOptions.ClusterRegion + + response, err = catalogManagement.Service.Request(request, nil) + + return +} + +// ShareObject : Allows object to be shared +// Set the share options on an object. +func (catalogManagement *CatalogManagementV1) ShareObject(shareObjectOptions *ShareObjectOptions) (result *ShareSetting, response *core.DetailedResponse, err error) { + return catalogManagement.ShareObjectWithContext(context.Background(), shareObjectOptions) +} + +// ShareObjectWithContext is an alternate form of the ShareObject method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) ShareObjectWithContext(ctx context.Context, shareObjectOptions *ShareObjectOptions) (result *ShareSetting, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(shareObjectOptions, "shareObjectOptions cannot be nil") + if err != nil { + return } - if putOfferingInstanceOptions.ClusterNamespaces != nil { - body["cluster_namespaces"] = putOfferingInstanceOptions.ClusterNamespaces + err = core.ValidateStruct(shareObjectOptions, "shareObjectOptions") + if err != nil { + return } - if putOfferingInstanceOptions.ClusterAllNamespaces != nil { - body["cluster_all_namespaces"] = putOfferingInstanceOptions.ClusterAllNamespaces + + pathParamsMap := map[string]string{ + "catalog_identifier": *shareObjectOptions.CatalogIdentifier, + "object_identifier": *shareObjectOptions.ObjectIdentifier, } - if putOfferingInstanceOptions.SchematicsWorkspaceID != nil { - body["schematics_workspace_id"] = putOfferingInstanceOptions.SchematicsWorkspaceID + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/catalogs/{catalog_identifier}/objects/{object_identifier}/share`, pathParamsMap) + if err != nil { + return } - if putOfferingInstanceOptions.ResourceGroupID != nil { - body["resource_group_id"] = putOfferingInstanceOptions.ResourceGroupID + + for headerName, headerValue := range shareObjectOptions.Headers { + builder.AddHeader(headerName, headerValue) } - if putOfferingInstanceOptions.InstallPlan != nil { - body["install_plan"] = putOfferingInstanceOptions.InstallPlan + + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "ShareObject") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) } - if putOfferingInstanceOptions.Channel != nil { - body["channel"] = putOfferingInstanceOptions.Channel + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + body := make(map[string]interface{}) + if shareObjectOptions.IBM != nil { + body["ibm"] = shareObjectOptions.IBM } - if putOfferingInstanceOptions.Metadata != nil { - body["metadata"] = putOfferingInstanceOptions.Metadata + if shareObjectOptions.Public != nil { + body["public"] = shareObjectOptions.Public } - if putOfferingInstanceOptions.LastOperation != nil { - body["last_operation"] = putOfferingInstanceOptions.LastOperation + if shareObjectOptions.Enabled != nil { + body["enabled"] = shareObjectOptions.Enabled } _, err = builder.SetBodyContentJSON(body) if err != nil { @@ -5197,7 +5640,7 @@ func (catalogManagement *CatalogManagementV1) PutOfferingInstanceWithContext(ctx return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalOfferingInstance) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalShareSetting) if err != nil { return } @@ -5207,45 +5650,51 @@ func (catalogManagement *CatalogManagementV1) PutOfferingInstanceWithContext(ctx return } -// DeleteOfferingInstance : Delete a version instance -// Delete and instance deployed out of a product version. -func (catalogManagement *CatalogManagementV1) DeleteOfferingInstance(deleteOfferingInstanceOptions *DeleteOfferingInstanceOptions) (response *core.DetailedResponse, err error) { - return catalogManagement.DeleteOfferingInstanceWithContext(context.Background(), deleteOfferingInstanceOptions) +// GetObjectAccessList : Get object access list +// Get the access list associated with the specified object. +func (catalogManagement *CatalogManagementV1) GetObjectAccessList(getObjectAccessListOptions *GetObjectAccessListOptions) (result *AccessListResult, response *core.DetailedResponse, err error) { + return catalogManagement.GetObjectAccessListWithContext(context.Background(), getObjectAccessListOptions) } -// DeleteOfferingInstanceWithContext is an alternate form of the DeleteOfferingInstance method which supports a Context parameter -func (catalogManagement *CatalogManagementV1) DeleteOfferingInstanceWithContext(ctx context.Context, deleteOfferingInstanceOptions *DeleteOfferingInstanceOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteOfferingInstanceOptions, "deleteOfferingInstanceOptions cannot be nil") +// GetObjectAccessListWithContext is an alternate form of the GetObjectAccessList method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) GetObjectAccessListWithContext(ctx context.Context, getObjectAccessListOptions *GetObjectAccessListOptions) (result *AccessListResult, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getObjectAccessListOptions, "getObjectAccessListOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteOfferingInstanceOptions, "deleteOfferingInstanceOptions") + err = core.ValidateStruct(getObjectAccessListOptions, "getObjectAccessListOptions") if err != nil { return } pathParamsMap := map[string]string{ - "instance_identifier": *deleteOfferingInstanceOptions.InstanceIdentifier, + "catalog_identifier": *getObjectAccessListOptions.CatalogIdentifier, + "object_identifier": *getObjectAccessListOptions.ObjectIdentifier, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/instances/offerings/{instance_identifier}`, pathParamsMap) + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/catalogs/{catalog_identifier}/objects/{object_identifier}/accessv1`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteOfferingInstanceOptions.Headers { + for headerName, headerValue := range getObjectAccessListOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "DeleteOfferingInstance") + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "GetObjectAccessList") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - if deleteOfferingInstanceOptions.XAuthRefreshToken != nil { - builder.AddHeader("X-Auth-Refresh-Token", fmt.Sprint(*deleteOfferingInstanceOptions.XAuthRefreshToken)) + builder.AddHeader("Accept", "application/json") + + if getObjectAccessListOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*getObjectAccessListOptions.Start)) + } + if getObjectAccessListOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*getObjectAccessListOptions.Limit)) } request, err := builder.Build() @@ -5253,2235 +5702,2886 @@ func (catalogManagement *CatalogManagementV1) DeleteOfferingInstanceWithContext( return } - response, err = catalogManagement.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = catalogManagement.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAccessListResult) + if err != nil { + return + } + response.Result = result + } return } -// AccessListBulkResponse : Access List Add/Remove result. -type AccessListBulkResponse struct { - // in the case of error on an account add/remove - account: error. - Errors map[string]string `json:"errors,omitempty"` +// GetObjectAccess : Check for account ID in object access list +// Determine if an account ID is in an object's access list. +func (catalogManagement *CatalogManagementV1) GetObjectAccess(getObjectAccessOptions *GetObjectAccessOptions) (result *Access, response *core.DetailedResponse, err error) { + return catalogManagement.GetObjectAccessWithContext(context.Background(), getObjectAccessOptions) } -// UnmarshalAccessListBulkResponse unmarshals an instance of AccessListBulkResponse from the specified map of raw messages. -func UnmarshalAccessListBulkResponse(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(AccessListBulkResponse) - err = core.UnmarshalPrimitive(m, "errors", &obj.Errors) +// GetObjectAccessWithContext is an alternate form of the GetObjectAccess method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) GetObjectAccessWithContext(ctx context.Context, getObjectAccessOptions *GetObjectAccessOptions) (result *Access, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getObjectAccessOptions, "getObjectAccessOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getObjectAccessOptions, "getObjectAccessOptions") if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Account : Account information. -type Account struct { - // Account identification. - ID *string `json:"id,omitempty"` - - // Hide the public catalog in this account. - HideIBMCloudCatalog *bool `json:"hide_IBM_cloud_catalog,omitempty"` - // Filters for account and catalog filters. - AccountFilters *Filters `json:"account_filters,omitempty"` -} + pathParamsMap := map[string]string{ + "catalog_identifier": *getObjectAccessOptions.CatalogIdentifier, + "object_identifier": *getObjectAccessOptions.ObjectIdentifier, + "access_identifier": *getObjectAccessOptions.AccessIdentifier, + } -// UnmarshalAccount unmarshals an instance of Account from the specified map of raw messages. -func UnmarshalAccount(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(Account) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/catalogs/{catalog_identifier}/objects/{object_identifier}/access/{access_identifier}`, pathParamsMap) if err != nil { return } - err = core.UnmarshalPrimitive(m, "hide_IBM_cloud_catalog", &obj.HideIBMCloudCatalog) + + for headerName, headerValue := range getObjectAccessOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "GetObjectAccess") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + request, err := builder.Build() if err != nil { return } - err = core.UnmarshalModel(m, "account_filters", &obj.AccountFilters, UnmarshalFilters) + + var rawResponse map[string]json.RawMessage + response, err = catalogManagement.Service.Request(request, &rawResponse) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAccess) + if err != nil { + return + } + response.Result = result + } + return } -// AccountPublishObjectOptions : The AccountPublishObject options. -type AccountPublishObjectOptions struct { - // Catalog identifier. - CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` - - // Object identifier. - ObjectIdentifier *string `json:"object_identifier" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string +// CreateObjectAccess : Add account ID to object access list +// Add an account ID to an object's access list. +func (catalogManagement *CatalogManagementV1) CreateObjectAccess(createObjectAccessOptions *CreateObjectAccessOptions) (response *core.DetailedResponse, err error) { + return catalogManagement.CreateObjectAccessWithContext(context.Background(), createObjectAccessOptions) } -// NewAccountPublishObjectOptions : Instantiate AccountPublishObjectOptions -func (*CatalogManagementV1) NewAccountPublishObjectOptions(catalogIdentifier string, objectIdentifier string) *AccountPublishObjectOptions { - return &AccountPublishObjectOptions{ - CatalogIdentifier: core.StringPtr(catalogIdentifier), - ObjectIdentifier: core.StringPtr(objectIdentifier), +// CreateObjectAccessWithContext is an alternate form of the CreateObjectAccess method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) CreateObjectAccessWithContext(ctx context.Context, createObjectAccessOptions *CreateObjectAccessOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createObjectAccessOptions, "createObjectAccessOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createObjectAccessOptions, "createObjectAccessOptions") + if err != nil { + return } -} - -// SetCatalogIdentifier : Allow user to set CatalogIdentifier -func (_options *AccountPublishObjectOptions) SetCatalogIdentifier(catalogIdentifier string) *AccountPublishObjectOptions { - _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) - return _options -} -// SetObjectIdentifier : Allow user to set ObjectIdentifier -func (_options *AccountPublishObjectOptions) SetObjectIdentifier(objectIdentifier string) *AccountPublishObjectOptions { - _options.ObjectIdentifier = core.StringPtr(objectIdentifier) - return _options -} + pathParamsMap := map[string]string{ + "catalog_identifier": *createObjectAccessOptions.CatalogIdentifier, + "object_identifier": *createObjectAccessOptions.ObjectIdentifier, + "access_identifier": *createObjectAccessOptions.AccessIdentifier, + } -// SetHeaders : Allow user to set Headers -func (options *AccountPublishObjectOptions) SetHeaders(param map[string]string) *AccountPublishObjectOptions { - options.Headers = param - return options -} + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/catalogs/{catalog_identifier}/objects/{object_identifier}/access/{access_identifier}`, pathParamsMap) + if err != nil { + return + } -// AccountPublishVersionOptions : The AccountPublishVersion options. -type AccountPublishVersionOptions struct { - // A dotted value of `catalogID`.`versionID`. - VersionLocID *string `json:"version_loc_id" validate:"required,ne="` + for headerName, headerValue := range createObjectAccessOptions.Headers { + builder.AddHeader(headerName, headerValue) + } - // Allows users to set headers on API requests - Headers map[string]string -} + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "CreateObjectAccess") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } -// NewAccountPublishVersionOptions : Instantiate AccountPublishVersionOptions -func (*CatalogManagementV1) NewAccountPublishVersionOptions(versionLocID string) *AccountPublishVersionOptions { - return &AccountPublishVersionOptions{ - VersionLocID: core.StringPtr(versionLocID), + request, err := builder.Build() + if err != nil { + return } -} -// SetVersionLocID : Allow user to set VersionLocID -func (_options *AccountPublishVersionOptions) SetVersionLocID(versionLocID string) *AccountPublishVersionOptions { - _options.VersionLocID = core.StringPtr(versionLocID) - return _options -} + response, err = catalogManagement.Service.Request(request, nil) -// SetHeaders : Allow user to set Headers -func (options *AccountPublishVersionOptions) SetHeaders(param map[string]string) *AccountPublishVersionOptions { - options.Headers = param - return options + return } -// AccumulatedFilters : The accumulated filters for an account. This will return the account filters plus a filter for each catalog the user -// has access to. -type AccumulatedFilters struct { - // Filters for accounts (at this time this will always be just one item array). - AccountFilters []Filters `json:"account_filters,omitempty"` - - // The filters for all of the accessible catalogs. - CatalogFilters []AccumulatedFiltersCatalogFiltersItem `json:"catalog_filters,omitempty"` +// DeleteObjectAccess : Remove account ID from object access list +// Delete the specified account ID from the specified object's access list. +func (catalogManagement *CatalogManagementV1) DeleteObjectAccess(deleteObjectAccessOptions *DeleteObjectAccessOptions) (response *core.DetailedResponse, err error) { + return catalogManagement.DeleteObjectAccessWithContext(context.Background(), deleteObjectAccessOptions) } -// UnmarshalAccumulatedFilters unmarshals an instance of AccumulatedFilters from the specified map of raw messages. -func UnmarshalAccumulatedFilters(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(AccumulatedFilters) - err = core.UnmarshalModel(m, "account_filters", &obj.AccountFilters, UnmarshalFilters) +// DeleteObjectAccessWithContext is an alternate form of the DeleteObjectAccess method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) DeleteObjectAccessWithContext(ctx context.Context, deleteObjectAccessOptions *DeleteObjectAccessOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteObjectAccessOptions, "deleteObjectAccessOptions cannot be nil") if err != nil { return } - err = core.UnmarshalModel(m, "catalog_filters", &obj.CatalogFilters, UnmarshalAccumulatedFiltersCatalogFiltersItem) + err = core.ValidateStruct(deleteObjectAccessOptions, "deleteObjectAccessOptions") if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AccumulatedFiltersCatalogFiltersItem : AccumulatedFiltersCatalogFiltersItem struct -type AccumulatedFiltersCatalogFiltersItem struct { - // Filters for catalog. - Catalog *AccumulatedFiltersCatalogFiltersItemCatalog `json:"catalog,omitempty"` - // Filters for account and catalog filters. - Filters *Filters `json:"filters,omitempty"` -} + pathParamsMap := map[string]string{ + "catalog_identifier": *deleteObjectAccessOptions.CatalogIdentifier, + "object_identifier": *deleteObjectAccessOptions.ObjectIdentifier, + "access_identifier": *deleteObjectAccessOptions.AccessIdentifier, + } -// UnmarshalAccumulatedFiltersCatalogFiltersItem unmarshals an instance of AccumulatedFiltersCatalogFiltersItem from the specified map of raw messages. -func UnmarshalAccumulatedFiltersCatalogFiltersItem(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(AccumulatedFiltersCatalogFiltersItem) - err = core.UnmarshalModel(m, "catalog", &obj.Catalog, UnmarshalAccumulatedFiltersCatalogFiltersItemCatalog) + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/catalogs/{catalog_identifier}/objects/{object_identifier}/access/{access_identifier}`, pathParamsMap) if err != nil { return } - err = core.UnmarshalModel(m, "filters", &obj.Filters, UnmarshalFilters) + + for headerName, headerValue := range deleteObjectAccessOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "DeleteObjectAccess") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + request, err := builder.Build() if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + + response, err = catalogManagement.Service.Request(request, nil) + return } -// AccumulatedFiltersCatalogFiltersItemCatalog : Filters for catalog. -type AccumulatedFiltersCatalogFiltersItemCatalog struct { - // The ID of the catalog. - ID *string `json:"id,omitempty"` - - // The name of the catalog. - Name *string `json:"name,omitempty"` +// GetObjectAccessListDeprecated : Get object access list +// Deprecated - use /accessv1 instead. +func (catalogManagement *CatalogManagementV1) GetObjectAccessListDeprecated(getObjectAccessListDeprecatedOptions *GetObjectAccessListDeprecatedOptions) (result *ObjectAccessListResult, response *core.DetailedResponse, err error) { + return catalogManagement.GetObjectAccessListDeprecatedWithContext(context.Background(), getObjectAccessListDeprecatedOptions) } -// UnmarshalAccumulatedFiltersCatalogFiltersItemCatalog unmarshals an instance of AccumulatedFiltersCatalogFiltersItemCatalog from the specified map of raw messages. -func UnmarshalAccumulatedFiltersCatalogFiltersItemCatalog(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(AccumulatedFiltersCatalogFiltersItemCatalog) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) +// GetObjectAccessListDeprecatedWithContext is an alternate form of the GetObjectAccessListDeprecated method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) GetObjectAccessListDeprecatedWithContext(ctx context.Context, getObjectAccessListDeprecatedOptions *GetObjectAccessListDeprecatedOptions) (result *ObjectAccessListResult, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getObjectAccessListDeprecatedOptions, "getObjectAccessListDeprecatedOptions cannot be nil") if err != nil { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.ValidateStruct(getObjectAccessListDeprecatedOptions, "getObjectAccessListDeprecatedOptions") if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} -// AddObjectAccessListOptions : The AddObjectAccessList options. -type AddObjectAccessListOptions struct { - // Catalog identifier. - CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` + pathParamsMap := map[string]string{ + "catalog_identifier": *getObjectAccessListDeprecatedOptions.CatalogIdentifier, + "object_identifier": *getObjectAccessListDeprecatedOptions.ObjectIdentifier, + } - // Object identifier. - ObjectIdentifier *string `json:"object_identifier" validate:"required,ne="` + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/catalogs/{catalog_identifier}/objects/{object_identifier}/access`, pathParamsMap) + if err != nil { + return + } - // A list of accounts to add. - Accounts []string `json:"accounts" validate:"required"` + for headerName, headerValue := range getObjectAccessListDeprecatedOptions.Headers { + builder.AddHeader(headerName, headerValue) + } - // Allows users to set headers on API requests - Headers map[string]string -} + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "GetObjectAccessListDeprecated") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") -// NewAddObjectAccessListOptions : Instantiate AddObjectAccessListOptions -func (*CatalogManagementV1) NewAddObjectAccessListOptions(catalogIdentifier string, objectIdentifier string, accounts []string) *AddObjectAccessListOptions { - return &AddObjectAccessListOptions{ - CatalogIdentifier: core.StringPtr(catalogIdentifier), - ObjectIdentifier: core.StringPtr(objectIdentifier), - Accounts: accounts, + if getObjectAccessListDeprecatedOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*getObjectAccessListDeprecatedOptions.Limit)) + } + if getObjectAccessListDeprecatedOptions.Offset != nil { + builder.AddQuery("offset", fmt.Sprint(*getObjectAccessListDeprecatedOptions.Offset)) } -} -// SetCatalogIdentifier : Allow user to set CatalogIdentifier -func (_options *AddObjectAccessListOptions) SetCatalogIdentifier(catalogIdentifier string) *AddObjectAccessListOptions { - _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) - return _options -} + request, err := builder.Build() + if err != nil { + return + } -// SetObjectIdentifier : Allow user to set ObjectIdentifier -func (_options *AddObjectAccessListOptions) SetObjectIdentifier(objectIdentifier string) *AddObjectAccessListOptions { - _options.ObjectIdentifier = core.StringPtr(objectIdentifier) - return _options -} + var rawResponse map[string]json.RawMessage + response, err = catalogManagement.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalObjectAccessListResult) + if err != nil { + return + } + response.Result = result + } -// SetAccounts : Allow user to set Accounts -func (_options *AddObjectAccessListOptions) SetAccounts(accounts []string) *AddObjectAccessListOptions { - _options.Accounts = accounts - return _options + return } -// SetHeaders : Allow user to set Headers -func (options *AddObjectAccessListOptions) SetHeaders(param map[string]string) *AddObjectAccessListOptions { - options.Headers = param - return options +// DeleteObjectAccessList : Delete accesses from object access list +// Delete all or a set of accesses from an object's access list. +func (catalogManagement *CatalogManagementV1) DeleteObjectAccessList(deleteObjectAccessListOptions *DeleteObjectAccessListOptions) (result *AccessListBulkResponse, response *core.DetailedResponse, err error) { + return catalogManagement.DeleteObjectAccessListWithContext(context.Background(), deleteObjectAccessListOptions) } -// ApprovalResult : Result of approval. -type ApprovalResult struct { - // Allowed to request to publish. - AllowRequest *bool `json:"allow_request,omitempty"` - - // Visible to IBM. - IBM *bool `json:"ibm,omitempty"` - - // Visible to everyone. - Public *bool `json:"public,omitempty"` +// DeleteObjectAccessListWithContext is an alternate form of the DeleteObjectAccessList method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) DeleteObjectAccessListWithContext(ctx context.Context, deleteObjectAccessListOptions *DeleteObjectAccessListOptions) (result *AccessListBulkResponse, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteObjectAccessListOptions, "deleteObjectAccessListOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteObjectAccessListOptions, "deleteObjectAccessListOptions") + if err != nil { + return + } - // Denotes whether approval has changed. - Changed *bool `json:"changed,omitempty"` -} + pathParamsMap := map[string]string{ + "catalog_identifier": *deleteObjectAccessListOptions.CatalogIdentifier, + "object_identifier": *deleteObjectAccessListOptions.ObjectIdentifier, + } -// UnmarshalApprovalResult unmarshals an instance of ApprovalResult from the specified map of raw messages. -func UnmarshalApprovalResult(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ApprovalResult) - err = core.UnmarshalPrimitive(m, "allow_request", &obj.AllowRequest) + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/catalogs/{catalog_identifier}/objects/{object_identifier}/access`, pathParamsMap) if err != nil { return } - err = core.UnmarshalPrimitive(m, "ibm", &obj.IBM) + + for headerName, headerValue := range deleteObjectAccessListOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "DeleteObjectAccessList") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + _, err = builder.SetBodyContentJSON(deleteObjectAccessListOptions.Accesses) if err != nil { return } - err = core.UnmarshalPrimitive(m, "public", &obj.Public) + + request, err := builder.Build() if err != nil { return } - err = core.UnmarshalPrimitive(m, "changed", &obj.Changed) + + var rawResponse map[string]json.RawMessage + response, err = catalogManagement.Service.Request(request, &rawResponse) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAccessListBulkResponse) + if err != nil { + return + } + response.Result = result + } + return } -// AuditLog : A collection of audit records. -type AuditLog struct { - // A list of audit records. - List []AuditRecord `json:"list,omitempty"` +// AddObjectAccessList : Add accesses to object access list +// Add one or more accesses to the specified object's access list. +func (catalogManagement *CatalogManagementV1) AddObjectAccessList(addObjectAccessListOptions *AddObjectAccessListOptions) (result *AccessListBulkResponse, response *core.DetailedResponse, err error) { + return catalogManagement.AddObjectAccessListWithContext(context.Background(), addObjectAccessListOptions) } -// UnmarshalAuditLog unmarshals an instance of AuditLog from the specified map of raw messages. -func UnmarshalAuditLog(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(AuditLog) - err = core.UnmarshalModel(m, "list", &obj.List, UnmarshalAuditRecord) +// AddObjectAccessListWithContext is an alternate form of the AddObjectAccessList method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) AddObjectAccessListWithContext(ctx context.Context, addObjectAccessListOptions *AddObjectAccessListOptions) (result *AccessListBulkResponse, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(addObjectAccessListOptions, "addObjectAccessListOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(addObjectAccessListOptions, "addObjectAccessListOptions") if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AuditRecord : An audit record which describes a change made to a catalog or associated resource. -type AuditRecord struct { - // The identifier of the audit record. - ID *string `json:"id,omitempty"` - - // The time at which the change was made. - Created *strfmt.DateTime `json:"created,omitempty"` - - // The type of change described by the audit record. - ChangeType *string `json:"change_type,omitempty"` - // The resource type associated with the change. - TargetType *string `json:"target_type,omitempty"` + pathParamsMap := map[string]string{ + "catalog_identifier": *addObjectAccessListOptions.CatalogIdentifier, + "object_identifier": *addObjectAccessListOptions.ObjectIdentifier, + } - // The identifier of the resource that was changed. - TargetID *string `json:"target_id,omitempty"` + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/catalogs/{catalog_identifier}/objects/{object_identifier}/access`, pathParamsMap) + if err != nil { + return + } - // The email address of the user that made the change. - WhoDelegateEmail *string `json:"who_delegate_email,omitempty"` + for headerName, headerValue := range addObjectAccessListOptions.Headers { + builder.AddHeader(headerName, headerValue) + } - // A message which describes the change. - Message *string `json:"message,omitempty"` -} + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "AddObjectAccessList") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") -// UnmarshalAuditRecord unmarshals an instance of AuditRecord from the specified map of raw messages. -func UnmarshalAuditRecord(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(AuditRecord) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) + _, err = builder.SetBodyContentJSON(addObjectAccessListOptions.Accesses) if err != nil { return } - err = core.UnmarshalPrimitive(m, "created", &obj.Created) + + request, err := builder.Build() if err != nil { return } - err = core.UnmarshalPrimitive(m, "change_type", &obj.ChangeType) + + var rawResponse map[string]json.RawMessage + response, err = catalogManagement.Service.Request(request, &rawResponse) if err != nil { return } - err = core.UnmarshalPrimitive(m, "target_type", &obj.TargetType) + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAccessListBulkResponse) + if err != nil { + return + } + response.Result = result + } + + return +} + +// AccountPublishObject : Publish object to account +// Publish a catalog object to account. +func (catalogManagement *CatalogManagementV1) AccountPublishObject(accountPublishObjectOptions *AccountPublishObjectOptions) (response *core.DetailedResponse, err error) { + return catalogManagement.AccountPublishObjectWithContext(context.Background(), accountPublishObjectOptions) +} + +// AccountPublishObjectWithContext is an alternate form of the AccountPublishObject method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) AccountPublishObjectWithContext(ctx context.Context, accountPublishObjectOptions *AccountPublishObjectOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(accountPublishObjectOptions, "accountPublishObjectOptions cannot be nil") if err != nil { return } - err = core.UnmarshalPrimitive(m, "target_id", &obj.TargetID) + err = core.ValidateStruct(accountPublishObjectOptions, "accountPublishObjectOptions") if err != nil { return } - err = core.UnmarshalPrimitive(m, "who_delegate_email", &obj.WhoDelegateEmail) + + pathParamsMap := map[string]string{ + "catalog_identifier": *accountPublishObjectOptions.CatalogIdentifier, + "object_identifier": *accountPublishObjectOptions.ObjectIdentifier, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/catalogs/{catalog_identifier}/objects/{object_identifier}/account-publish`, pathParamsMap) if err != nil { return } - err = core.UnmarshalPrimitive(m, "message", &obj.Message) + + for headerName, headerValue := range accountPublishObjectOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "AccountPublishObject") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + request, err := builder.Build() if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + + response, err = catalogManagement.Service.Request(request, nil) + return } -// Catalog : Catalog information. -type Catalog struct { - // Unique ID. - ID *string `json:"id,omitempty"` +// SharedPublishObject : Publish object to share with allow list +// Publish the specified object so that it is visible to those in the allow list. +func (catalogManagement *CatalogManagementV1) SharedPublishObject(sharedPublishObjectOptions *SharedPublishObjectOptions) (response *core.DetailedResponse, err error) { + return catalogManagement.SharedPublishObjectWithContext(context.Background(), sharedPublishObjectOptions) +} - // Cloudant revision. - Rev *string `json:"_rev,omitempty"` +// SharedPublishObjectWithContext is an alternate form of the SharedPublishObject method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) SharedPublishObjectWithContext(ctx context.Context, sharedPublishObjectOptions *SharedPublishObjectOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(sharedPublishObjectOptions, "sharedPublishObjectOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(sharedPublishObjectOptions, "sharedPublishObjectOptions") + if err != nil { + return + } - // Display Name in the requested language. - Label *string `json:"label,omitempty"` + pathParamsMap := map[string]string{ + "catalog_identifier": *sharedPublishObjectOptions.CatalogIdentifier, + "object_identifier": *sharedPublishObjectOptions.ObjectIdentifier, + } - // Description in the requested language. - ShortDescription *string `json:"short_description,omitempty"` - - // URL for an icon associated with this catalog. - CatalogIconURL *string `json:"catalog_icon_url,omitempty"` - - // List of tags associated with this catalog. - Tags []string `json:"tags,omitempty"` - - // The url for this specific catalog. - URL *string `json:"url,omitempty"` - - // CRN associated with the catalog. - CRN *string `json:"crn,omitempty"` - - // URL path to offerings. - OfferingsURL *string `json:"offerings_url,omitempty"` - - // List of features associated with this catalog. - Features []Feature `json:"features,omitempty"` - - // Denotes whether a catalog is disabled. - Disabled *bool `json:"disabled,omitempty"` - - // The date-time this catalog was created. - Created *strfmt.DateTime `json:"created,omitempty"` - - // The date-time this catalog was last updated. - Updated *strfmt.DateTime `json:"updated,omitempty"` - - // Resource group id the catalog is owned by. - ResourceGroupID *string `json:"resource_group_id,omitempty"` - - // Account that owns catalog. - OwningAccount *string `json:"owning_account,omitempty"` - - // Filters for account and catalog filters. - CatalogFilters *Filters `json:"catalog_filters,omitempty"` - - // Feature information. - SyndicationSettings *SyndicationResource `json:"syndication_settings,omitempty"` - - // Kind of catalog. Supported kinds are offering and vpe. - Kind *string `json:"kind,omitempty"` -} - -// UnmarshalCatalog unmarshals an instance of Catalog from the specified map of raw messages. -func UnmarshalCatalog(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(Catalog) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/catalogs/{catalog_identifier}/objects/{object_identifier}/shared-publish`, pathParamsMap) if err != nil { return } - err = core.UnmarshalPrimitive(m, "_rev", &obj.Rev) - if err != nil { - return + + for headerName, headerValue := range sharedPublishObjectOptions.Headers { + builder.AddHeader(headerName, headerValue) } - err = core.UnmarshalPrimitive(m, "label", &obj.Label) - if err != nil { - return + + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "SharedPublishObject") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) } - err = core.UnmarshalPrimitive(m, "short_description", &obj.ShortDescription) + + request, err := builder.Build() if err != nil { return } - err = core.UnmarshalPrimitive(m, "catalog_icon_url", &obj.CatalogIconURL) + + response, err = catalogManagement.Service.Request(request, nil) + + return +} + +// IBMPublishObject : Publish object to share with IBMers +// Publish the specified object so that it is visible to IBMers in the public catalog. +func (catalogManagement *CatalogManagementV1) IBMPublishObject(ibmPublishObjectOptions *IBMPublishObjectOptions) (response *core.DetailedResponse, err error) { + return catalogManagement.IBMPublishObjectWithContext(context.Background(), ibmPublishObjectOptions) +} + +// IBMPublishObjectWithContext is an alternate form of the IBMPublishObject method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) IBMPublishObjectWithContext(ctx context.Context, ibmPublishObjectOptions *IBMPublishObjectOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(ibmPublishObjectOptions, "ibmPublishObjectOptions cannot be nil") if err != nil { return } - err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) + err = core.ValidateStruct(ibmPublishObjectOptions, "ibmPublishObjectOptions") if err != nil { return } - err = core.UnmarshalPrimitive(m, "url", &obj.URL) - if err != nil { - return + + pathParamsMap := map[string]string{ + "catalog_identifier": *ibmPublishObjectOptions.CatalogIdentifier, + "object_identifier": *ibmPublishObjectOptions.ObjectIdentifier, } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/catalogs/{catalog_identifier}/objects/{object_identifier}/ibm-publish`, pathParamsMap) if err != nil { return } - err = core.UnmarshalPrimitive(m, "offerings_url", &obj.OfferingsURL) - if err != nil { - return + + for headerName, headerValue := range ibmPublishObjectOptions.Headers { + builder.AddHeader(headerName, headerValue) } - err = core.UnmarshalModel(m, "features", &obj.Features, UnmarshalFeature) - if err != nil { - return + + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "IBMPublishObject") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) } - err = core.UnmarshalPrimitive(m, "disabled", &obj.Disabled) + + request, err := builder.Build() if err != nil { return } - err = core.UnmarshalPrimitive(m, "created", &obj.Created) + + response, err = catalogManagement.Service.Request(request, nil) + + return +} + +// PublicPublishObject : Publish object to share with all users +// Publish the specified object so it is visible to all users in the public catalog. +func (catalogManagement *CatalogManagementV1) PublicPublishObject(publicPublishObjectOptions *PublicPublishObjectOptions) (response *core.DetailedResponse, err error) { + return catalogManagement.PublicPublishObjectWithContext(context.Background(), publicPublishObjectOptions) +} + +// PublicPublishObjectWithContext is an alternate form of the PublicPublishObject method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) PublicPublishObjectWithContext(ctx context.Context, publicPublishObjectOptions *PublicPublishObjectOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(publicPublishObjectOptions, "publicPublishObjectOptions cannot be nil") if err != nil { return } - err = core.UnmarshalPrimitive(m, "updated", &obj.Updated) + err = core.ValidateStruct(publicPublishObjectOptions, "publicPublishObjectOptions") if err != nil { return } - err = core.UnmarshalPrimitive(m, "resource_group_id", &obj.ResourceGroupID) - if err != nil { - return + + pathParamsMap := map[string]string{ + "catalog_identifier": *publicPublishObjectOptions.CatalogIdentifier, + "object_identifier": *publicPublishObjectOptions.ObjectIdentifier, } - err = core.UnmarshalPrimitive(m, "owning_account", &obj.OwningAccount) + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/catalogs/{catalog_identifier}/objects/{object_identifier}/public-publish`, pathParamsMap) if err != nil { return } - err = core.UnmarshalModel(m, "catalog_filters", &obj.CatalogFilters, UnmarshalFilters) - if err != nil { - return + + for headerName, headerValue := range publicPublishObjectOptions.Headers { + builder.AddHeader(headerName, headerValue) } - err = core.UnmarshalModel(m, "syndication_settings", &obj.SyndicationSettings, UnmarshalSyndicationResource) - if err != nil { - return + + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "PublicPublishObject") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) } - err = core.UnmarshalPrimitive(m, "kind", &obj.Kind) + + request, err := builder.Build() if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// CatalogObject : object information. -type CatalogObject struct { - // unique id. - ID *string `json:"id,omitempty"` - - // The programmatic name of this offering. - Name *string `json:"name,omitempty"` - - // Cloudant revision. - Rev *string `json:"_rev,omitempty"` - - // The crn for this specific object. - CRN *string `json:"crn,omitempty"` - - // The url for this specific object. - URL *string `json:"url,omitempty"` - - // The parent for this specific object. - ParentID *string `json:"parent_id,omitempty"` - - // Translated display name in the requested language. - LabelI18n *string `json:"label_i18n,omitempty"` - - // Display name in the requested language. - Label *string `json:"label,omitempty"` - - // List of tags associated with this catalog. - Tags []string `json:"tags,omitempty"` - - // The date and time this catalog was created. - Created *strfmt.DateTime `json:"created,omitempty"` - - // The date and time this catalog was last updated. - Updated *strfmt.DateTime `json:"updated,omitempty"` - - // Short description in the requested language. - ShortDescription *string `json:"short_description,omitempty"` - - // Short description translation. - ShortDescriptionI18n *string `json:"short_description_i18n,omitempty"` - - // Kind of object. - Kind *string `json:"kind,omitempty"` - - // Publish information. - Publish *PublishObject `json:"publish,omitempty"` - - // Offering state. - State *State `json:"state,omitempty"` - // The id of the catalog containing this offering. - CatalogID *string `json:"catalog_id,omitempty"` + response, err = catalogManagement.Service.Request(request, nil) - // The name of the catalog. - CatalogName *string `json:"catalog_name,omitempty"` + return +} - // Map of data values for this object. - Data map[string]interface{} `json:"data,omitempty"` +// CreateOfferingInstance : Create an offering resource instance +// Provision a new offering in a given account, and return its resource instance. +func (catalogManagement *CatalogManagementV1) CreateOfferingInstance(createOfferingInstanceOptions *CreateOfferingInstanceOptions) (result *OfferingInstance, response *core.DetailedResponse, err error) { + return catalogManagement.CreateOfferingInstanceWithContext(context.Background(), createOfferingInstanceOptions) } -// UnmarshalCatalogObject unmarshals an instance of CatalogObject from the specified map of raw messages. -func UnmarshalCatalogObject(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(CatalogObject) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) +// CreateOfferingInstanceWithContext is an alternate form of the CreateOfferingInstance method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) CreateOfferingInstanceWithContext(ctx context.Context, createOfferingInstanceOptions *CreateOfferingInstanceOptions) (result *OfferingInstance, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createOfferingInstanceOptions, "createOfferingInstanceOptions cannot be nil") if err != nil { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.ValidateStruct(createOfferingInstanceOptions, "createOfferingInstanceOptions") if err != nil { return } - err = core.UnmarshalPrimitive(m, "_rev", &obj.Rev) + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/instances/offerings`, nil) if err != nil { return } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return + + for headerName, headerValue := range createOfferingInstanceOptions.Headers { + builder.AddHeader(headerName, headerValue) } - err = core.UnmarshalPrimitive(m, "url", &obj.URL) - if err != nil { - return + + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "CreateOfferingInstance") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) } - err = core.UnmarshalPrimitive(m, "parent_id", &obj.ParentID) - if err != nil { - return + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + if createOfferingInstanceOptions.XAuthRefreshToken != nil { + builder.AddHeader("X-Auth-Refresh-Token", fmt.Sprint(*createOfferingInstanceOptions.XAuthRefreshToken)) } - err = core.UnmarshalPrimitive(m, "label_i18n", &obj.LabelI18n) - if err != nil { - return + + body := make(map[string]interface{}) + if createOfferingInstanceOptions.ID != nil { + body["id"] = createOfferingInstanceOptions.ID } - err = core.UnmarshalPrimitive(m, "label", &obj.Label) - if err != nil { - return + if createOfferingInstanceOptions.Rev != nil { + body["_rev"] = createOfferingInstanceOptions.Rev } - err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) - if err != nil { - return + if createOfferingInstanceOptions.URL != nil { + body["url"] = createOfferingInstanceOptions.URL } - err = core.UnmarshalPrimitive(m, "created", &obj.Created) - if err != nil { - return + if createOfferingInstanceOptions.CRN != nil { + body["crn"] = createOfferingInstanceOptions.CRN } - err = core.UnmarshalPrimitive(m, "updated", &obj.Updated) - if err != nil { - return + if createOfferingInstanceOptions.Label != nil { + body["label"] = createOfferingInstanceOptions.Label } - err = core.UnmarshalPrimitive(m, "short_description", &obj.ShortDescription) - if err != nil { - return + if createOfferingInstanceOptions.CatalogID != nil { + body["catalog_id"] = createOfferingInstanceOptions.CatalogID } - err = core.UnmarshalPrimitive(m, "short_description_i18n", &obj.ShortDescriptionI18n) - if err != nil { - return + if createOfferingInstanceOptions.OfferingID != nil { + body["offering_id"] = createOfferingInstanceOptions.OfferingID } - err = core.UnmarshalPrimitive(m, "kind", &obj.Kind) - if err != nil { - return + if createOfferingInstanceOptions.KindFormat != nil { + body["kind_format"] = createOfferingInstanceOptions.KindFormat } - err = core.UnmarshalModel(m, "publish", &obj.Publish, UnmarshalPublishObject) - if err != nil { - return + if createOfferingInstanceOptions.Version != nil { + body["version"] = createOfferingInstanceOptions.Version } - err = core.UnmarshalModel(m, "state", &obj.State, UnmarshalState) - if err != nil { - return + if createOfferingInstanceOptions.VersionID != nil { + body["version_id"] = createOfferingInstanceOptions.VersionID } - err = core.UnmarshalPrimitive(m, "catalog_id", &obj.CatalogID) + if createOfferingInstanceOptions.ClusterID != nil { + body["cluster_id"] = createOfferingInstanceOptions.ClusterID + } + if createOfferingInstanceOptions.ClusterRegion != nil { + body["cluster_region"] = createOfferingInstanceOptions.ClusterRegion + } + if createOfferingInstanceOptions.ClusterNamespaces != nil { + body["cluster_namespaces"] = createOfferingInstanceOptions.ClusterNamespaces + } + if createOfferingInstanceOptions.ClusterAllNamespaces != nil { + body["cluster_all_namespaces"] = createOfferingInstanceOptions.ClusterAllNamespaces + } + if createOfferingInstanceOptions.SchematicsWorkspaceID != nil { + body["schematics_workspace_id"] = createOfferingInstanceOptions.SchematicsWorkspaceID + } + if createOfferingInstanceOptions.InstallPlan != nil { + body["install_plan"] = createOfferingInstanceOptions.InstallPlan + } + if createOfferingInstanceOptions.Channel != nil { + body["channel"] = createOfferingInstanceOptions.Channel + } + if createOfferingInstanceOptions.Created != nil { + body["created"] = createOfferingInstanceOptions.Created + } + if createOfferingInstanceOptions.Updated != nil { + body["updated"] = createOfferingInstanceOptions.Updated + } + if createOfferingInstanceOptions.Metadata != nil { + body["metadata"] = createOfferingInstanceOptions.Metadata + } + if createOfferingInstanceOptions.ResourceGroupID != nil { + body["resource_group_id"] = createOfferingInstanceOptions.ResourceGroupID + } + if createOfferingInstanceOptions.Location != nil { + body["location"] = createOfferingInstanceOptions.Location + } + if createOfferingInstanceOptions.Disabled != nil { + body["disabled"] = createOfferingInstanceOptions.Disabled + } + if createOfferingInstanceOptions.Account != nil { + body["account"] = createOfferingInstanceOptions.Account + } + if createOfferingInstanceOptions.LastOperation != nil { + body["last_operation"] = createOfferingInstanceOptions.LastOperation + } + if createOfferingInstanceOptions.KindTarget != nil { + body["kind_target"] = createOfferingInstanceOptions.KindTarget + } + if createOfferingInstanceOptions.Sha != nil { + body["sha"] = createOfferingInstanceOptions.Sha + } + _, err = builder.SetBodyContentJSON(body) if err != nil { return } - err = core.UnmarshalPrimitive(m, "catalog_name", &obj.CatalogName) + + request, err := builder.Build() if err != nil { return } - err = core.UnmarshalPrimitive(m, "data", &obj.Data) + + var rawResponse map[string]json.RawMessage + response, err = catalogManagement.Service.Request(request, &rawResponse) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalOfferingInstance) + if err != nil { + return + } + response.Result = result + } + return } -// CatalogSearchResult : Paginated catalog search result. -type CatalogSearchResult struct { - // The overall total number of resources in the search result set. - TotalCount *int64 `json:"total_count,omitempty"` - - // Resulting objects. - Resources []Catalog `json:"resources,omitempty"` +// GetOfferingInstance : Get Offering Instance +// Get the resource associated with an installed offering instance. +func (catalogManagement *CatalogManagementV1) GetOfferingInstance(getOfferingInstanceOptions *GetOfferingInstanceOptions) (result *OfferingInstance, response *core.DetailedResponse, err error) { + return catalogManagement.GetOfferingInstanceWithContext(context.Background(), getOfferingInstanceOptions) } -// UnmarshalCatalogSearchResult unmarshals an instance of CatalogSearchResult from the specified map of raw messages. -func UnmarshalCatalogSearchResult(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(CatalogSearchResult) - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) +// GetOfferingInstanceWithContext is an alternate form of the GetOfferingInstance method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) GetOfferingInstanceWithContext(ctx context.Context, getOfferingInstanceOptions *GetOfferingInstanceOptions) (result *OfferingInstance, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getOfferingInstanceOptions, "getOfferingInstanceOptions cannot be nil") if err != nil { return } - err = core.UnmarshalModel(m, "resources", &obj.Resources, UnmarshalCatalog) + err = core.ValidateStruct(getOfferingInstanceOptions, "getOfferingInstanceOptions") if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} -// CategoryFilter : Filter on a category. The filter will match against the values of the given category with include or exclude. -type CategoryFilter struct { - // -> true - This is an include filter, false - this is an exclude filter. - Include *bool `json:"include,omitempty"` + pathParamsMap := map[string]string{ + "instance_identifier": *getOfferingInstanceOptions.InstanceIdentifier, + } - // Offering filter terms. - Filter *FilterTerms `json:"filter,omitempty"` -} + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/instances/offerings/{instance_identifier}`, pathParamsMap) + if err != nil { + return + } -// UnmarshalCategoryFilter unmarshals an instance of CategoryFilter from the specified map of raw messages. -func UnmarshalCategoryFilter(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(CategoryFilter) - err = core.UnmarshalPrimitive(m, "include", &obj.Include) + for headerName, headerValue := range getOfferingInstanceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "GetOfferingInstance") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + request, err := builder.Build() if err != nil { return } - err = core.UnmarshalModel(m, "filter", &obj.Filter, UnmarshalFilterTerms) + + var rawResponse map[string]json.RawMessage + response, err = catalogManagement.Service.Request(request, &rawResponse) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalOfferingInstance) + if err != nil { + return + } + response.Result = result + } + return } -// ClusterInfo : Cluster information. -type ClusterInfo struct { - // Resource Group ID. - ResourceGroupID *string `json:"resource_group_id,omitempty"` - - // Resource Group name. - ResourceGroupName *string `json:"resource_group_name,omitempty"` - - // Cluster ID. - ID *string `json:"id,omitempty"` - - // Cluster name. - Name *string `json:"name,omitempty"` - - // Cluster region. - Region *string `json:"region,omitempty"` +// PutOfferingInstance : Update Offering Instance +// Update an installed offering instance. +func (catalogManagement *CatalogManagementV1) PutOfferingInstance(putOfferingInstanceOptions *PutOfferingInstanceOptions) (result *OfferingInstance, response *core.DetailedResponse, err error) { + return catalogManagement.PutOfferingInstanceWithContext(context.Background(), putOfferingInstanceOptions) } -// UnmarshalClusterInfo unmarshals an instance of ClusterInfo from the specified map of raw messages. -func UnmarshalClusterInfo(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ClusterInfo) - err = core.UnmarshalPrimitive(m, "resource_group_id", &obj.ResourceGroupID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_group_name", &obj.ResourceGroupName) +// PutOfferingInstanceWithContext is an alternate form of the PutOfferingInstance method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) PutOfferingInstanceWithContext(ctx context.Context, putOfferingInstanceOptions *PutOfferingInstanceOptions) (result *OfferingInstance, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(putOfferingInstanceOptions, "putOfferingInstanceOptions cannot be nil") if err != nil { return } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) + err = core.ValidateStruct(putOfferingInstanceOptions, "putOfferingInstanceOptions") if err != nil { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return + + pathParamsMap := map[string]string{ + "instance_identifier": *putOfferingInstanceOptions.InstanceIdentifier, } - err = core.UnmarshalPrimitive(m, "region", &obj.Region) + + builder := core.NewRequestBuilder(core.PUT) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/instances/offerings/{instance_identifier}`, pathParamsMap) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// CommitVersionOptions : The CommitVersion options. -type CommitVersionOptions struct { - // A dotted value of `catalogID`.`versionID`. - VersionLocID *string `json:"version_loc_id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} -// NewCommitVersionOptions : Instantiate CommitVersionOptions -func (*CatalogManagementV1) NewCommitVersionOptions(versionLocID string) *CommitVersionOptions { - return &CommitVersionOptions{ - VersionLocID: core.StringPtr(versionLocID), + for headerName, headerValue := range putOfferingInstanceOptions.Headers { + builder.AddHeader(headerName, headerValue) } -} -// SetVersionLocID : Allow user to set VersionLocID -func (_options *CommitVersionOptions) SetVersionLocID(versionLocID string) *CommitVersionOptions { - _options.VersionLocID = core.StringPtr(versionLocID) - return _options -} + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "PutOfferingInstance") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + if putOfferingInstanceOptions.XAuthRefreshToken != nil { + builder.AddHeader("X-Auth-Refresh-Token", fmt.Sprint(*putOfferingInstanceOptions.XAuthRefreshToken)) + } -// SetHeaders : Allow user to set Headers -func (options *CommitVersionOptions) SetHeaders(param map[string]string) *CommitVersionOptions { - options.Headers = param - return options + body := make(map[string]interface{}) + if putOfferingInstanceOptions.ID != nil { + body["id"] = putOfferingInstanceOptions.ID + } + if putOfferingInstanceOptions.Rev != nil { + body["_rev"] = putOfferingInstanceOptions.Rev + } + if putOfferingInstanceOptions.URL != nil { + body["url"] = putOfferingInstanceOptions.URL + } + if putOfferingInstanceOptions.CRN != nil { + body["crn"] = putOfferingInstanceOptions.CRN + } + if putOfferingInstanceOptions.Label != nil { + body["label"] = putOfferingInstanceOptions.Label + } + if putOfferingInstanceOptions.CatalogID != nil { + body["catalog_id"] = putOfferingInstanceOptions.CatalogID + } + if putOfferingInstanceOptions.OfferingID != nil { + body["offering_id"] = putOfferingInstanceOptions.OfferingID + } + if putOfferingInstanceOptions.KindFormat != nil { + body["kind_format"] = putOfferingInstanceOptions.KindFormat + } + if putOfferingInstanceOptions.Version != nil { + body["version"] = putOfferingInstanceOptions.Version + } + if putOfferingInstanceOptions.VersionID != nil { + body["version_id"] = putOfferingInstanceOptions.VersionID + } + if putOfferingInstanceOptions.ClusterID != nil { + body["cluster_id"] = putOfferingInstanceOptions.ClusterID + } + if putOfferingInstanceOptions.ClusterRegion != nil { + body["cluster_region"] = putOfferingInstanceOptions.ClusterRegion + } + if putOfferingInstanceOptions.ClusterNamespaces != nil { + body["cluster_namespaces"] = putOfferingInstanceOptions.ClusterNamespaces + } + if putOfferingInstanceOptions.ClusterAllNamespaces != nil { + body["cluster_all_namespaces"] = putOfferingInstanceOptions.ClusterAllNamespaces + } + if putOfferingInstanceOptions.SchematicsWorkspaceID != nil { + body["schematics_workspace_id"] = putOfferingInstanceOptions.SchematicsWorkspaceID + } + if putOfferingInstanceOptions.InstallPlan != nil { + body["install_plan"] = putOfferingInstanceOptions.InstallPlan + } + if putOfferingInstanceOptions.Channel != nil { + body["channel"] = putOfferingInstanceOptions.Channel + } + if putOfferingInstanceOptions.Created != nil { + body["created"] = putOfferingInstanceOptions.Created + } + if putOfferingInstanceOptions.Updated != nil { + body["updated"] = putOfferingInstanceOptions.Updated + } + if putOfferingInstanceOptions.Metadata != nil { + body["metadata"] = putOfferingInstanceOptions.Metadata + } + if putOfferingInstanceOptions.ResourceGroupID != nil { + body["resource_group_id"] = putOfferingInstanceOptions.ResourceGroupID + } + if putOfferingInstanceOptions.Location != nil { + body["location"] = putOfferingInstanceOptions.Location + } + if putOfferingInstanceOptions.Disabled != nil { + body["disabled"] = putOfferingInstanceOptions.Disabled + } + if putOfferingInstanceOptions.Account != nil { + body["account"] = putOfferingInstanceOptions.Account + } + if putOfferingInstanceOptions.LastOperation != nil { + body["last_operation"] = putOfferingInstanceOptions.LastOperation + } + if putOfferingInstanceOptions.KindTarget != nil { + body["kind_target"] = putOfferingInstanceOptions.KindTarget + } + if putOfferingInstanceOptions.Sha != nil { + body["sha"] = putOfferingInstanceOptions.Sha + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = catalogManagement.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalOfferingInstance) + if err != nil { + return + } + response.Result = result + } + + return } -// Configuration : Configuration description. -type Configuration struct { - // Configuration key. - Key *string `json:"key,omitempty"` +// DeleteOfferingInstance : Delete a version instance +// Delete and instance deployed out of a product version. +func (catalogManagement *CatalogManagementV1) DeleteOfferingInstance(deleteOfferingInstanceOptions *DeleteOfferingInstanceOptions) (response *core.DetailedResponse, err error) { + return catalogManagement.DeleteOfferingInstanceWithContext(context.Background(), deleteOfferingInstanceOptions) +} - // Value type (string, boolean, int). - Type *string `json:"type,omitempty"` +// DeleteOfferingInstanceWithContext is an alternate form of the DeleteOfferingInstance method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) DeleteOfferingInstanceWithContext(ctx context.Context, deleteOfferingInstanceOptions *DeleteOfferingInstanceOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteOfferingInstanceOptions, "deleteOfferingInstanceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteOfferingInstanceOptions, "deleteOfferingInstanceOptions") + if err != nil { + return + } - // The default value. To use a secret when the type is password, specify a JSON encoded value of - // $ref:#/components/schemas/SecretInstance, prefixed with `cmsm_v1:`. - DefaultValue interface{} `json:"default_value,omitempty"` + pathParamsMap := map[string]string{ + "instance_identifier": *deleteOfferingInstanceOptions.InstanceIdentifier, + } - // Constraint associated with value, e.g., for string type - regx:[a-z]. - ValueConstraint *string `json:"value_constraint,omitempty"` + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/instances/offerings/{instance_identifier}`, pathParamsMap) + if err != nil { + return + } - // Key description. - Description *string `json:"description,omitempty"` + for headerName, headerValue := range deleteOfferingInstanceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } - // Is key required to install. - Required *bool `json:"required,omitempty"` + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "DeleteOfferingInstance") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + if deleteOfferingInstanceOptions.XAuthRefreshToken != nil { + builder.AddHeader("X-Auth-Refresh-Token", fmt.Sprint(*deleteOfferingInstanceOptions.XAuthRefreshToken)) + } - // List of options of type. - Options []interface{} `json:"options,omitempty"` + request, err := builder.Build() + if err != nil { + return + } - // Hide values. - Hidden *bool `json:"hidden,omitempty"` + response, err = catalogManagement.Service.Request(request, nil) + + return } -// UnmarshalConfiguration unmarshals an instance of Configuration from the specified map of raw messages. -func UnmarshalConfiguration(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(Configuration) - err = core.UnmarshalPrimitive(m, "key", &obj.Key) +// ListOfferingInstanceAudits : Get offering instance audit logs +// Get the audit logs associated with an offering instance. +func (catalogManagement *CatalogManagementV1) ListOfferingInstanceAudits(listOfferingInstanceAuditsOptions *ListOfferingInstanceAuditsOptions) (result *AuditLogs, response *core.DetailedResponse, err error) { + return catalogManagement.ListOfferingInstanceAuditsWithContext(context.Background(), listOfferingInstanceAuditsOptions) +} + +// ListOfferingInstanceAuditsWithContext is an alternate form of the ListOfferingInstanceAudits method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) ListOfferingInstanceAuditsWithContext(ctx context.Context, listOfferingInstanceAuditsOptions *ListOfferingInstanceAuditsOptions) (result *AuditLogs, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listOfferingInstanceAuditsOptions, "listOfferingInstanceAuditsOptions cannot be nil") if err != nil { return } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) + err = core.ValidateStruct(listOfferingInstanceAuditsOptions, "listOfferingInstanceAuditsOptions") if err != nil { return } - err = core.UnmarshalPrimitive(m, "default_value", &obj.DefaultValue) + + pathParamsMap := map[string]string{ + "instance_identifier": *listOfferingInstanceAuditsOptions.InstanceIdentifier, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/instances/offerings/{instance_identifier}/audits`, pathParamsMap) if err != nil { return } - err = core.UnmarshalPrimitive(m, "value_constraint", &obj.ValueConstraint) + + for headerName, headerValue := range listOfferingInstanceAuditsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "ListOfferingInstanceAudits") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + if listOfferingInstanceAuditsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listOfferingInstanceAuditsOptions.Start)) + } + if listOfferingInstanceAuditsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listOfferingInstanceAuditsOptions.Limit)) + } + if listOfferingInstanceAuditsOptions.Lookupnames != nil { + builder.AddQuery("lookupnames", fmt.Sprint(*listOfferingInstanceAuditsOptions.Lookupnames)) + } + + request, err := builder.Build() if err != nil { return } - err = core.UnmarshalPrimitive(m, "description", &obj.Description) + + var rawResponse map[string]json.RawMessage + response, err = catalogManagement.Service.Request(request, &rawResponse) if err != nil { return } - err = core.UnmarshalPrimitive(m, "required", &obj.Required) + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAuditLogs) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetOfferingInstanceAudit : Get an offering instance audit log entry +// Get the full audit log entry associated with an offering instance. +func (catalogManagement *CatalogManagementV1) GetOfferingInstanceAudit(getOfferingInstanceAuditOptions *GetOfferingInstanceAuditOptions) (result *AuditLog, response *core.DetailedResponse, err error) { + return catalogManagement.GetOfferingInstanceAuditWithContext(context.Background(), getOfferingInstanceAuditOptions) +} + +// GetOfferingInstanceAuditWithContext is an alternate form of the GetOfferingInstanceAudit method which supports a Context parameter +func (catalogManagement *CatalogManagementV1) GetOfferingInstanceAuditWithContext(ctx context.Context, getOfferingInstanceAuditOptions *GetOfferingInstanceAuditOptions) (result *AuditLog, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getOfferingInstanceAuditOptions, "getOfferingInstanceAuditOptions cannot be nil") if err != nil { return } - err = core.UnmarshalPrimitive(m, "options", &obj.Options) + err = core.ValidateStruct(getOfferingInstanceAuditOptions, "getOfferingInstanceAuditOptions") if err != nil { return } - err = core.UnmarshalPrimitive(m, "hidden", &obj.Hidden) + + pathParamsMap := map[string]string{ + "instance_identifier": *getOfferingInstanceAuditOptions.InstanceIdentifier, + "auditlog_identifier": *getOfferingInstanceAuditOptions.AuditlogIdentifier, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = catalogManagement.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(catalogManagement.Service.Options.URL, `/instances/offerings/{instance_identifier}/audits/{auditlog_identifier}`, pathParamsMap) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// CopyVersionOptions : The CopyVersion options. -type CopyVersionOptions struct { - // A dotted value of `catalogID`.`versionID`. - VersionLocID *string `json:"version_loc_id" validate:"required,ne="` - // Tags array. - Tags []string `json:"tags,omitempty"` + for headerName, headerValue := range getOfferingInstanceAuditOptions.Headers { + builder.AddHeader(headerName, headerValue) + } - // Target kinds. Current valid values are 'iks', 'roks', 'vcenter', and 'terraform'. - TargetKinds []string `json:"target_kinds,omitempty"` + sdkHeaders := common.GetSdkHeaders("catalog_management", "V1", "GetOfferingInstanceAudit") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") - // byte array representing the content to be imported. Only supported for OVA images at this time. - Content *[]byte `json:"content,omitempty"` + if getOfferingInstanceAuditOptions.Lookupnames != nil { + builder.AddQuery("lookupnames", fmt.Sprint(*getOfferingInstanceAuditOptions.Lookupnames)) + } - // Allows users to set headers on API requests - Headers map[string]string -} + request, err := builder.Build() + if err != nil { + return + } -// NewCopyVersionOptions : Instantiate CopyVersionOptions -func (*CatalogManagementV1) NewCopyVersionOptions(versionLocID string) *CopyVersionOptions { - return &CopyVersionOptions{ - VersionLocID: core.StringPtr(versionLocID), + var rawResponse map[string]json.RawMessage + response, err = catalogManagement.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAuditLog) + if err != nil { + return + } + response.Result = result } + + return } -// SetVersionLocID : Allow user to set VersionLocID -func (_options *CopyVersionOptions) SetVersionLocID(versionLocID string) *CopyVersionOptions { - _options.VersionLocID = core.StringPtr(versionLocID) - return _options -} +// Access : access. +type Access struct { + // unique id. + ID *string `json:"id,omitempty"` -// SetTags : Allow user to set Tags -func (_options *CopyVersionOptions) SetTags(tags []string) *CopyVersionOptions { - _options.Tags = tags - return _options + // account id. + Account *string `json:"account,omitempty"` + + // Normal account or enterprise. + AccountType *int64 `json:"account_type,omitempty"` + + // unique id. + CatalogID *string `json:"catalog_id,omitempty"` + + // object ID. + TargetID *string `json:"target_id,omitempty"` + + // object's owner's account. + TargetAccount *string `json:"target_account,omitempty"` + + // entity type. + TargetKind *string `json:"target_kind,omitempty"` + + // accessible to the private object. + PrivateAccessible *bool `json:"private_accessible,omitempty"` + + // date and time create. + Created *strfmt.DateTime `json:"created,omitempty"` } -// SetTargetKinds : Allow user to set TargetKinds -func (_options *CopyVersionOptions) SetTargetKinds(targetKinds []string) *CopyVersionOptions { - _options.TargetKinds = targetKinds - return _options +// UnmarshalAccess unmarshals an instance of Access from the specified map of raw messages. +func UnmarshalAccess(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Access) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "account", &obj.Account) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "account_type", &obj.AccountType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "catalog_id", &obj.CatalogID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "target_id", &obj.TargetID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "target_account", &obj.TargetAccount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "target_kind", &obj.TargetKind) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "private_accessible", &obj.PrivateAccessible) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created", &obj.Created) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// SetContent : Allow user to set Content -func (_options *CopyVersionOptions) SetContent(content []byte) *CopyVersionOptions { - _options.Content = &content - return _options +// AccessListBulkResponse : Access List Add/Remove result. +type AccessListBulkResponse struct { + // in the case of error on an account add/remove - account: error. + Errors map[string]string `json:"errors,omitempty"` } -// SetHeaders : Allow user to set Headers -func (options *CopyVersionOptions) SetHeaders(param map[string]string) *CopyVersionOptions { - options.Headers = param - return options +// UnmarshalAccessListBulkResponse unmarshals an instance of AccessListBulkResponse from the specified map of raw messages. +func UnmarshalAccessListBulkResponse(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(AccessListBulkResponse) + err = core.UnmarshalPrimitive(m, "errors", &obj.Errors) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// CreateCatalogOptions : The CreateCatalog options. -type CreateCatalogOptions struct { - // Unique ID. - ID *string `json:"id,omitempty"` +// AccessListResult : Paginated Offering search result. +type AccessListResult struct { + // The start token used for this response. + Start *string `json:"start,omitempty"` - // Cloudant revision. - Rev *string `json:"_rev,omitempty"` + // The limit that was applied to this response. It may be smaller than in the request because that was too large. + Limit *int64 `json:"limit" validate:"required"` - // Display Name in the requested language. - Label *string `json:"label,omitempty"` + // The total count of resources in the system that matches the request. + TotalCount *int64 `json:"total_count,omitempty"` - // Description in the requested language. - ShortDescription *string `json:"short_description,omitempty"` + // The number of resources returned in this response. + ResourceCount *int64 `json:"resource_count" validate:"required"` - // URL for an icon associated with this catalog. - CatalogIconURL *string `json:"catalog_icon_url,omitempty"` + // Link response on a token paginated query. + First *PaginationTokenLink `json:"first" validate:"required"` - // List of tags associated with this catalog. - Tags []string `json:"tags,omitempty"` + // Link response on a token paginated query. + Next *PaginationTokenLink `json:"next,omitempty"` - // List of features associated with this catalog. - Features []Feature `json:"features,omitempty"` + // Link response on a token paginated query. + Prev *PaginationTokenLink `json:"prev,omitempty"` - // Denotes whether a catalog is disabled. - Disabled *bool `json:"disabled,omitempty"` + // Link response on a token paginated query. + Last *PaginationTokenLink `json:"last,omitempty"` - // Resource group id the catalog is owned by. - ResourceGroupID *string `json:"resource_group_id,omitempty"` + // A list of access records. + Resources []Access `json:"resources" validate:"required"` +} - // Account that owns catalog. - OwningAccount *string `json:"owning_account,omitempty"` +// UnmarshalAccessListResult unmarshals an instance of AccessListResult from the specified map of raw messages. +func UnmarshalAccessListResult(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(AccessListResult) + err = core.UnmarshalPrimitive(m, "start", &obj.Start) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_count", &obj.ResourceCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPaginationTokenLink) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPaginationTokenLink) + if err != nil { + return + } + err = core.UnmarshalModel(m, "prev", &obj.Prev, UnmarshalPaginationTokenLink) + if err != nil { + return + } + err = core.UnmarshalModel(m, "last", &obj.Last, UnmarshalPaginationTokenLink) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resources", &obj.Resources, UnmarshalAccess) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *AccessListResult) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + return resp.Next.Start, nil +} + +// Account : Account information. +type Account struct { + // Account identification. + ID *string `json:"id,omitempty"` + + // Cloudant revision. + Rev *string `json:"_rev,omitempty"` + + // Hide the public catalog in this account. + HideIBMCloudCatalog *bool `json:"hide_IBM_cloud_catalog,omitempty"` // Filters for account and catalog filters. - CatalogFilters *Filters `json:"catalog_filters,omitempty"` + AccountFilters *Filters `json:"account_filters,omitempty"` +} - // Feature information. - SyndicationSettings *SyndicationResource `json:"syndication_settings,omitempty"` +// UnmarshalAccount unmarshals an instance of Account from the specified map of raw messages. +func UnmarshalAccount(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Account) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "_rev", &obj.Rev) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "hide_IBM_cloud_catalog", &obj.HideIBMCloudCatalog) + if err != nil { + return + } + err = core.UnmarshalModel(m, "account_filters", &obj.AccountFilters, UnmarshalFilters) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} - // Kind of catalog. Supported kinds are offering and vpe. - Kind *string `json:"kind,omitempty"` +// AccountPublishObjectOptions : The AccountPublishObject options. +type AccountPublishObjectOptions struct { + // Catalog identifier. + CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` + + // Object identifier. + ObjectIdentifier *string `json:"object_identifier" validate:"required,ne="` // Allows users to set headers on API requests Headers map[string]string } -// NewCreateCatalogOptions : Instantiate CreateCatalogOptions -func (*CatalogManagementV1) NewCreateCatalogOptions() *CreateCatalogOptions { - return &CreateCatalogOptions{} +// NewAccountPublishObjectOptions : Instantiate AccountPublishObjectOptions +func (*CatalogManagementV1) NewAccountPublishObjectOptions(catalogIdentifier string, objectIdentifier string) *AccountPublishObjectOptions { + return &AccountPublishObjectOptions{ + CatalogIdentifier: core.StringPtr(catalogIdentifier), + ObjectIdentifier: core.StringPtr(objectIdentifier), + } } -// SetID : Allow user to set ID -func (_options *CreateCatalogOptions) SetID(id string) *CreateCatalogOptions { - _options.ID = core.StringPtr(id) +// SetCatalogIdentifier : Allow user to set CatalogIdentifier +func (_options *AccountPublishObjectOptions) SetCatalogIdentifier(catalogIdentifier string) *AccountPublishObjectOptions { + _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) return _options } -// SetRev : Allow user to set Rev -func (_options *CreateCatalogOptions) SetRev(rev string) *CreateCatalogOptions { - _options.Rev = core.StringPtr(rev) +// SetObjectIdentifier : Allow user to set ObjectIdentifier +func (_options *AccountPublishObjectOptions) SetObjectIdentifier(objectIdentifier string) *AccountPublishObjectOptions { + _options.ObjectIdentifier = core.StringPtr(objectIdentifier) return _options } -// SetLabel : Allow user to set Label -func (_options *CreateCatalogOptions) SetLabel(label string) *CreateCatalogOptions { - _options.Label = core.StringPtr(label) - return _options +// SetHeaders : Allow user to set Headers +func (options *AccountPublishObjectOptions) SetHeaders(param map[string]string) *AccountPublishObjectOptions { + options.Headers = param + return options } -// SetShortDescription : Allow user to set ShortDescription -func (_options *CreateCatalogOptions) SetShortDescription(shortDescription string) *CreateCatalogOptions { - _options.ShortDescription = core.StringPtr(shortDescription) - return _options +// AccountPublishVersionOptions : The AccountPublishVersion options. +type AccountPublishVersionOptions struct { + // A dotted value of `catalogID`.`versionID`. + VersionLocID *string `json:"version_loc_id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string } -// SetCatalogIconURL : Allow user to set CatalogIconURL -func (_options *CreateCatalogOptions) SetCatalogIconURL(catalogIconURL string) *CreateCatalogOptions { - _options.CatalogIconURL = core.StringPtr(catalogIconURL) - return _options +// NewAccountPublishVersionOptions : Instantiate AccountPublishVersionOptions +func (*CatalogManagementV1) NewAccountPublishVersionOptions(versionLocID string) *AccountPublishVersionOptions { + return &AccountPublishVersionOptions{ + VersionLocID: core.StringPtr(versionLocID), + } } -// SetTags : Allow user to set Tags -func (_options *CreateCatalogOptions) SetTags(tags []string) *CreateCatalogOptions { - _options.Tags = tags +// SetVersionLocID : Allow user to set VersionLocID +func (_options *AccountPublishVersionOptions) SetVersionLocID(versionLocID string) *AccountPublishVersionOptions { + _options.VersionLocID = core.StringPtr(versionLocID) return _options } -// SetFeatures : Allow user to set Features -func (_options *CreateCatalogOptions) SetFeatures(features []Feature) *CreateCatalogOptions { - _options.Features = features - return _options +// SetHeaders : Allow user to set Headers +func (options *AccountPublishVersionOptions) SetHeaders(param map[string]string) *AccountPublishVersionOptions { + options.Headers = param + return options } -// SetDisabled : Allow user to set Disabled -func (_options *CreateCatalogOptions) SetDisabled(disabled bool) *CreateCatalogOptions { - _options.Disabled = core.BoolPtr(disabled) - return _options -} +// AccumulatedFilters : The accumulated filters for an account. This will return the account filters plus a filter for each catalog the user +// has access to. +type AccumulatedFilters struct { + // Hide the public catalog in this account. + HideIBMCloudCatalog *bool `json:"hide_IBM_cloud_catalog,omitempty"` -// SetResourceGroupID : Allow user to set ResourceGroupID -func (_options *CreateCatalogOptions) SetResourceGroupID(resourceGroupID string) *CreateCatalogOptions { - _options.ResourceGroupID = core.StringPtr(resourceGroupID) - return _options + // Filters for accounts (at this time this will always be just one item array). + AccountFilters []Filters `json:"account_filters,omitempty"` + + // The filters for all of the accessible catalogs. + CatalogFilters []AccumulatedFiltersCatalogFiltersItem `json:"catalog_filters,omitempty"` } -// SetOwningAccount : Allow user to set OwningAccount -func (_options *CreateCatalogOptions) SetOwningAccount(owningAccount string) *CreateCatalogOptions { - _options.OwningAccount = core.StringPtr(owningAccount) - return _options +// UnmarshalAccumulatedFilters unmarshals an instance of AccumulatedFilters from the specified map of raw messages. +func UnmarshalAccumulatedFilters(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(AccumulatedFilters) + err = core.UnmarshalPrimitive(m, "hide_IBM_cloud_catalog", &obj.HideIBMCloudCatalog) + if err != nil { + return + } + err = core.UnmarshalModel(m, "account_filters", &obj.AccountFilters, UnmarshalFilters) + if err != nil { + return + } + err = core.UnmarshalModel(m, "catalog_filters", &obj.CatalogFilters, UnmarshalAccumulatedFiltersCatalogFiltersItem) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// SetCatalogFilters : Allow user to set CatalogFilters -func (_options *CreateCatalogOptions) SetCatalogFilters(catalogFilters *Filters) *CreateCatalogOptions { - _options.CatalogFilters = catalogFilters - return _options +// AccumulatedFiltersCatalogFiltersItem : AccumulatedFiltersCatalogFiltersItem struct +type AccumulatedFiltersCatalogFiltersItem struct { + // Filters for catalog. + Catalog *AccumulatedFiltersCatalogFiltersItemCatalog `json:"catalog,omitempty"` + + // Filters for account and catalog filters. + Filters *Filters `json:"filters,omitempty"` } -// SetSyndicationSettings : Allow user to set SyndicationSettings -func (_options *CreateCatalogOptions) SetSyndicationSettings(syndicationSettings *SyndicationResource) *CreateCatalogOptions { - _options.SyndicationSettings = syndicationSettings - return _options +// UnmarshalAccumulatedFiltersCatalogFiltersItem unmarshals an instance of AccumulatedFiltersCatalogFiltersItem from the specified map of raw messages. +func UnmarshalAccumulatedFiltersCatalogFiltersItem(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(AccumulatedFiltersCatalogFiltersItem) + err = core.UnmarshalModel(m, "catalog", &obj.Catalog, UnmarshalAccumulatedFiltersCatalogFiltersItemCatalog) + if err != nil { + return + } + err = core.UnmarshalModel(m, "filters", &obj.Filters, UnmarshalFilters) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// SetKind : Allow user to set Kind -func (_options *CreateCatalogOptions) SetKind(kind string) *CreateCatalogOptions { - _options.Kind = core.StringPtr(kind) - return _options +// AccumulatedFiltersCatalogFiltersItemCatalog : Filters for catalog. +type AccumulatedFiltersCatalogFiltersItemCatalog struct { + // The ID of the catalog. + ID *string `json:"id,omitempty"` + + // The name of the catalog. + Name *string `json:"name,omitempty"` } -// SetHeaders : Allow user to set Headers -func (options *CreateCatalogOptions) SetHeaders(param map[string]string) *CreateCatalogOptions { - options.Headers = param - return options +// UnmarshalAccumulatedFiltersCatalogFiltersItemCatalog unmarshals an instance of AccumulatedFiltersCatalogFiltersItemCatalog from the specified map of raw messages. +func UnmarshalAccumulatedFiltersCatalogFiltersItemCatalog(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(AccumulatedFiltersCatalogFiltersItemCatalog) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// CreateObjectAccessOptions : The CreateObjectAccess options. -type CreateObjectAccessOptions struct { +// AddObjectAccessListOptions : The AddObjectAccessList options. +type AddObjectAccessListOptions struct { // Catalog identifier. CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` // Object identifier. ObjectIdentifier *string `json:"object_identifier" validate:"required,ne="` - // Account identifier. - AccountIdentifier *string `json:"account_identifier" validate:"required,ne="` + // A list of accesses to add. + Accesses []string `json:"accesses" validate:"required"` // Allows users to set headers on API requests Headers map[string]string } -// NewCreateObjectAccessOptions : Instantiate CreateObjectAccessOptions -func (*CatalogManagementV1) NewCreateObjectAccessOptions(catalogIdentifier string, objectIdentifier string, accountIdentifier string) *CreateObjectAccessOptions { - return &CreateObjectAccessOptions{ +// NewAddObjectAccessListOptions : Instantiate AddObjectAccessListOptions +func (*CatalogManagementV1) NewAddObjectAccessListOptions(catalogIdentifier string, objectIdentifier string, accesses []string) *AddObjectAccessListOptions { + return &AddObjectAccessListOptions{ CatalogIdentifier: core.StringPtr(catalogIdentifier), ObjectIdentifier: core.StringPtr(objectIdentifier), - AccountIdentifier: core.StringPtr(accountIdentifier), + Accesses: accesses, } } // SetCatalogIdentifier : Allow user to set CatalogIdentifier -func (_options *CreateObjectAccessOptions) SetCatalogIdentifier(catalogIdentifier string) *CreateObjectAccessOptions { +func (_options *AddObjectAccessListOptions) SetCatalogIdentifier(catalogIdentifier string) *AddObjectAccessListOptions { _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) return _options } // SetObjectIdentifier : Allow user to set ObjectIdentifier -func (_options *CreateObjectAccessOptions) SetObjectIdentifier(objectIdentifier string) *CreateObjectAccessOptions { +func (_options *AddObjectAccessListOptions) SetObjectIdentifier(objectIdentifier string) *AddObjectAccessListOptions { _options.ObjectIdentifier = core.StringPtr(objectIdentifier) return _options } -// SetAccountIdentifier : Allow user to set AccountIdentifier -func (_options *CreateObjectAccessOptions) SetAccountIdentifier(accountIdentifier string) *CreateObjectAccessOptions { - _options.AccountIdentifier = core.StringPtr(accountIdentifier) +// SetAccesses : Allow user to set Accesses +func (_options *AddObjectAccessListOptions) SetAccesses(accesses []string) *AddObjectAccessListOptions { + _options.Accesses = accesses return _options } // SetHeaders : Allow user to set Headers -func (options *CreateObjectAccessOptions) SetHeaders(param map[string]string) *CreateObjectAccessOptions { +func (options *AddObjectAccessListOptions) SetHeaders(param map[string]string) *AddObjectAccessListOptions { options.Headers = param return options } -// CreateObjectOptions : The CreateObject options. -type CreateObjectOptions struct { +// AddOfferingAccessListOptions : The AddOfferingAccessList options. +type AddOfferingAccessListOptions struct { // Catalog identifier. CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` - // unique id. - ID *string `json:"id,omitempty"` - - // The programmatic name of this offering. - Name *string `json:"name,omitempty"` - - // Cloudant revision. - Rev *string `json:"_rev,omitempty"` - - // The crn for this specific object. - CRN *string `json:"crn,omitempty"` - - // The url for this specific object. - URL *string `json:"url,omitempty"` - - // The parent for this specific object. - ParentID *string `json:"parent_id,omitempty"` - - // Translated display name in the requested language. - LabelI18n *string `json:"label_i18n,omitempty"` - - // Display name in the requested language. - Label *string `json:"label,omitempty"` - - // List of tags associated with this catalog. - Tags []string `json:"tags,omitempty"` - - // The date and time this catalog was created. - Created *strfmt.DateTime `json:"created,omitempty"` - - // The date and time this catalog was last updated. - Updated *strfmt.DateTime `json:"updated,omitempty"` - - // Short description in the requested language. - ShortDescription *string `json:"short_description,omitempty"` - - // Short description translation. - ShortDescriptionI18n *string `json:"short_description_i18n,omitempty"` - - // Kind of object. - Kind *string `json:"kind,omitempty"` - - // Publish information. - Publish *PublishObject `json:"publish,omitempty"` - - // Offering state. - State *State `json:"state,omitempty"` - - // The id of the catalog containing this offering. - CatalogID *string `json:"catalog_id,omitempty"` - - // The name of the catalog. - CatalogName *string `json:"catalog_name,omitempty"` + // Offering identification. + OfferingID *string `json:"offering_id" validate:"required,ne="` - // Map of data values for this object. - Data map[string]interface{} `json:"data,omitempty"` + // A list of accesses to add. + Accesses []string `json:"accesses" validate:"required"` // Allows users to set headers on API requests Headers map[string]string } -// NewCreateObjectOptions : Instantiate CreateObjectOptions -func (*CatalogManagementV1) NewCreateObjectOptions(catalogIdentifier string) *CreateObjectOptions { - return &CreateObjectOptions{ +// NewAddOfferingAccessListOptions : Instantiate AddOfferingAccessListOptions +func (*CatalogManagementV1) NewAddOfferingAccessListOptions(catalogIdentifier string, offeringID string, accesses []string) *AddOfferingAccessListOptions { + return &AddOfferingAccessListOptions{ CatalogIdentifier: core.StringPtr(catalogIdentifier), + OfferingID: core.StringPtr(offeringID), + Accesses: accesses, } } // SetCatalogIdentifier : Allow user to set CatalogIdentifier -func (_options *CreateObjectOptions) SetCatalogIdentifier(catalogIdentifier string) *CreateObjectOptions { +func (_options *AddOfferingAccessListOptions) SetCatalogIdentifier(catalogIdentifier string) *AddOfferingAccessListOptions { _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) return _options } -// SetID : Allow user to set ID -func (_options *CreateObjectOptions) SetID(id string) *CreateObjectOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetName : Allow user to set Name -func (_options *CreateObjectOptions) SetName(name string) *CreateObjectOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetRev : Allow user to set Rev -func (_options *CreateObjectOptions) SetRev(rev string) *CreateObjectOptions { - _options.Rev = core.StringPtr(rev) - return _options -} - -// SetCRN : Allow user to set CRN -func (_options *CreateObjectOptions) SetCRN(crn string) *CreateObjectOptions { - _options.CRN = core.StringPtr(crn) - return _options -} - -// SetURL : Allow user to set URL -func (_options *CreateObjectOptions) SetURL(url string) *CreateObjectOptions { - _options.URL = core.StringPtr(url) +// SetOfferingID : Allow user to set OfferingID +func (_options *AddOfferingAccessListOptions) SetOfferingID(offeringID string) *AddOfferingAccessListOptions { + _options.OfferingID = core.StringPtr(offeringID) return _options } -// SetParentID : Allow user to set ParentID -func (_options *CreateObjectOptions) SetParentID(parentID string) *CreateObjectOptions { - _options.ParentID = core.StringPtr(parentID) +// SetAccesses : Allow user to set Accesses +func (_options *AddOfferingAccessListOptions) SetAccesses(accesses []string) *AddOfferingAccessListOptions { + _options.Accesses = accesses return _options } -// SetLabelI18n : Allow user to set LabelI18n -func (_options *CreateObjectOptions) SetLabelI18n(labelI18n string) *CreateObjectOptions { - _options.LabelI18n = core.StringPtr(labelI18n) - return _options +// SetHeaders : Allow user to set Headers +func (options *AddOfferingAccessListOptions) SetHeaders(param map[string]string) *AddOfferingAccessListOptions { + options.Headers = param + return options } -// SetLabel : Allow user to set Label -func (_options *CreateObjectOptions) SetLabel(label string) *CreateObjectOptions { - _options.Label = core.StringPtr(label) - return _options -} +// ApprovalResult : Result of approval. +type ApprovalResult struct { + // Shared - object is shared using access list - not set when using PC Managed objects. + Shared *bool `json:"shared,omitempty"` -// SetTags : Allow user to set Tags -func (_options *CreateObjectOptions) SetTags(tags []string) *CreateObjectOptions { - _options.Tags = tags - return _options -} + // Shared with IBM only - access list is also applicable - not set when using PC Managed objects. + IBM *bool `json:"ibm,omitempty"` -// SetCreated : Allow user to set Created -func (_options *CreateObjectOptions) SetCreated(created *strfmt.DateTime) *CreateObjectOptions { - _options.Created = created - return _options -} + // Shared with everyone - not set when using PC Managed objects. + Public *bool `json:"public,omitempty"` -// SetUpdated : Allow user to set Updated -func (_options *CreateObjectOptions) SetUpdated(updated *strfmt.DateTime) *CreateObjectOptions { - _options.Updated = updated - return _options -} + // Published to Partner Center (pc_managed) or for objects, allowed to request publishing. + AllowRequest *bool `json:"allow_request,omitempty"` -// SetShortDescription : Allow user to set ShortDescription -func (_options *CreateObjectOptions) SetShortDescription(shortDescription string) *CreateObjectOptions { - _options.ShortDescription = core.StringPtr(shortDescription) - return _options -} + // Approvers have approved publishing to public catalog. + Approved *bool `json:"approved,omitempty"` -// SetShortDescriptionI18n : Allow user to set ShortDescriptionI18n -func (_options *CreateObjectOptions) SetShortDescriptionI18n(shortDescriptionI18n string) *CreateObjectOptions { - _options.ShortDescriptionI18n = core.StringPtr(shortDescriptionI18n) - return _options -} + // Partner Center document ID. + PortalRecord *string `json:"portal_record,omitempty"` -// SetKind : Allow user to set Kind -func (_options *CreateObjectOptions) SetKind(kind string) *CreateObjectOptions { - _options.Kind = core.StringPtr(kind) - return _options -} + // Partner Center URL for this product. + PortalURL *string `json:"portal_url,omitempty"` -// SetPublish : Allow user to set Publish -func (_options *CreateObjectOptions) SetPublish(publish *PublishObject) *CreateObjectOptions { - _options.Publish = publish - return _options + // Denotes whether approvals have changed. + Changed *bool `json:"changed,omitempty"` } -// SetState : Allow user to set State -func (_options *CreateObjectOptions) SetState(state *State) *CreateObjectOptions { - _options.State = state - return _options -} +// UnmarshalApprovalResult unmarshals an instance of ApprovalResult from the specified map of raw messages. +func UnmarshalApprovalResult(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ApprovalResult) + err = core.UnmarshalPrimitive(m, "shared", &obj.Shared) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ibm", &obj.IBM) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "public", &obj.Public) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "allow_request", &obj.AllowRequest) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "approved", &obj.Approved) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "portal_record", &obj.PortalRecord) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "portal_url", &obj.PortalURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "changed", &obj.Changed) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} -// SetCatalogID : Allow user to set CatalogID -func (_options *CreateObjectOptions) SetCatalogID(catalogID string) *CreateObjectOptions { - _options.CatalogID = core.StringPtr(catalogID) - return _options +// ArchitectureDiagram : An Architecture Diagram. +type ArchitectureDiagram struct { + // Offering Media information. + Diagram *MediaItem `json:"diagram,omitempty"` + + // Description of this diagram. + Description *string `json:"description,omitempty"` + + // A map of translated strings, by language code. + DescriptionI18n map[string]string `json:"description_i18n,omitempty"` } -// SetCatalogName : Allow user to set CatalogName -func (_options *CreateObjectOptions) SetCatalogName(catalogName string) *CreateObjectOptions { - _options.CatalogName = core.StringPtr(catalogName) - return _options +// UnmarshalArchitectureDiagram unmarshals an instance of ArchitectureDiagram from the specified map of raw messages. +func UnmarshalArchitectureDiagram(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ArchitectureDiagram) + err = core.UnmarshalModel(m, "diagram", &obj.Diagram, UnmarshalMediaItem) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "description", &obj.Description) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "description_i18n", &obj.DescriptionI18n) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// SetData : Allow user to set Data -func (_options *CreateObjectOptions) SetData(data map[string]interface{}) *CreateObjectOptions { - _options.Data = data +// ArchiveVersionOptions : The ArchiveVersion options. +type ArchiveVersionOptions struct { + // A dotted value of `catalogID`.`versionID`. + VersionLocID *string `json:"version_loc_id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewArchiveVersionOptions : Instantiate ArchiveVersionOptions +func (*CatalogManagementV1) NewArchiveVersionOptions(versionLocID string) *ArchiveVersionOptions { + return &ArchiveVersionOptions{ + VersionLocID: core.StringPtr(versionLocID), + } +} + +// SetVersionLocID : Allow user to set VersionLocID +func (_options *ArchiveVersionOptions) SetVersionLocID(versionLocID string) *ArchiveVersionOptions { + _options.VersionLocID = core.StringPtr(versionLocID) return _options } // SetHeaders : Allow user to set Headers -func (options *CreateObjectOptions) SetHeaders(param map[string]string) *CreateObjectOptions { +func (options *ArchiveVersionOptions) SetHeaders(param map[string]string) *ArchiveVersionOptions { options.Headers = param return options } -// CreateOfferingInstanceOptions : The CreateOfferingInstance options. -type CreateOfferingInstanceOptions struct { - // IAM Refresh token. - XAuthRefreshToken *string `json:"X-Auth-Refresh-Token" validate:"required"` - - // provisioned instance ID (part of the CRN). +// AuditLog : An audit log which describes a change made to a catalog or associated resource. +type AuditLog struct { + // The identifier of the audit record. ID *string `json:"id,omitempty"` // Cloudant revision. Rev *string `json:"_rev,omitempty"` - // url reference to this object. - URL *string `json:"url,omitempty"` - - // platform CRN for this instance. - CRN *string `json:"crn,omitempty"` - - // the label for this instance. - Label *string `json:"label,omitempty"` - - // Catalog ID this instance was created from. - CatalogID *string `json:"catalog_id,omitempty"` - - // Offering ID this instance was created from. - OfferingID *string `json:"offering_id,omitempty"` - - // the format this instance has (helm, operator, ova...). - KindFormat *string `json:"kind_format,omitempty"` + // The time at which the change was made. + Created *strfmt.DateTime `json:"created,omitempty"` - // The version this instance was installed from (not version id). - Version *string `json:"version,omitempty"` + // The type of change described by the audit record. + ChangeType *string `json:"change_type,omitempty"` - // Cluster ID. - ClusterID *string `json:"cluster_id,omitempty"` + // The resource type associated with the change. + TargetType *string `json:"target_type,omitempty"` - // Cluster region (e.g., us-south). - ClusterRegion *string `json:"cluster_region,omitempty"` + // The identifier of the resource that was changed. + TargetID *string `json:"target_id,omitempty"` - // List of target namespaces to install into. - ClusterNamespaces []string `json:"cluster_namespaces,omitempty"` + // The email address of the user that made the change. + WhoEmail *string `json:"who_email,omitempty"` - // designate to install into all namespaces. - ClusterAllNamespaces *bool `json:"cluster_all_namespaces,omitempty"` + // The email address of the delegate user that made the change. This happens when a service makes a change onbehalf of + // the user. + WhoDelegateEmail *string `json:"who_delegate_email,omitempty"` - // Id of the schematics workspace, for offering instances provisioned through schematics. - SchematicsWorkspaceID *string `json:"schematics_workspace_id,omitempty"` + // A message which describes the change. + Message *string `json:"message,omitempty"` - // Id of the resource group to provision the offering instance into. - ResourceGroupID *string `json:"resource_group_id,omitempty"` + // Transaction id for this change. + Gid *string `json:"gid,omitempty"` - // Type of install plan (also known as approval strategy) for operator subscriptions. Can be either automatic, which - // automatically upgrades operators to the latest in a channel, or manual, which requires approval on the cluster. - InstallPlan *string `json:"install_plan,omitempty"` + // IAM identifier of the user who made the change. + WhoID *string `json:"who_id,omitempty"` - // Channel to pin the operator subscription to. - Channel *string `json:"channel,omitempty"` + // Name of the user who made the change. + WhoName *string `json:"who_name,omitempty"` - // Map of metadata values for this offering instance. - Metadata map[string]interface{} `json:"metadata,omitempty"` + // IAM identifier of the delegate user who made the change. + WhoDelegateID *string `json:"who_delegate_id,omitempty"` - // the last operation performed and status. - LastOperation *OfferingInstanceLastOperation `json:"last_operation,omitempty"` + // Name of the delegate user who made the change. + WhoDelegateName *string `json:"who_delegate_name,omitempty"` - // Allows users to set headers on API requests - Headers map[string]string + // Data about the change. Usually a change log of what was changed, both before and after. Can be of any type. + Data interface{} `json:"data,omitempty"` } -// NewCreateOfferingInstanceOptions : Instantiate CreateOfferingInstanceOptions -func (*CatalogManagementV1) NewCreateOfferingInstanceOptions(xAuthRefreshToken string) *CreateOfferingInstanceOptions { - return &CreateOfferingInstanceOptions{ - XAuthRefreshToken: core.StringPtr(xAuthRefreshToken), +// UnmarshalAuditLog unmarshals an instance of AuditLog from the specified map of raw messages. +func UnmarshalAuditLog(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(AuditLog) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "_rev", &obj.Rev) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created", &obj.Created) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "change_type", &obj.ChangeType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "target_type", &obj.TargetType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "target_id", &obj.TargetID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "who_email", &obj.WhoEmail) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "who_delegate_email", &obj.WhoDelegateEmail) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "gid", &obj.Gid) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "who_id", &obj.WhoID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "who_name", &obj.WhoName) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "who_delegate_id", &obj.WhoDelegateID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "who_delegate_name", &obj.WhoDelegateName) + if err != nil { + return } + err = core.UnmarshalPrimitive(m, "data", &obj.Data) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// SetXAuthRefreshToken : Allow user to set XAuthRefreshToken -func (_options *CreateOfferingInstanceOptions) SetXAuthRefreshToken(xAuthRefreshToken string) *CreateOfferingInstanceOptions { - _options.XAuthRefreshToken = core.StringPtr(xAuthRefreshToken) - return _options -} +// AuditLogDigest : An reduced audit log which describes a change made to a catalog or associated resource. +type AuditLogDigest struct { + // The identifier of the audit record. + ID *string `json:"id,omitempty"` -// SetID : Allow user to set ID -func (_options *CreateOfferingInstanceOptions) SetID(id string) *CreateOfferingInstanceOptions { - _options.ID = core.StringPtr(id) - return _options -} + // Cloudant revision. + Rev *string `json:"_rev,omitempty"` -// SetRev : Allow user to set Rev -func (_options *CreateOfferingInstanceOptions) SetRev(rev string) *CreateOfferingInstanceOptions { - _options.Rev = core.StringPtr(rev) - return _options -} + // The time at which the change was made. + Created *strfmt.DateTime `json:"created,omitempty"` -// SetURL : Allow user to set URL -func (_options *CreateOfferingInstanceOptions) SetURL(url string) *CreateOfferingInstanceOptions { - _options.URL = core.StringPtr(url) - return _options -} + // The type of change described by the audit record. + ChangeType *string `json:"change_type,omitempty"` -// SetCRN : Allow user to set CRN -func (_options *CreateOfferingInstanceOptions) SetCRN(crn string) *CreateOfferingInstanceOptions { - _options.CRN = core.StringPtr(crn) - return _options -} + // The resource type associated with the change. + TargetType *string `json:"target_type,omitempty"` -// SetLabel : Allow user to set Label -func (_options *CreateOfferingInstanceOptions) SetLabel(label string) *CreateOfferingInstanceOptions { - _options.Label = core.StringPtr(label) - return _options -} + // The identifier of the resource that was changed. + TargetID *string `json:"target_id,omitempty"` -// SetCatalogID : Allow user to set CatalogID -func (_options *CreateOfferingInstanceOptions) SetCatalogID(catalogID string) *CreateOfferingInstanceOptions { - _options.CatalogID = core.StringPtr(catalogID) - return _options -} + // The email address of the user that made the change. + WhoEmail *string `json:"who_email,omitempty"` -// SetOfferingID : Allow user to set OfferingID -func (_options *CreateOfferingInstanceOptions) SetOfferingID(offeringID string) *CreateOfferingInstanceOptions { - _options.OfferingID = core.StringPtr(offeringID) - return _options + // The email address of the delegate user that made the change. This happens when a service makes a change onbehalf of + // the user. + WhoDelegateEmail *string `json:"who_delegate_email,omitempty"` + + // A message which describes the change. + Message *string `json:"message,omitempty"` } -// SetKindFormat : Allow user to set KindFormat -func (_options *CreateOfferingInstanceOptions) SetKindFormat(kindFormat string) *CreateOfferingInstanceOptions { - _options.KindFormat = core.StringPtr(kindFormat) - return _options +// UnmarshalAuditLogDigest unmarshals an instance of AuditLogDigest from the specified map of raw messages. +func UnmarshalAuditLogDigest(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(AuditLogDigest) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "_rev", &obj.Rev) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created", &obj.Created) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "change_type", &obj.ChangeType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "target_type", &obj.TargetType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "target_id", &obj.TargetID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "who_email", &obj.WhoEmail) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "who_delegate_email", &obj.WhoDelegateEmail) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// SetVersion : Allow user to set Version -func (_options *CreateOfferingInstanceOptions) SetVersion(version string) *CreateOfferingInstanceOptions { - _options.Version = core.StringPtr(version) - return _options -} +// AuditLogs : A collection of audit records. +type AuditLogs struct { + // The start token used for this response. + Start *string `json:"start,omitempty"` -// SetClusterID : Allow user to set ClusterID -func (_options *CreateOfferingInstanceOptions) SetClusterID(clusterID string) *CreateOfferingInstanceOptions { - _options.ClusterID = core.StringPtr(clusterID) - return _options -} + // The limit that was applied to this response. It may be smaller than in the request because that was too large. + Limit *int64 `json:"limit" validate:"required"` -// SetClusterRegion : Allow user to set ClusterRegion -func (_options *CreateOfferingInstanceOptions) SetClusterRegion(clusterRegion string) *CreateOfferingInstanceOptions { - _options.ClusterRegion = core.StringPtr(clusterRegion) - return _options -} + // The total count of resources in the system that matches the request. + TotalCount *int64 `json:"total_count,omitempty"` -// SetClusterNamespaces : Allow user to set ClusterNamespaces -func (_options *CreateOfferingInstanceOptions) SetClusterNamespaces(clusterNamespaces []string) *CreateOfferingInstanceOptions { - _options.ClusterNamespaces = clusterNamespaces - return _options -} + // The number of resources returned in this response. + ResourceCount *int64 `json:"resource_count" validate:"required"` -// SetClusterAllNamespaces : Allow user to set ClusterAllNamespaces -func (_options *CreateOfferingInstanceOptions) SetClusterAllNamespaces(clusterAllNamespaces bool) *CreateOfferingInstanceOptions { - _options.ClusterAllNamespaces = core.BoolPtr(clusterAllNamespaces) - return _options -} + // Link response on a token paginated query. + First *PaginationTokenLink `json:"first" validate:"required"` -// SetSchematicsWorkspaceID : Allow user to set SchematicsWorkspaceID -func (_options *CreateOfferingInstanceOptions) SetSchematicsWorkspaceID(schematicsWorkspaceID string) *CreateOfferingInstanceOptions { - _options.SchematicsWorkspaceID = core.StringPtr(schematicsWorkspaceID) - return _options -} + // Link response on a token paginated query. + Next *PaginationTokenLink `json:"next,omitempty"` -// SetResourceGroupID : Allow user to set ResourceGroupID -func (_options *CreateOfferingInstanceOptions) SetResourceGroupID(resourceGroupID string) *CreateOfferingInstanceOptions { - _options.ResourceGroupID = core.StringPtr(resourceGroupID) - return _options -} + // Link response on a token paginated query. + Prev *PaginationTokenLink `json:"prev,omitempty"` -// SetInstallPlan : Allow user to set InstallPlan -func (_options *CreateOfferingInstanceOptions) SetInstallPlan(installPlan string) *CreateOfferingInstanceOptions { - _options.InstallPlan = core.StringPtr(installPlan) - return _options -} + // Link response on a token paginated query. + Last *PaginationTokenLink `json:"last,omitempty"` -// SetChannel : Allow user to set Channel -func (_options *CreateOfferingInstanceOptions) SetChannel(channel string) *CreateOfferingInstanceOptions { - _options.Channel = core.StringPtr(channel) - return _options + // A list of audit records. + Audits []AuditLogDigest `json:"audits" validate:"required"` } -// SetMetadata : Allow user to set Metadata -func (_options *CreateOfferingInstanceOptions) SetMetadata(metadata map[string]interface{}) *CreateOfferingInstanceOptions { - _options.Metadata = metadata - return _options +// UnmarshalAuditLogs unmarshals an instance of AuditLogs from the specified map of raw messages. +func UnmarshalAuditLogs(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(AuditLogs) + err = core.UnmarshalPrimitive(m, "start", &obj.Start) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_count", &obj.ResourceCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPaginationTokenLink) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPaginationTokenLink) + if err != nil { + return + } + err = core.UnmarshalModel(m, "prev", &obj.Prev, UnmarshalPaginationTokenLink) + if err != nil { + return + } + err = core.UnmarshalModel(m, "last", &obj.Last, UnmarshalPaginationTokenLink) + if err != nil { + return + } + err = core.UnmarshalModel(m, "audits", &obj.Audits, UnmarshalAuditLogDigest) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// SetLastOperation : Allow user to set LastOperation -func (_options *CreateOfferingInstanceOptions) SetLastOperation(lastOperation *OfferingInstanceLastOperation) *CreateOfferingInstanceOptions { - _options.LastOperation = lastOperation - return _options +// Retrieve the value to be passed to a request to access the next page of results +func (resp *AuditLogs) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + return resp.Next.Start, nil } -// SetHeaders : Allow user to set Headers -func (options *CreateOfferingInstanceOptions) SetHeaders(param map[string]string) *CreateOfferingInstanceOptions { - options.Headers = param - return options +// Badge : Badge information. +type Badge struct { + // ID of the current badge. + ID *string `json:"id,omitempty"` + + // Display name for the current badge. + Label *string `json:"label,omitempty"` + + // A map of translated strings, by language code. + LabelI18n map[string]string `json:"label_i18n,omitempty"` + + // Description of the current badge. + Description *string `json:"description,omitempty"` + + // A map of translated strings, by language code. + DescriptionI18n map[string]string `json:"description_i18n,omitempty"` + + // Icon for the current badge. + Icon *string `json:"icon,omitempty"` + + // Authority for the current badge. + Authority *string `json:"authority,omitempty"` + + // Tag for the current badge. + Tag *string `json:"tag,omitempty"` + + // Learn more links for a badge. + LearnMoreLinks *LearnMoreLinks `json:"learn_more_links,omitempty"` + + // An optional set of constraints indicating which versions in an Offering have this particular badge. + Constraints []Constraint `json:"constraints,omitempty"` } -// CreateOfferingOptions : The CreateOffering options. -type CreateOfferingOptions struct { - // Catalog identifier. - CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` +// UnmarshalBadge unmarshals an instance of Badge from the specified map of raw messages. +func UnmarshalBadge(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Badge) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "label", &obj.Label) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "label_i18n", &obj.LabelI18n) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "description", &obj.Description) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "description_i18n", &obj.DescriptionI18n) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "icon", &obj.Icon) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "authority", &obj.Authority) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "tag", &obj.Tag) + if err != nil { + return + } + err = core.UnmarshalModel(m, "learn_more_links", &obj.LearnMoreLinks, UnmarshalLearnMoreLinks) + if err != nil { + return + } + err = core.UnmarshalModel(m, "constraints", &obj.Constraints, UnmarshalConstraint) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} - // unique id. +// Catalog : Catalog information. +type Catalog struct { + // Unique ID. ID *string `json:"id,omitempty"` // Cloudant revision. Rev *string `json:"_rev,omitempty"` - // The url for this specific offering. - URL *string `json:"url,omitempty"` - - // The crn for this specific offering. - CRN *string `json:"crn,omitempty"` - // Display Name in the requested language. Label *string `json:"label,omitempty"` - // The programmatic name of this offering. - Name *string `json:"name,omitempty"` + // A map of translated strings, by language code. + LabelI18n map[string]string `json:"label_i18n,omitempty"` - // URL for an icon associated with this offering. - OfferingIconURL *string `json:"offering_icon_url,omitempty"` + // Description in the requested language. + ShortDescription *string `json:"short_description,omitempty"` - // URL for an additional docs with this offering. - OfferingDocsURL *string `json:"offering_docs_url,omitempty"` + // A map of translated strings, by language code. + ShortDescriptionI18n map[string]string `json:"short_description_i18n,omitempty"` - // [deprecated] - Use offering.support instead. URL to be displayed in the Consumption UI for getting support on this - // offering. - OfferingSupportURL *string `json:"offering_support_url,omitempty"` + // URL for an icon associated with this catalog. + CatalogIconURL *string `json:"catalog_icon_url,omitempty"` // List of tags associated with this catalog. Tags []string `json:"tags,omitempty"` - // List of keywords associated with offering, typically used to search for it. - Keywords []string `json:"keywords,omitempty"` + // The url for this specific catalog. + URL *string `json:"url,omitempty"` - // Repository info for offerings. - Rating *Rating `json:"rating,omitempty"` + // CRN associated with the catalog. + CRN *string `json:"crn,omitempty"` - // The date and time this catalog was created. - Created *strfmt.DateTime `json:"created,omitempty"` + // URL path to offerings. + OfferingsURL *string `json:"offerings_url,omitempty"` - // The date and time this catalog was last updated. - Updated *strfmt.DateTime `json:"updated,omitempty"` + // List of features associated with this catalog. + Features []Feature `json:"features,omitempty"` - // Short description in the requested language. - ShortDescription *string `json:"short_description,omitempty"` + // Denotes whether a catalog is disabled. + Disabled *bool `json:"disabled,omitempty"` - // Long description in the requested language. - LongDescription *string `json:"long_description,omitempty"` + // The date-time this catalog was created. + Created *strfmt.DateTime `json:"created,omitempty"` - // list of features associated with this offering. - Features []Feature `json:"features,omitempty"` + // The date-time this catalog was last updated. + Updated *strfmt.DateTime `json:"updated,omitempty"` - // Array of kind. - Kinds []Kind `json:"kinds,omitempty"` + // Resource group id the catalog is owned by. + ResourceGroupID *string `json:"resource_group_id,omitempty"` - // Is it permitted to request publishing to IBM or Public. - PermitRequestIBMPublicPublish *bool `json:"permit_request_ibm_public_publish,omitempty"` + // Account that owns catalog. + OwningAccount *string `json:"owning_account,omitempty"` - // Indicates if this offering has been approved for use by all IBMers. - IBMPublishApproved *bool `json:"ibm_publish_approved,omitempty"` + // Filters for account and catalog filters. + CatalogFilters *Filters `json:"catalog_filters,omitempty"` - // Indicates if this offering has been approved for use by all IBM Cloud users. - PublicPublishApproved *bool `json:"public_publish_approved,omitempty"` + // Feature information. + SyndicationSettings *SyndicationResource `json:"syndication_settings,omitempty"` - // The original offering CRN that this publish entry came from. - PublicOriginalCRN *string `json:"public_original_crn,omitempty"` + // Kind of catalog. Supported kinds are offering and vpe. + Kind *string `json:"kind,omitempty"` - // The crn of the public catalog entry of this offering. - PublishPublicCRN *string `json:"publish_public_crn,omitempty"` - - // The portal's approval record ID. - PortalApprovalRecord *string `json:"portal_approval_record,omitempty"` - - // The portal UI URL. - PortalUIURL *string `json:"portal_ui_url,omitempty"` - - // The id of the catalog containing this offering. - CatalogID *string `json:"catalog_id,omitempty"` - - // The name of the catalog. - CatalogName *string `json:"catalog_name,omitempty"` - - // Map of metadata values for this offering. + // Catalog specific metadata. Metadata map[string]interface{} `json:"metadata,omitempty"` - - // A disclaimer for this offering. - Disclaimer *string `json:"disclaimer,omitempty"` - - // Determine if this offering should be displayed in the Consumption UI. - Hidden *bool `json:"hidden,omitempty"` - - // Deprecated - Provider of this offering. - Provider *string `json:"provider,omitempty"` - - // Information on the provider for this offering, or omitted if no provider information is given. - ProviderInfo *ProviderInfo `json:"provider_info,omitempty"` - - // Repository info for offerings. - RepoInfo *RepoInfo `json:"repo_info,omitempty"` - - // Offering Support information. - Support *Support `json:"support,omitempty"` - - // A list of media items related to this offering. - Media []MediaItem `json:"media,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string } -// NewCreateOfferingOptions : Instantiate CreateOfferingOptions -func (*CatalogManagementV1) NewCreateOfferingOptions(catalogIdentifier string) *CreateOfferingOptions { - return &CreateOfferingOptions{ - CatalogIdentifier: core.StringPtr(catalogIdentifier), +// UnmarshalCatalog unmarshals an instance of Catalog from the specified map of raw messages. +func UnmarshalCatalog(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Catalog) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "_rev", &obj.Rev) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "label", &obj.Label) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "label_i18n", &obj.LabelI18n) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "short_description", &obj.ShortDescription) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "short_description_i18n", &obj.ShortDescriptionI18n) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "catalog_icon_url", &obj.CatalogIconURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "url", &obj.URL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "offerings_url", &obj.OfferingsURL) + if err != nil { + return + } + err = core.UnmarshalModel(m, "features", &obj.Features, UnmarshalFeature) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "disabled", &obj.Disabled) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created", &obj.Created) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated", &obj.Updated) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_group_id", &obj.ResourceGroupID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "owning_account", &obj.OwningAccount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "catalog_filters", &obj.CatalogFilters, UnmarshalFilters) + if err != nil { + return + } + err = core.UnmarshalModel(m, "syndication_settings", &obj.SyndicationSettings, UnmarshalSyndicationResource) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "kind", &obj.Kind) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "metadata", &obj.Metadata) + if err != nil { + return } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// SetCatalogIdentifier : Allow user to set CatalogIdentifier -func (_options *CreateOfferingOptions) SetCatalogIdentifier(catalogIdentifier string) *CreateOfferingOptions { - _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) - return _options -} +// CatalogObject : object information. +type CatalogObject struct { + // unique id. + ID *string `json:"id,omitempty"` -// SetID : Allow user to set ID -func (_options *CreateOfferingOptions) SetID(id string) *CreateOfferingOptions { - _options.ID = core.StringPtr(id) - return _options -} + // The programmatic name of this object. + Name *string `json:"name,omitempty"` -// SetRev : Allow user to set Rev -func (_options *CreateOfferingOptions) SetRev(rev string) *CreateOfferingOptions { - _options.Rev = core.StringPtr(rev) - return _options -} + // Cloudant revision. + Rev *string `json:"_rev,omitempty"` -// SetURL : Allow user to set URL -func (_options *CreateOfferingOptions) SetURL(url string) *CreateOfferingOptions { - _options.URL = core.StringPtr(url) - return _options -} + // The crn for this specific object. + CRN *string `json:"crn,omitempty"` -// SetCRN : Allow user to set CRN -func (_options *CreateOfferingOptions) SetCRN(crn string) *CreateOfferingOptions { - _options.CRN = core.StringPtr(crn) - return _options -} + // The url for this specific object. + URL *string `json:"url,omitempty"` -// SetLabel : Allow user to set Label -func (_options *CreateOfferingOptions) SetLabel(label string) *CreateOfferingOptions { - _options.Label = core.StringPtr(label) - return _options -} + // The parent for this specific object. + ParentID *string `json:"parent_id,omitempty"` -// SetName : Allow user to set Name -func (_options *CreateOfferingOptions) SetName(name string) *CreateOfferingOptions { - _options.Name = core.StringPtr(name) - return _options -} + // A map of translated strings, by language code. + LabelI18n map[string]string `json:"label_i18n,omitempty"` -// SetOfferingIconURL : Allow user to set OfferingIconURL -func (_options *CreateOfferingOptions) SetOfferingIconURL(offeringIconURL string) *CreateOfferingOptions { - _options.OfferingIconURL = core.StringPtr(offeringIconURL) - return _options -} + // Display name in the requested language. + Label *string `json:"label,omitempty"` -// SetOfferingDocsURL : Allow user to set OfferingDocsURL -func (_options *CreateOfferingOptions) SetOfferingDocsURL(offeringDocsURL string) *CreateOfferingOptions { - _options.OfferingDocsURL = core.StringPtr(offeringDocsURL) - return _options -} + // List of tags associated with this catalog. + Tags []string `json:"tags,omitempty"` -// SetOfferingSupportURL : Allow user to set OfferingSupportURL -func (_options *CreateOfferingOptions) SetOfferingSupportURL(offeringSupportURL string) *CreateOfferingOptions { - _options.OfferingSupportURL = core.StringPtr(offeringSupportURL) - return _options -} + // The date and time this catalog was created. + Created *strfmt.DateTime `json:"created,omitempty"` -// SetTags : Allow user to set Tags -func (_options *CreateOfferingOptions) SetTags(tags []string) *CreateOfferingOptions { - _options.Tags = tags - return _options -} + // The date and time this catalog was last updated. + Updated *strfmt.DateTime `json:"updated,omitempty"` -// SetKeywords : Allow user to set Keywords -func (_options *CreateOfferingOptions) SetKeywords(keywords []string) *CreateOfferingOptions { - _options.Keywords = keywords - return _options -} + // Short description in the requested language. + ShortDescription *string `json:"short_description,omitempty"` -// SetRating : Allow user to set Rating -func (_options *CreateOfferingOptions) SetRating(rating *Rating) *CreateOfferingOptions { - _options.Rating = rating - return _options -} + // A map of translated strings, by language code. + ShortDescriptionI18n map[string]string `json:"short_description_i18n,omitempty"` -// SetCreated : Allow user to set Created -func (_options *CreateOfferingOptions) SetCreated(created *strfmt.DateTime) *CreateOfferingOptions { - _options.Created = created - return _options -} + // Kind of object. + Kind *string `json:"kind,omitempty"` -// SetUpdated : Allow user to set Updated -func (_options *CreateOfferingOptions) SetUpdated(updated *strfmt.DateTime) *CreateOfferingOptions { - _options.Updated = updated - return _options -} + // Publish information. + Publish *PublishObject `json:"publish,omitempty"` -// SetShortDescription : Allow user to set ShortDescription -func (_options *CreateOfferingOptions) SetShortDescription(shortDescription string) *CreateOfferingOptions { - _options.ShortDescription = core.StringPtr(shortDescription) - return _options -} + // Offering state. + State *State `json:"state,omitempty"` -// SetLongDescription : Allow user to set LongDescription -func (_options *CreateOfferingOptions) SetLongDescription(longDescription string) *CreateOfferingOptions { - _options.LongDescription = core.StringPtr(longDescription) - return _options -} + // The id of the catalog containing this offering. + CatalogID *string `json:"catalog_id,omitempty"` -// SetFeatures : Allow user to set Features -func (_options *CreateOfferingOptions) SetFeatures(features []Feature) *CreateOfferingOptions { - _options.Features = features - return _options + // The name of the catalog. + CatalogName *string `json:"catalog_name,omitempty"` + + // Map of data values for this object. + Data map[string]interface{} `json:"data,omitempty"` } -// SetKinds : Allow user to set Kinds -func (_options *CreateOfferingOptions) SetKinds(kinds []Kind) *CreateOfferingOptions { - _options.Kinds = kinds - return _options +// UnmarshalCatalogObject unmarshals an instance of CatalogObject from the specified map of raw messages. +func UnmarshalCatalogObject(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CatalogObject) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "_rev", &obj.Rev) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "url", &obj.URL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "parent_id", &obj.ParentID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "label_i18n", &obj.LabelI18n) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "label", &obj.Label) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created", &obj.Created) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated", &obj.Updated) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "short_description", &obj.ShortDescription) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "short_description_i18n", &obj.ShortDescriptionI18n) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "kind", &obj.Kind) + if err != nil { + return + } + err = core.UnmarshalModel(m, "publish", &obj.Publish, UnmarshalPublishObject) + if err != nil { + return + } + err = core.UnmarshalModel(m, "state", &obj.State, UnmarshalState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "catalog_id", &obj.CatalogID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "catalog_name", &obj.CatalogName) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "data", &obj.Data) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// SetPermitRequestIBMPublicPublish : Allow user to set PermitRequestIBMPublicPublish -func (_options *CreateOfferingOptions) SetPermitRequestIBMPublicPublish(permitRequestIBMPublicPublish bool) *CreateOfferingOptions { - _options.PermitRequestIBMPublicPublish = core.BoolPtr(permitRequestIBMPublicPublish) - return _options -} +// CatalogSearchResult : Paginated catalog search result. +type CatalogSearchResult struct { + // The overall total number of resources in the search result set. + TotalCount *int64 `json:"total_count,omitempty"` -// SetIBMPublishApproved : Allow user to set IBMPublishApproved -func (_options *CreateOfferingOptions) SetIBMPublishApproved(ibmPublishApproved bool) *CreateOfferingOptions { - _options.IBMPublishApproved = core.BoolPtr(ibmPublishApproved) - return _options + // Resulting objects. + Resources []Catalog `json:"resources,omitempty"` } -// SetPublicPublishApproved : Allow user to set PublicPublishApproved -func (_options *CreateOfferingOptions) SetPublicPublishApproved(publicPublishApproved bool) *CreateOfferingOptions { - _options.PublicPublishApproved = core.BoolPtr(publicPublishApproved) - return _options +// UnmarshalCatalogSearchResult unmarshals an instance of CatalogSearchResult from the specified map of raw messages. +func UnmarshalCatalogSearchResult(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CatalogSearchResult) + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resources", &obj.Resources, UnmarshalCatalog) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// SetPublicOriginalCRN : Allow user to set PublicOriginalCRN -func (_options *CreateOfferingOptions) SetPublicOriginalCRN(publicOriginalCRN string) *CreateOfferingOptions { - _options.PublicOriginalCRN = core.StringPtr(publicOriginalCRN) - return _options -} +// CategoryFilter : Filter on a category. The filter will match against the values of the given category with include or exclude. +type CategoryFilter struct { + // -> true - This is an include filter, false - this is an exclude filter. + Include *bool `json:"include,omitempty"` -// SetPublishPublicCRN : Allow user to set PublishPublicCRN -func (_options *CreateOfferingOptions) SetPublishPublicCRN(publishPublicCRN string) *CreateOfferingOptions { - _options.PublishPublicCRN = core.StringPtr(publishPublicCRN) - return _options + // Offering filter terms. + Filter *FilterTerms `json:"filter,omitempty"` } -// SetPortalApprovalRecord : Allow user to set PortalApprovalRecord -func (_options *CreateOfferingOptions) SetPortalApprovalRecord(portalApprovalRecord string) *CreateOfferingOptions { - _options.PortalApprovalRecord = core.StringPtr(portalApprovalRecord) - return _options +// UnmarshalCategoryFilter unmarshals an instance of CategoryFilter from the specified map of raw messages. +func UnmarshalCategoryFilter(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CategoryFilter) + err = core.UnmarshalPrimitive(m, "include", &obj.Include) + if err != nil { + return + } + err = core.UnmarshalModel(m, "filter", &obj.Filter, UnmarshalFilterTerms) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// SetPortalUIURL : Allow user to set PortalUIURL -func (_options *CreateOfferingOptions) SetPortalUIURL(portalUIURL string) *CreateOfferingOptions { - _options.PortalUIURL = core.StringPtr(portalUIURL) - return _options -} +// ClusterInfo : Cluster information. +type ClusterInfo struct { + // Resource Group ID. + ResourceGroupID *string `json:"resource_group_id,omitempty"` -// SetCatalogID : Allow user to set CatalogID -func (_options *CreateOfferingOptions) SetCatalogID(catalogID string) *CreateOfferingOptions { - _options.CatalogID = core.StringPtr(catalogID) - return _options -} + // Resource Group name. + ResourceGroupName *string `json:"resource_group_name,omitempty"` -// SetCatalogName : Allow user to set CatalogName -func (_options *CreateOfferingOptions) SetCatalogName(catalogName string) *CreateOfferingOptions { - _options.CatalogName = core.StringPtr(catalogName) - return _options -} + // Cluster ID. + ID *string `json:"id,omitempty"` -// SetMetadata : Allow user to set Metadata -func (_options *CreateOfferingOptions) SetMetadata(metadata map[string]interface{}) *CreateOfferingOptions { - _options.Metadata = metadata - return _options -} + // Cluster name. + Name *string `json:"name,omitempty"` -// SetDisclaimer : Allow user to set Disclaimer -func (_options *CreateOfferingOptions) SetDisclaimer(disclaimer string) *CreateOfferingOptions { - _options.Disclaimer = core.StringPtr(disclaimer) - return _options + // Cluster region. + Region *string `json:"region,omitempty"` + + // Cluster Ingress hostname. + IngressHostname *string `json:"ingress_hostname,omitempty"` + + // Cluster provider. + Provider *string `json:"provider,omitempty"` + + // Cluster status. + Status *string `json:"status,omitempty"` } -// SetHidden : Allow user to set Hidden -func (_options *CreateOfferingOptions) SetHidden(hidden bool) *CreateOfferingOptions { - _options.Hidden = core.BoolPtr(hidden) - return _options +// UnmarshalClusterInfo unmarshals an instance of ClusterInfo from the specified map of raw messages. +func UnmarshalClusterInfo(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ClusterInfo) + err = core.UnmarshalPrimitive(m, "resource_group_id", &obj.ResourceGroupID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_group_name", &obj.ResourceGroupName) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "region", &obj.Region) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ingress_hostname", &obj.IngressHostname) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "provider", &obj.Provider) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// SetProvider : Allow user to set Provider -func (_options *CreateOfferingOptions) SetProvider(provider string) *CreateOfferingOptions { - _options.Provider = core.StringPtr(provider) - return _options +// CommitVersionOptions : The CommitVersion options. +type CommitVersionOptions struct { + // A dotted value of `catalogID`.`versionID`. + VersionLocID *string `json:"version_loc_id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string } -// SetProviderInfo : Allow user to set ProviderInfo -func (_options *CreateOfferingOptions) SetProviderInfo(providerInfo *ProviderInfo) *CreateOfferingOptions { - _options.ProviderInfo = providerInfo - return _options +// NewCommitVersionOptions : Instantiate CommitVersionOptions +func (*CatalogManagementV1) NewCommitVersionOptions(versionLocID string) *CommitVersionOptions { + return &CommitVersionOptions{ + VersionLocID: core.StringPtr(versionLocID), + } } -// SetRepoInfo : Allow user to set RepoInfo -func (_options *CreateOfferingOptions) SetRepoInfo(repoInfo *RepoInfo) *CreateOfferingOptions { - _options.RepoInfo = repoInfo - return _options -} - -// SetSupport : Allow user to set Support -func (_options *CreateOfferingOptions) SetSupport(support *Support) *CreateOfferingOptions { - _options.Support = support - return _options -} - -// SetMedia : Allow user to set Media -func (_options *CreateOfferingOptions) SetMedia(media []MediaItem) *CreateOfferingOptions { - _options.Media = media +// SetVersionLocID : Allow user to set VersionLocID +func (_options *CommitVersionOptions) SetVersionLocID(versionLocID string) *CommitVersionOptions { + _options.VersionLocID = core.StringPtr(versionLocID) return _options } // SetHeaders : Allow user to set Headers -func (options *CreateOfferingOptions) SetHeaders(param map[string]string) *CreateOfferingOptions { +func (options *CommitVersionOptions) SetHeaders(param map[string]string) *CommitVersionOptions { options.Headers = param return options } -// DeleteCatalogOptions : The DeleteCatalog options. -type DeleteCatalogOptions struct { - // Catalog identifier. - CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` +// Configuration : Configuration description. +type Configuration struct { + // Configuration key. + Key *string `json:"key,omitempty"` - // Allows users to set headers on API requests - Headers map[string]string + // Value type (string, boolean, int). + Type *string `json:"type,omitempty"` + + // The default value. To use a secret when the type is password, specify a JSON encoded value of + // $ref:#/components/schemas/SecretInstance, prefixed with `cmsm_v1:`. + DefaultValue interface{} `json:"default_value,omitempty"` + + // Display name for configuration type. + DisplayName *string `json:"display_name,omitempty"` + + // Constraint associated with value, e.g., for string type - regx:[a-z]. + ValueConstraint *string `json:"value_constraint,omitempty"` + + // Key description. + Description *string `json:"description,omitempty"` + + // Is key required to install. + Required *bool `json:"required,omitempty"` + + // List of options of type. + Options []interface{} `json:"options,omitempty"` + + // Hide values. + Hidden *bool `json:"hidden,omitempty"` + + // Render type. + CustomConfig *RenderType `json:"custom_config,omitempty"` + + // The original type, as found in the source being onboarded. + TypeMetadata *string `json:"type_metadata,omitempty"` } -// NewDeleteCatalogOptions : Instantiate DeleteCatalogOptions -func (*CatalogManagementV1) NewDeleteCatalogOptions(catalogIdentifier string) *DeleteCatalogOptions { - return &DeleteCatalogOptions{ - CatalogIdentifier: core.StringPtr(catalogIdentifier), +// UnmarshalConfiguration unmarshals an instance of Configuration from the specified map of raw messages. +func UnmarshalConfiguration(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Configuration) + err = core.UnmarshalPrimitive(m, "key", &obj.Key) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default_value", &obj.DefaultValue) + if err != nil { + return } + err = core.UnmarshalPrimitive(m, "display_name", &obj.DisplayName) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value_constraint", &obj.ValueConstraint) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "description", &obj.Description) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "required", &obj.Required) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "options", &obj.Options) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "hidden", &obj.Hidden) + if err != nil { + return + } + err = core.UnmarshalModel(m, "custom_config", &obj.CustomConfig, UnmarshalRenderType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type_metadata", &obj.TypeMetadata) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// SetCatalogIdentifier : Allow user to set CatalogIdentifier -func (_options *DeleteCatalogOptions) SetCatalogIdentifier(catalogIdentifier string) *DeleteCatalogOptions { - _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) - return _options +// Constraint : Constraint information. +type Constraint struct { + // Type of the current constraint. + Type *string `json:"type,omitempty"` + + // Rule for the current constraint. + Rule interface{} `json:"rule,omitempty"` } -// SetHeaders : Allow user to set Headers -func (options *DeleteCatalogOptions) SetHeaders(param map[string]string) *DeleteCatalogOptions { - options.Headers = param - return options +// UnmarshalConstraint unmarshals an instance of Constraint from the specified map of raw messages. +func UnmarshalConstraint(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Constraint) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "rule", &obj.Rule) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// DeleteObjectAccessListOptions : The DeleteObjectAccessList options. -type DeleteObjectAccessListOptions struct { +// ConsumableShareObjectOptions : The ConsumableShareObject options. +type ConsumableShareObjectOptions struct { // Catalog identifier. CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` // Object identifier. ObjectIdentifier *string `json:"object_identifier" validate:"required,ne="` - // A list of accounts to delete. An entry with star["*"] will remove all accounts. - Accounts []string `json:"accounts" validate:"required"` - // Allows users to set headers on API requests Headers map[string]string } -// NewDeleteObjectAccessListOptions : Instantiate DeleteObjectAccessListOptions -func (*CatalogManagementV1) NewDeleteObjectAccessListOptions(catalogIdentifier string, objectIdentifier string, accounts []string) *DeleteObjectAccessListOptions { - return &DeleteObjectAccessListOptions{ +// NewConsumableShareObjectOptions : Instantiate ConsumableShareObjectOptions +func (*CatalogManagementV1) NewConsumableShareObjectOptions(catalogIdentifier string, objectIdentifier string) *ConsumableShareObjectOptions { + return &ConsumableShareObjectOptions{ CatalogIdentifier: core.StringPtr(catalogIdentifier), ObjectIdentifier: core.StringPtr(objectIdentifier), - Accounts: accounts, } } // SetCatalogIdentifier : Allow user to set CatalogIdentifier -func (_options *DeleteObjectAccessListOptions) SetCatalogIdentifier(catalogIdentifier string) *DeleteObjectAccessListOptions { +func (_options *ConsumableShareObjectOptions) SetCatalogIdentifier(catalogIdentifier string) *ConsumableShareObjectOptions { _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) return _options } // SetObjectIdentifier : Allow user to set ObjectIdentifier -func (_options *DeleteObjectAccessListOptions) SetObjectIdentifier(objectIdentifier string) *DeleteObjectAccessListOptions { +func (_options *ConsumableShareObjectOptions) SetObjectIdentifier(objectIdentifier string) *ConsumableShareObjectOptions { _options.ObjectIdentifier = core.StringPtr(objectIdentifier) return _options } -// SetAccounts : Allow user to set Accounts -func (_options *DeleteObjectAccessListOptions) SetAccounts(accounts []string) *DeleteObjectAccessListOptions { - _options.Accounts = accounts +// SetHeaders : Allow user to set Headers +func (options *ConsumableShareObjectOptions) SetHeaders(param map[string]string) *ConsumableShareObjectOptions { + options.Headers = param + return options +} + +// ConsumableVersionOptions : The ConsumableVersion options. +type ConsumableVersionOptions struct { + // A dotted value of `catalogID`.`versionID`. + VersionLocID *string `json:"version_loc_id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewConsumableVersionOptions : Instantiate ConsumableVersionOptions +func (*CatalogManagementV1) NewConsumableVersionOptions(versionLocID string) *ConsumableVersionOptions { + return &ConsumableVersionOptions{ + VersionLocID: core.StringPtr(versionLocID), + } +} + +// SetVersionLocID : Allow user to set VersionLocID +func (_options *ConsumableVersionOptions) SetVersionLocID(versionLocID string) *ConsumableVersionOptions { + _options.VersionLocID = core.StringPtr(versionLocID) return _options } // SetHeaders : Allow user to set Headers -func (options *DeleteObjectAccessListOptions) SetHeaders(param map[string]string) *DeleteObjectAccessListOptions { +func (options *ConsumableVersionOptions) SetHeaders(param map[string]string) *ConsumableVersionOptions { options.Headers = param return options } -// DeleteObjectAccessOptions : The DeleteObjectAccess options. -type DeleteObjectAccessOptions struct { - // Catalog identifier. - CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` +// CopyFromPreviousVersionOptions : The CopyFromPreviousVersion options. +type CopyFromPreviousVersionOptions struct { + // A dotted value of `catalogID`.`versionID`. + VersionLocID *string `json:"version_loc_id" validate:"required,ne="` - // Object identifier. - ObjectIdentifier *string `json:"object_identifier" validate:"required,ne="` + // The type of data you would like to copy from a previous version. Valid values are 'configuration' or 'licenses'. + Type *string `json:"type" validate:"required,ne="` - // Account identifier. - AccountIdentifier *string `json:"account_identifier" validate:"required,ne="` + // The version locator id of the version you wish to copy data from. + VersionLocIDToCopyFrom *string `json:"version_loc_id_to_copy_from" validate:"required,ne="` // Allows users to set headers on API requests Headers map[string]string } -// NewDeleteObjectAccessOptions : Instantiate DeleteObjectAccessOptions -func (*CatalogManagementV1) NewDeleteObjectAccessOptions(catalogIdentifier string, objectIdentifier string, accountIdentifier string) *DeleteObjectAccessOptions { - return &DeleteObjectAccessOptions{ - CatalogIdentifier: core.StringPtr(catalogIdentifier), - ObjectIdentifier: core.StringPtr(objectIdentifier), - AccountIdentifier: core.StringPtr(accountIdentifier), +// NewCopyFromPreviousVersionOptions : Instantiate CopyFromPreviousVersionOptions +func (*CatalogManagementV1) NewCopyFromPreviousVersionOptions(versionLocID string, typeVar string, versionLocIDToCopyFrom string) *CopyFromPreviousVersionOptions { + return &CopyFromPreviousVersionOptions{ + VersionLocID: core.StringPtr(versionLocID), + Type: core.StringPtr(typeVar), + VersionLocIDToCopyFrom: core.StringPtr(versionLocIDToCopyFrom), } } -// SetCatalogIdentifier : Allow user to set CatalogIdentifier -func (_options *DeleteObjectAccessOptions) SetCatalogIdentifier(catalogIdentifier string) *DeleteObjectAccessOptions { - _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) +// SetVersionLocID : Allow user to set VersionLocID +func (_options *CopyFromPreviousVersionOptions) SetVersionLocID(versionLocID string) *CopyFromPreviousVersionOptions { + _options.VersionLocID = core.StringPtr(versionLocID) return _options } -// SetObjectIdentifier : Allow user to set ObjectIdentifier -func (_options *DeleteObjectAccessOptions) SetObjectIdentifier(objectIdentifier string) *DeleteObjectAccessOptions { - _options.ObjectIdentifier = core.StringPtr(objectIdentifier) +// SetType : Allow user to set Type +func (_options *CopyFromPreviousVersionOptions) SetType(typeVar string) *CopyFromPreviousVersionOptions { + _options.Type = core.StringPtr(typeVar) return _options } -// SetAccountIdentifier : Allow user to set AccountIdentifier -func (_options *DeleteObjectAccessOptions) SetAccountIdentifier(accountIdentifier string) *DeleteObjectAccessOptions { - _options.AccountIdentifier = core.StringPtr(accountIdentifier) +// SetVersionLocIDToCopyFrom : Allow user to set VersionLocIDToCopyFrom +func (_options *CopyFromPreviousVersionOptions) SetVersionLocIDToCopyFrom(versionLocIDToCopyFrom string) *CopyFromPreviousVersionOptions { + _options.VersionLocIDToCopyFrom = core.StringPtr(versionLocIDToCopyFrom) return _options } // SetHeaders : Allow user to set Headers -func (options *DeleteObjectAccessOptions) SetHeaders(param map[string]string) *DeleteObjectAccessOptions { +func (options *CopyFromPreviousVersionOptions) SetHeaders(param map[string]string) *CopyFromPreviousVersionOptions { options.Headers = param return options } -// DeleteObjectOptions : The DeleteObject options. -type DeleteObjectOptions struct { - // Catalog identifier. - CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` +// CopyVersionOptions : The CopyVersion options. +type CopyVersionOptions struct { + // A dotted value of `catalogID`.`versionID`. + VersionLocID *string `json:"version_loc_id" validate:"required,ne="` - // Object identifier. - ObjectIdentifier *string `json:"object_identifier" validate:"required,ne="` + // Tags array. + Tags []string `json:"tags,omitempty"` + + // byte array representing the content to be imported. Only supported for OVA images at this time. + Content *[]byte `json:"content,omitempty"` + + // Target kinds. Current valid values are 'iks', 'roks', 'vcenter', 'power-iaas', and 'terraform'. + TargetKinds []string `json:"target_kinds,omitempty"` + + // Format of content being onboarded. Example: vsi-image. Required for virtual server image for VPC. + FormatKind *string `json:"format_kind,omitempty"` + + // Version Flavor Information. Only supported for Product kind Solution. + Flavor *Flavor `json:"flavor,omitempty"` + + // Optional - The sub-folder within the specified tgz file that contains the software being onboarded. + WorkingDirectory *string `json:"working_directory,omitempty"` // Allows users to set headers on API requests Headers map[string]string } -// NewDeleteObjectOptions : Instantiate DeleteObjectOptions -func (*CatalogManagementV1) NewDeleteObjectOptions(catalogIdentifier string, objectIdentifier string) *DeleteObjectOptions { - return &DeleteObjectOptions{ - CatalogIdentifier: core.StringPtr(catalogIdentifier), - ObjectIdentifier: core.StringPtr(objectIdentifier), +// NewCopyVersionOptions : Instantiate CopyVersionOptions +func (*CatalogManagementV1) NewCopyVersionOptions(versionLocID string) *CopyVersionOptions { + return &CopyVersionOptions{ + VersionLocID: core.StringPtr(versionLocID), } } -// SetCatalogIdentifier : Allow user to set CatalogIdentifier -func (_options *DeleteObjectOptions) SetCatalogIdentifier(catalogIdentifier string) *DeleteObjectOptions { - _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) +// SetVersionLocID : Allow user to set VersionLocID +func (_options *CopyVersionOptions) SetVersionLocID(versionLocID string) *CopyVersionOptions { + _options.VersionLocID = core.StringPtr(versionLocID) return _options } -// SetObjectIdentifier : Allow user to set ObjectIdentifier -func (_options *DeleteObjectOptions) SetObjectIdentifier(objectIdentifier string) *DeleteObjectOptions { - _options.ObjectIdentifier = core.StringPtr(objectIdentifier) +// SetTags : Allow user to set Tags +func (_options *CopyVersionOptions) SetTags(tags []string) *CopyVersionOptions { + _options.Tags = tags return _options } -// SetHeaders : Allow user to set Headers -func (options *DeleteObjectOptions) SetHeaders(param map[string]string) *DeleteObjectOptions { - options.Headers = param - return options +// SetContent : Allow user to set Content +func (_options *CopyVersionOptions) SetContent(content []byte) *CopyVersionOptions { + _options.Content = &content + return _options } -// DeleteOfferingInstanceOptions : The DeleteOfferingInstance options. -type DeleteOfferingInstanceOptions struct { - // Version Instance identifier. - InstanceIdentifier *string `json:"instance_identifier" validate:"required,ne="` - - // IAM Refresh token. - XAuthRefreshToken *string `json:"X-Auth-Refresh-Token" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string +// SetTargetKinds : Allow user to set TargetKinds +func (_options *CopyVersionOptions) SetTargetKinds(targetKinds []string) *CopyVersionOptions { + _options.TargetKinds = targetKinds + return _options } -// NewDeleteOfferingInstanceOptions : Instantiate DeleteOfferingInstanceOptions -func (*CatalogManagementV1) NewDeleteOfferingInstanceOptions(instanceIdentifier string, xAuthRefreshToken string) *DeleteOfferingInstanceOptions { - return &DeleteOfferingInstanceOptions{ - InstanceIdentifier: core.StringPtr(instanceIdentifier), - XAuthRefreshToken: core.StringPtr(xAuthRefreshToken), - } +// SetFormatKind : Allow user to set FormatKind +func (_options *CopyVersionOptions) SetFormatKind(formatKind string) *CopyVersionOptions { + _options.FormatKind = core.StringPtr(formatKind) + return _options } -// SetInstanceIdentifier : Allow user to set InstanceIdentifier -func (_options *DeleteOfferingInstanceOptions) SetInstanceIdentifier(instanceIdentifier string) *DeleteOfferingInstanceOptions { - _options.InstanceIdentifier = core.StringPtr(instanceIdentifier) +// SetFlavor : Allow user to set Flavor +func (_options *CopyVersionOptions) SetFlavor(flavor *Flavor) *CopyVersionOptions { + _options.Flavor = flavor return _options } -// SetXAuthRefreshToken : Allow user to set XAuthRefreshToken -func (_options *DeleteOfferingInstanceOptions) SetXAuthRefreshToken(xAuthRefreshToken string) *DeleteOfferingInstanceOptions { - _options.XAuthRefreshToken = core.StringPtr(xAuthRefreshToken) +// SetWorkingDirectory : Allow user to set WorkingDirectory +func (_options *CopyVersionOptions) SetWorkingDirectory(workingDirectory string) *CopyVersionOptions { + _options.WorkingDirectory = core.StringPtr(workingDirectory) return _options } // SetHeaders : Allow user to set Headers -func (options *DeleteOfferingInstanceOptions) SetHeaders(param map[string]string) *DeleteOfferingInstanceOptions { +func (options *CopyVersionOptions) SetHeaders(param map[string]string) *CopyVersionOptions { options.Headers = param return options } -// DeleteOfferingOptions : The DeleteOffering options. -type DeleteOfferingOptions struct { - // Catalog identifier. - CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` +// CostBreakdown : Cost breakdown definition. +type CostBreakdown struct { + // Total hourly cost. + TotalHourlyCost *string `json:"totalHourlyCost,omitempty"` - // Offering identification. - OfferingID *string `json:"offering_id" validate:"required,ne="` + // Total monthly cost. + TotalMonthlyCOst *string `json:"totalMonthlyCOst,omitempty"` - // Allows users to set headers on API requests - Headers map[string]string + // Resources. + Resources []CostResource `json:"resources,omitempty"` } -// NewDeleteOfferingOptions : Instantiate DeleteOfferingOptions -func (*CatalogManagementV1) NewDeleteOfferingOptions(catalogIdentifier string, offeringID string) *DeleteOfferingOptions { - return &DeleteOfferingOptions{ - CatalogIdentifier: core.StringPtr(catalogIdentifier), - OfferingID: core.StringPtr(offeringID), - } -} - -// SetCatalogIdentifier : Allow user to set CatalogIdentifier -func (_options *DeleteOfferingOptions) SetCatalogIdentifier(catalogIdentifier string) *DeleteOfferingOptions { - _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) - return _options -} - -// SetOfferingID : Allow user to set OfferingID -func (_options *DeleteOfferingOptions) SetOfferingID(offeringID string) *DeleteOfferingOptions { - _options.OfferingID = core.StringPtr(offeringID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteOfferingOptions) SetHeaders(param map[string]string) *DeleteOfferingOptions { - options.Headers = param - return options -} - -// DeleteOperatorsOptions : The DeleteOperators options. -type DeleteOperatorsOptions struct { - // IAM Refresh token. - XAuthRefreshToken *string `json:"X-Auth-Refresh-Token" validate:"required"` - - // Cluster identification. - ClusterID *string `json:"cluster_id" validate:"required"` - - // Cluster region. - Region *string `json:"region" validate:"required"` - - // A dotted value of `catalogID`.`versionID`. - VersionLocatorID *string `json:"version_locator_id" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteOperatorsOptions : Instantiate DeleteOperatorsOptions -func (*CatalogManagementV1) NewDeleteOperatorsOptions(xAuthRefreshToken string, clusterID string, region string, versionLocatorID string) *DeleteOperatorsOptions { - return &DeleteOperatorsOptions{ - XAuthRefreshToken: core.StringPtr(xAuthRefreshToken), - ClusterID: core.StringPtr(clusterID), - Region: core.StringPtr(region), - VersionLocatorID: core.StringPtr(versionLocatorID), +// UnmarshalCostBreakdown unmarshals an instance of CostBreakdown from the specified map of raw messages. +func UnmarshalCostBreakdown(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CostBreakdown) + err = core.UnmarshalPrimitive(m, "totalHourlyCost", &obj.TotalHourlyCost) + if err != nil { + return } -} - -// SetXAuthRefreshToken : Allow user to set XAuthRefreshToken -func (_options *DeleteOperatorsOptions) SetXAuthRefreshToken(xAuthRefreshToken string) *DeleteOperatorsOptions { - _options.XAuthRefreshToken = core.StringPtr(xAuthRefreshToken) - return _options -} - -// SetClusterID : Allow user to set ClusterID -func (_options *DeleteOperatorsOptions) SetClusterID(clusterID string) *DeleteOperatorsOptions { - _options.ClusterID = core.StringPtr(clusterID) - return _options -} - -// SetRegion : Allow user to set Region -func (_options *DeleteOperatorsOptions) SetRegion(region string) *DeleteOperatorsOptions { - _options.Region = core.StringPtr(region) - return _options -} - -// SetVersionLocatorID : Allow user to set VersionLocatorID -func (_options *DeleteOperatorsOptions) SetVersionLocatorID(versionLocatorID string) *DeleteOperatorsOptions { - _options.VersionLocatorID = core.StringPtr(versionLocatorID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteOperatorsOptions) SetHeaders(param map[string]string) *DeleteOperatorsOptions { - options.Headers = param - return options -} - -// DeleteVersionOptions : The DeleteVersion options. -type DeleteVersionOptions struct { - // A dotted value of `catalogID`.`versionID`. - VersionLocID *string `json:"version_loc_id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeleteVersionOptions : Instantiate DeleteVersionOptions -func (*CatalogManagementV1) NewDeleteVersionOptions(versionLocID string) *DeleteVersionOptions { - return &DeleteVersionOptions{ - VersionLocID: core.StringPtr(versionLocID), + err = core.UnmarshalPrimitive(m, "totalMonthlyCOst", &obj.TotalMonthlyCOst) + if err != nil { + return } -} - -// SetVersionLocID : Allow user to set VersionLocID -func (_options *DeleteVersionOptions) SetVersionLocID(versionLocID string) *DeleteVersionOptions { - _options.VersionLocID = core.StringPtr(versionLocID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteVersionOptions) SetHeaders(param map[string]string) *DeleteVersionOptions { - options.Headers = param - return options -} - -// DeployOperatorsOptions : The DeployOperators options. -type DeployOperatorsOptions struct { - // IAM Refresh token. - XAuthRefreshToken *string `json:"X-Auth-Refresh-Token" validate:"required"` - - // Cluster ID. - ClusterID *string `json:"cluster_id,omitempty"` - - // Cluster region. - Region *string `json:"region,omitempty"` - - // Kube namespaces to deploy Operator(s) to. - Namespaces []string `json:"namespaces,omitempty"` - - // Denotes whether to install Operator(s) globally. - AllNamespaces *bool `json:"all_namespaces,omitempty"` - - // A dotted value of `catalogID`.`versionID`. - VersionLocatorID *string `json:"version_locator_id,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewDeployOperatorsOptions : Instantiate DeployOperatorsOptions -func (*CatalogManagementV1) NewDeployOperatorsOptions(xAuthRefreshToken string) *DeployOperatorsOptions { - return &DeployOperatorsOptions{ - XAuthRefreshToken: core.StringPtr(xAuthRefreshToken), + err = core.UnmarshalModel(m, "resources", &obj.Resources, UnmarshalCostResource) + if err != nil { + return } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// SetXAuthRefreshToken : Allow user to set XAuthRefreshToken -func (_options *DeployOperatorsOptions) SetXAuthRefreshToken(xAuthRefreshToken string) *DeployOperatorsOptions { - _options.XAuthRefreshToken = core.StringPtr(xAuthRefreshToken) - return _options -} - -// SetClusterID : Allow user to set ClusterID -func (_options *DeployOperatorsOptions) SetClusterID(clusterID string) *DeployOperatorsOptions { - _options.ClusterID = core.StringPtr(clusterID) - return _options -} - -// SetRegion : Allow user to set Region -func (_options *DeployOperatorsOptions) SetRegion(region string) *DeployOperatorsOptions { - _options.Region = core.StringPtr(region) - return _options -} - -// SetNamespaces : Allow user to set Namespaces -func (_options *DeployOperatorsOptions) SetNamespaces(namespaces []string) *DeployOperatorsOptions { - _options.Namespaces = namespaces - return _options -} - -// SetAllNamespaces : Allow user to set AllNamespaces -func (_options *DeployOperatorsOptions) SetAllNamespaces(allNamespaces bool) *DeployOperatorsOptions { - _options.AllNamespaces = core.BoolPtr(allNamespaces) - return _options -} +// CostComponent : Cost component definition. +type CostComponent struct { + // Cost component name. + Name *string `json:"name,omitempty"` -// SetVersionLocatorID : Allow user to set VersionLocatorID -func (_options *DeployOperatorsOptions) SetVersionLocatorID(versionLocatorID string) *DeployOperatorsOptions { - _options.VersionLocatorID = core.StringPtr(versionLocatorID) - return _options -} + // Cost component unit. + Unit *string `json:"unit,omitempty"` -// SetHeaders : Allow user to set Headers -func (options *DeployOperatorsOptions) SetHeaders(param map[string]string) *DeployOperatorsOptions { - options.Headers = param - return options -} + // Cost component hourly quantity. + HourlyQuantity *string `json:"hourlyQuantity,omitempty"` -// DeployRequestBodySchematics : Schematics workspace configuration. -type DeployRequestBodySchematics struct { - // Schematics workspace name. - Name *string `json:"name,omitempty"` + // Cost component monthly quantity. + MonthlyQuantity *string `json:"monthlyQuantity,omitempty"` - // Schematics workspace description. - Description *string `json:"description,omitempty"` + // Cost component price. + Price *string `json:"price,omitempty"` - // Schematics workspace tags. - Tags []string `json:"tags,omitempty"` + // Cost component hourly cost. + HourlyCost *string `json:"hourlyCost,omitempty"` - // Resource group to use when creating the schematics workspace. - ResourceGroupID *string `json:"resource_group_id,omitempty"` + // Cost component monthly cist. + MonthlyCost *string `json:"monthlyCost,omitempty"` } -// UnmarshalDeployRequestBodySchematics unmarshals an instance of DeployRequestBodySchematics from the specified map of raw messages. -func UnmarshalDeployRequestBodySchematics(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DeployRequestBodySchematics) +// UnmarshalCostComponent unmarshals an instance of CostComponent from the specified map of raw messages. +func UnmarshalCostComponent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CostComponent) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "description", &obj.Description) + err = core.UnmarshalPrimitive(m, "unit", &obj.Unit) if err != nil { return } - err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) + err = core.UnmarshalPrimitive(m, "hourlyQuantity", &obj.HourlyQuantity) if err != nil { return } - err = core.UnmarshalPrimitive(m, "resource_group_id", &obj.ResourceGroupID) + err = core.UnmarshalPrimitive(m, "monthlyQuantity", &obj.MonthlyQuantity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "price", &obj.Price) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "hourlyCost", &obj.HourlyCost) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "monthlyCost", &obj.MonthlyCost) if err != nil { return } @@ -7489,72 +8589,86 @@ func UnmarshalDeployRequestBodySchematics(m map[string]json.RawMessage, result i return } -// Deployment : Deployment for offering. -type Deployment struct { - // unique id. - ID *string `json:"id,omitempty"` +// CostEstimate : Cost estimate definition. +type CostEstimate struct { + // Cost estimate version. + Version *string `json:"version,omitempty"` - // Display Name in the requested language. - Label *string `json:"label,omitempty"` + // Cost estimate currency. + Currency *string `json:"currency,omitempty"` - // The programmatic name of this offering. - Name *string `json:"name,omitempty"` + // Cost estimate projects. + Projects []Project `json:"projects,omitempty"` - // Short description in the requested language. - ShortDescription *string `json:"short_description,omitempty"` + // Cost summary definition. + Summary *CostSummary `json:"summary,omitempty"` - // Long description in the requested language. - LongDescription *string `json:"long_description,omitempty"` + // Total hourly cost. + TotalHourlyCost *string `json:"totalHourlyCost,omitempty"` - // open ended metadata information. - Metadata map[string]interface{} `json:"metadata,omitempty"` + // Total monthly cost. + TotalMonthlyCost *string `json:"totalMonthlyCost,omitempty"` - // list of tags associated with this catalog. - Tags []string `json:"tags,omitempty"` + // Past total hourly cost. + PastTotalHourlyCost *string `json:"pastTotalHourlyCost,omitempty"` - // the date'time this catalog was created. - Created *strfmt.DateTime `json:"created,omitempty"` + // Past total monthly cost. + PastTotalMonthlyCost *string `json:"pastTotalMonthlyCost,omitempty"` - // the date'time this catalog was last updated. - Updated *strfmt.DateTime `json:"updated,omitempty"` + // Difference in total hourly cost. + DiffTotalHourlyCost *string `json:"diffTotalHourlyCost,omitempty"` + + // Difference in total monthly cost. + DiffTotalMonthlyCost *string `json:"diffTotalMonthlyCost,omitempty"` + + // When this estimate was generated. + TimeGenerated *strfmt.DateTime `json:"timeGenerated,omitempty"` } -// UnmarshalDeployment unmarshals an instance of Deployment from the specified map of raw messages. -func UnmarshalDeployment(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(Deployment) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) +// UnmarshalCostEstimate unmarshals an instance of CostEstimate from the specified map of raw messages. +func UnmarshalCostEstimate(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CostEstimate) + err = core.UnmarshalPrimitive(m, "version", &obj.Version) if err != nil { return } - err = core.UnmarshalPrimitive(m, "label", &obj.Label) + err = core.UnmarshalPrimitive(m, "currency", &obj.Currency) if err != nil { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalModel(m, "projects", &obj.Projects, UnmarshalProject) if err != nil { return } - err = core.UnmarshalPrimitive(m, "short_description", &obj.ShortDescription) + err = core.UnmarshalModel(m, "summary", &obj.Summary, UnmarshalCostSummary) if err != nil { return } - err = core.UnmarshalPrimitive(m, "long_description", &obj.LongDescription) + err = core.UnmarshalPrimitive(m, "totalHourlyCost", &obj.TotalHourlyCost) if err != nil { return } - err = core.UnmarshalPrimitive(m, "metadata", &obj.Metadata) + err = core.UnmarshalPrimitive(m, "totalMonthlyCost", &obj.TotalMonthlyCost) if err != nil { return } - err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) + err = core.UnmarshalPrimitive(m, "pastTotalHourlyCost", &obj.PastTotalHourlyCost) if err != nil { return } - err = core.UnmarshalPrimitive(m, "created", &obj.Created) + err = core.UnmarshalPrimitive(m, "pastTotalMonthlyCost", &obj.PastTotalMonthlyCost) if err != nil { return } - err = core.UnmarshalPrimitive(m, "updated", &obj.Updated) + err = core.UnmarshalPrimitive(m, "diffTotalHourlyCost", &obj.DiffTotalHourlyCost) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "diffTotalMonthlyCost", &obj.DiffTotalMonthlyCost) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "timeGenerated", &obj.TimeGenerated) if err != nil { return } @@ -7562,175 +8676,103 @@ func UnmarshalDeployment(m map[string]json.RawMessage, result interface{}) (err return } -// DeprecateOfferingOptions : The DeprecateOffering options. -type DeprecateOfferingOptions struct { - // Catalog identifier. - CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` +// CostResource : Cost resource definition. +type CostResource struct { + // Resource name. + Name *string `json:"name,omitempty"` - // Offering identification. - OfferingID *string `json:"offering_id" validate:"required,ne="` + // Resource metadata. + Metadata map[string]interface{} `json:"metadata,omitempty"` - // Set deprecation (true) or cancel deprecation (false). - Setting *string `json:"setting" validate:"required,ne="` - - // Additional information that users can provide to be displayed in deprecation notification. - Description *string `json:"description,omitempty"` + // Hourly cost. + HourlyCost *string `json:"hourlyCost,omitempty"` - // Specifies the amount of days until product is not available in catalog. - DaysUntilDeprecate *int64 `json:"days_until_deprecate,omitempty"` + // Monthly cost. + MonthlyCost *string `json:"monthlyCost,omitempty"` - // Allows users to set headers on API requests - Headers map[string]string + // Cost components. + CostComponents []CostComponent `json:"costComponents,omitempty"` } -// Constants associated with the DeprecateOfferingOptions.Setting property. -// Set deprecation (true) or cancel deprecation (false). -const ( - DeprecateOfferingOptionsSettingFalseConst = "false" - DeprecateOfferingOptionsSettingTrueConst = "true" -) - -// NewDeprecateOfferingOptions : Instantiate DeprecateOfferingOptions -func (*CatalogManagementV1) NewDeprecateOfferingOptions(catalogIdentifier string, offeringID string, setting string) *DeprecateOfferingOptions { - return &DeprecateOfferingOptions{ - CatalogIdentifier: core.StringPtr(catalogIdentifier), - OfferingID: core.StringPtr(offeringID), - Setting: core.StringPtr(setting), +// UnmarshalCostResource unmarshals an instance of CostResource from the specified map of raw messages. +func UnmarshalCostResource(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CostResource) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return } + err = core.UnmarshalPrimitive(m, "metadata", &obj.Metadata) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "hourlyCost", &obj.HourlyCost) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "monthlyCost", &obj.MonthlyCost) + if err != nil { + return + } + err = core.UnmarshalModel(m, "costComponents", &obj.CostComponents, UnmarshalCostComponent) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// SetCatalogIdentifier : Allow user to set CatalogIdentifier -func (_options *DeprecateOfferingOptions) SetCatalogIdentifier(catalogIdentifier string) *DeprecateOfferingOptions { - _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) - return _options -} - -// SetOfferingID : Allow user to set OfferingID -func (_options *DeprecateOfferingOptions) SetOfferingID(offeringID string) *DeprecateOfferingOptions { - _options.OfferingID = core.StringPtr(offeringID) - return _options -} +// CostSummary : Cost summary definition. +type CostSummary struct { + // Total detected resources. + TotalDetectedResources *int64 `json:"totalDetectedResources,omitempty"` -// SetSetting : Allow user to set Setting -func (_options *DeprecateOfferingOptions) SetSetting(setting string) *DeprecateOfferingOptions { - _options.Setting = core.StringPtr(setting) - return _options -} + // Total supported resources. + TotalSupportedResources *int64 `json:"totalSupportedResources,omitempty"` -// SetDescription : Allow user to set Description -func (_options *DeprecateOfferingOptions) SetDescription(description string) *DeprecateOfferingOptions { - _options.Description = core.StringPtr(description) - return _options -} + // Total unsupported resources. + TotalUnsupportedResources *int64 `json:"totalUnsupportedResources,omitempty"` -// SetDaysUntilDeprecate : Allow user to set DaysUntilDeprecate -func (_options *DeprecateOfferingOptions) SetDaysUntilDeprecate(daysUntilDeprecate int64) *DeprecateOfferingOptions { - _options.DaysUntilDeprecate = core.Int64Ptr(daysUntilDeprecate) - return _options -} + // Total usage based resources. + TotalUsageBasedResources *int64 `json:"totalUsageBasedResources,omitempty"` -// SetHeaders : Allow user to set Headers -func (options *DeprecateOfferingOptions) SetHeaders(param map[string]string) *DeprecateOfferingOptions { - options.Headers = param - return options -} + // Total no price resources. + TotalNoPriceResources *int64 `json:"totalNoPriceResources,omitempty"` -// DeprecateVersionOptions : The DeprecateVersion options. -type DeprecateVersionOptions struct { - // A dotted value of `catalogID`.`versionID`. - VersionLocID *string `json:"version_loc_id" validate:"required,ne="` + // Unsupported resource counts. + UnsupportedResourceCounts map[string]int64 `json:"unsupportedResourceCounts,omitempty"` - // Allows users to set headers on API requests - Headers map[string]string + // No price resource counts. + NoPriceResourceCounts map[string]int64 `json:"noPriceResourceCounts,omitempty"` } -// NewDeprecateVersionOptions : Instantiate DeprecateVersionOptions -func (*CatalogManagementV1) NewDeprecateVersionOptions(versionLocID string) *DeprecateVersionOptions { - return &DeprecateVersionOptions{ - VersionLocID: core.StringPtr(versionLocID), +// UnmarshalCostSummary unmarshals an instance of CostSummary from the specified map of raw messages. +func UnmarshalCostSummary(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CostSummary) + err = core.UnmarshalPrimitive(m, "totalDetectedResources", &obj.TotalDetectedResources) + if err != nil { + return } -} - -// SetVersionLocID : Allow user to set VersionLocID -func (_options *DeprecateVersionOptions) SetVersionLocID(versionLocID string) *DeprecateVersionOptions { - _options.VersionLocID = core.StringPtr(versionLocID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeprecateVersionOptions) SetHeaders(param map[string]string) *DeprecateVersionOptions { - options.Headers = param - return options -} - -// Feature : Feature information. -type Feature struct { - // Heading. - Title *string `json:"title,omitempty"` - - // Feature description. - Description *string `json:"description,omitempty"` -} - -// UnmarshalFeature unmarshals an instance of Feature from the specified map of raw messages. -func UnmarshalFeature(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(Feature) - err = core.UnmarshalPrimitive(m, "title", &obj.Title) + err = core.UnmarshalPrimitive(m, "totalSupportedResources", &obj.TotalSupportedResources) if err != nil { return } - err = core.UnmarshalPrimitive(m, "description", &obj.Description) + err = core.UnmarshalPrimitive(m, "totalUnsupportedResources", &obj.TotalUnsupportedResources) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// FilterTerms : Offering filter terms. -type FilterTerms struct { - // List of values to match against. If include is true, then if the offering has one of the values then the offering is - // included. If include is false, then if the offering has one of the values then the offering is excluded. - FilterTerms []string `json:"filter_terms,omitempty"` -} - -// UnmarshalFilterTerms unmarshals an instance of FilterTerms from the specified map of raw messages. -func UnmarshalFilterTerms(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(FilterTerms) - err = core.UnmarshalPrimitive(m, "filter_terms", &obj.FilterTerms) + err = core.UnmarshalPrimitive(m, "totalUsageBasedResources", &obj.TotalUsageBasedResources) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Filters : Filters for account and catalog filters. -type Filters struct { - // -> true - Include all of the public catalog when filtering. Further settings will specifically exclude some - // offerings. false - Exclude all of the public catalog when filtering. Further settings will specifically include some - // offerings. - IncludeAll *bool `json:"include_all,omitempty"` - - // Filter against offering properties. - CategoryFilters map[string]CategoryFilter `json:"category_filters,omitempty"` - - // Filter on offering ID's. There is an include filter and an exclule filter. Both can be set. - IDFilters *IDFilter `json:"id_filters,omitempty"` -} - -// UnmarshalFilters unmarshals an instance of Filters from the specified map of raw messages. -func UnmarshalFilters(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(Filters) - err = core.UnmarshalPrimitive(m, "include_all", &obj.IncludeAll) + err = core.UnmarshalPrimitive(m, "totalNoPriceResources", &obj.TotalNoPriceResources) if err != nil { return } - err = core.UnmarshalModel(m, "category_filters", &obj.CategoryFilters, UnmarshalCategoryFilter) + err = core.UnmarshalPrimitive(m, "unsupportedResourceCounts", &obj.UnsupportedResourceCounts) if err != nil { return } - err = core.UnmarshalModel(m, "id_filters", &obj.IDFilters, UnmarshalIDFilter) + err = core.UnmarshalPrimitive(m, "noPriceResourceCounts", &obj.NoPriceResourceCounts) if err != nil { return } @@ -7738,1632 +8780,1550 @@ func UnmarshalFilters(m map[string]json.RawMessage, result interface{}) (err err return } -// GetCatalogAccountAuditOptions : The GetCatalogAccountAudit options. -type GetCatalogAccountAuditOptions struct { +// CreateCatalogOptions : The CreateCatalog options. +type CreateCatalogOptions struct { + // Unique ID. + ID *string `json:"id,omitempty"` - // Allows users to set headers on API requests - Headers map[string]string -} + // Cloudant revision. + Rev *string `json:"_rev,omitempty"` -// NewGetCatalogAccountAuditOptions : Instantiate GetCatalogAccountAuditOptions -func (*CatalogManagementV1) NewGetCatalogAccountAuditOptions() *GetCatalogAccountAuditOptions { - return &GetCatalogAccountAuditOptions{} -} + // Display Name in the requested language. + Label *string `json:"label,omitempty"` -// SetHeaders : Allow user to set Headers -func (options *GetCatalogAccountAuditOptions) SetHeaders(param map[string]string) *GetCatalogAccountAuditOptions { - options.Headers = param - return options -} + // A map of translated strings, by language code. + LabelI18n map[string]string `json:"label_i18n,omitempty"` -// GetCatalogAccountFiltersOptions : The GetCatalogAccountFilters options. -type GetCatalogAccountFiltersOptions struct { - // catalog id. Narrow down filters to the account and just the one catalog. - Catalog *string `json:"catalog,omitempty"` + // Description in the requested language. + ShortDescription *string `json:"short_description,omitempty"` - // Allows users to set headers on API requests - Headers map[string]string -} + // A map of translated strings, by language code. + ShortDescriptionI18n map[string]string `json:"short_description_i18n,omitempty"` -// NewGetCatalogAccountFiltersOptions : Instantiate GetCatalogAccountFiltersOptions -func (*CatalogManagementV1) NewGetCatalogAccountFiltersOptions() *GetCatalogAccountFiltersOptions { - return &GetCatalogAccountFiltersOptions{} -} + // URL for an icon associated with this catalog. + CatalogIconURL *string `json:"catalog_icon_url,omitempty"` -// SetCatalog : Allow user to set Catalog -func (_options *GetCatalogAccountFiltersOptions) SetCatalog(catalog string) *GetCatalogAccountFiltersOptions { - _options.Catalog = core.StringPtr(catalog) - return _options -} + // List of tags associated with this catalog. + Tags []string `json:"tags,omitempty"` -// SetHeaders : Allow user to set Headers -func (options *GetCatalogAccountFiltersOptions) SetHeaders(param map[string]string) *GetCatalogAccountFiltersOptions { - options.Headers = param - return options -} + // List of features associated with this catalog. + Features []Feature `json:"features,omitempty"` -// GetCatalogAccountOptions : The GetCatalogAccount options. -type GetCatalogAccountOptions struct { + // Denotes whether a catalog is disabled. + Disabled *bool `json:"disabled,omitempty"` - // Allows users to set headers on API requests - Headers map[string]string -} + // Resource group id the catalog is owned by. + ResourceGroupID *string `json:"resource_group_id,omitempty"` -// NewGetCatalogAccountOptions : Instantiate GetCatalogAccountOptions -func (*CatalogManagementV1) NewGetCatalogAccountOptions() *GetCatalogAccountOptions { - return &GetCatalogAccountOptions{} -} + // Account that owns catalog. + OwningAccount *string `json:"owning_account,omitempty"` -// SetHeaders : Allow user to set Headers -func (options *GetCatalogAccountOptions) SetHeaders(param map[string]string) *GetCatalogAccountOptions { - options.Headers = param - return options -} + // Filters for account and catalog filters. + CatalogFilters *Filters `json:"catalog_filters,omitempty"` -// GetCatalogAuditOptions : The GetCatalogAudit options. -type GetCatalogAuditOptions struct { - // Catalog identifier. - CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` + // Feature information. + SyndicationSettings *SyndicationResource `json:"syndication_settings,omitempty"` + + // Kind of catalog. Supported kinds are offering and vpe. + Kind *string `json:"kind,omitempty"` + + // Catalog specific metadata. + Metadata map[string]interface{} `json:"metadata,omitempty"` // Allows users to set headers on API requests Headers map[string]string } -// NewGetCatalogAuditOptions : Instantiate GetCatalogAuditOptions -func (*CatalogManagementV1) NewGetCatalogAuditOptions(catalogIdentifier string) *GetCatalogAuditOptions { - return &GetCatalogAuditOptions{ - CatalogIdentifier: core.StringPtr(catalogIdentifier), - } +// NewCreateCatalogOptions : Instantiate CreateCatalogOptions +func (*CatalogManagementV1) NewCreateCatalogOptions() *CreateCatalogOptions { + return &CreateCatalogOptions{} } -// SetCatalogIdentifier : Allow user to set CatalogIdentifier -func (_options *GetCatalogAuditOptions) SetCatalogIdentifier(catalogIdentifier string) *GetCatalogAuditOptions { - _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) +// SetID : Allow user to set ID +func (_options *CreateCatalogOptions) SetID(id string) *CreateCatalogOptions { + _options.ID = core.StringPtr(id) return _options } -// SetHeaders : Allow user to set Headers -func (options *GetCatalogAuditOptions) SetHeaders(param map[string]string) *GetCatalogAuditOptions { - options.Headers = param - return options +// SetRev : Allow user to set Rev +func (_options *CreateCatalogOptions) SetRev(rev string) *CreateCatalogOptions { + _options.Rev = core.StringPtr(rev) + return _options } -// GetCatalogOptions : The GetCatalog options. -type GetCatalogOptions struct { - // Catalog identifier. - CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetCatalogOptions : Instantiate GetCatalogOptions -func (*CatalogManagementV1) NewGetCatalogOptions(catalogIdentifier string) *GetCatalogOptions { - return &GetCatalogOptions{ - CatalogIdentifier: core.StringPtr(catalogIdentifier), - } -} - -// SetCatalogIdentifier : Allow user to set CatalogIdentifier -func (_options *GetCatalogOptions) SetCatalogIdentifier(catalogIdentifier string) *GetCatalogOptions { - _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetCatalogOptions) SetHeaders(param map[string]string) *GetCatalogOptions { - options.Headers = param - return options -} - -// GetClusterOptions : The GetCluster options. -type GetClusterOptions struct { - // ID of the cluster. - ClusterID *string `json:"cluster_id" validate:"required,ne="` - - // Region of the cluster. - Region *string `json:"region" validate:"required"` - - // IAM Refresh token. - XAuthRefreshToken *string `json:"X-Auth-Refresh-Token" validate:"required"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetClusterOptions : Instantiate GetClusterOptions -func (*CatalogManagementV1) NewGetClusterOptions(clusterID string, region string, xAuthRefreshToken string) *GetClusterOptions { - return &GetClusterOptions{ - ClusterID: core.StringPtr(clusterID), - Region: core.StringPtr(region), - XAuthRefreshToken: core.StringPtr(xAuthRefreshToken), - } -} - -// SetClusterID : Allow user to set ClusterID -func (_options *GetClusterOptions) SetClusterID(clusterID string) *GetClusterOptions { - _options.ClusterID = core.StringPtr(clusterID) +// SetLabel : Allow user to set Label +func (_options *CreateCatalogOptions) SetLabel(label string) *CreateCatalogOptions { + _options.Label = core.StringPtr(label) return _options } -// SetRegion : Allow user to set Region -func (_options *GetClusterOptions) SetRegion(region string) *GetClusterOptions { - _options.Region = core.StringPtr(region) +// SetLabelI18n : Allow user to set LabelI18n +func (_options *CreateCatalogOptions) SetLabelI18n(labelI18n map[string]string) *CreateCatalogOptions { + _options.LabelI18n = labelI18n return _options } -// SetXAuthRefreshToken : Allow user to set XAuthRefreshToken -func (_options *GetClusterOptions) SetXAuthRefreshToken(xAuthRefreshToken string) *GetClusterOptions { - _options.XAuthRefreshToken = core.StringPtr(xAuthRefreshToken) +// SetShortDescription : Allow user to set ShortDescription +func (_options *CreateCatalogOptions) SetShortDescription(shortDescription string) *CreateCatalogOptions { + _options.ShortDescription = core.StringPtr(shortDescription) return _options } -// SetHeaders : Allow user to set Headers -func (options *GetClusterOptions) SetHeaders(param map[string]string) *GetClusterOptions { - options.Headers = param - return options -} - -// GetConsumptionOfferingsOptions : The GetConsumptionOfferings options. -type GetConsumptionOfferingsOptions struct { - // true - Strip down the content of what is returned. For example don't return the readme. Makes the result much - // smaller. Defaults to false. - Digest *bool `json:"digest,omitempty"` - - // catalog id. Narrow search down to just a particular catalog. It will apply the catalog's public filters to the - // public catalog offerings on the result. - Catalog *string `json:"catalog,omitempty"` - - // What should be selected. Default is 'all' which will return both public and private offerings. 'public' returns only - // the public offerings and 'private' returns only the private offerings. - Select *string `json:"select,omitempty"` - - // true - include offerings which have been marked as hidden. The default is false and hidden offerings are not - // returned. - IncludeHidden *bool `json:"includeHidden,omitempty"` - - // number or results to return. - Limit *int64 `json:"limit,omitempty"` - - // number of results to skip before returning values. - Offset *int64 `json:"offset,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// Constants associated with the GetConsumptionOfferingsOptions.Select property. -// What should be selected. Default is 'all' which will return both public and private offerings. 'public' returns only -// the public offerings and 'private' returns only the private offerings. -const ( - GetConsumptionOfferingsOptionsSelectAllConst = "all" - GetConsumptionOfferingsOptionsSelectPrivateConst = "private" - GetConsumptionOfferingsOptionsSelectPublicConst = "public" -) - -// NewGetConsumptionOfferingsOptions : Instantiate GetConsumptionOfferingsOptions -func (*CatalogManagementV1) NewGetConsumptionOfferingsOptions() *GetConsumptionOfferingsOptions { - return &GetConsumptionOfferingsOptions{} -} - -// SetDigest : Allow user to set Digest -func (_options *GetConsumptionOfferingsOptions) SetDigest(digest bool) *GetConsumptionOfferingsOptions { - _options.Digest = core.BoolPtr(digest) +// SetShortDescriptionI18n : Allow user to set ShortDescriptionI18n +func (_options *CreateCatalogOptions) SetShortDescriptionI18n(shortDescriptionI18n map[string]string) *CreateCatalogOptions { + _options.ShortDescriptionI18n = shortDescriptionI18n return _options } -// SetCatalog : Allow user to set Catalog -func (_options *GetConsumptionOfferingsOptions) SetCatalog(catalog string) *GetConsumptionOfferingsOptions { - _options.Catalog = core.StringPtr(catalog) +// SetCatalogIconURL : Allow user to set CatalogIconURL +func (_options *CreateCatalogOptions) SetCatalogIconURL(catalogIconURL string) *CreateCatalogOptions { + _options.CatalogIconURL = core.StringPtr(catalogIconURL) return _options } -// SetSelect : Allow user to set Select -func (_options *GetConsumptionOfferingsOptions) SetSelect(selectVar string) *GetConsumptionOfferingsOptions { - _options.Select = core.StringPtr(selectVar) +// SetTags : Allow user to set Tags +func (_options *CreateCatalogOptions) SetTags(tags []string) *CreateCatalogOptions { + _options.Tags = tags return _options } -// SetIncludeHidden : Allow user to set IncludeHidden -func (_options *GetConsumptionOfferingsOptions) SetIncludeHidden(includeHidden bool) *GetConsumptionOfferingsOptions { - _options.IncludeHidden = core.BoolPtr(includeHidden) +// SetFeatures : Allow user to set Features +func (_options *CreateCatalogOptions) SetFeatures(features []Feature) *CreateCatalogOptions { + _options.Features = features return _options } -// SetLimit : Allow user to set Limit -func (_options *GetConsumptionOfferingsOptions) SetLimit(limit int64) *GetConsumptionOfferingsOptions { - _options.Limit = core.Int64Ptr(limit) +// SetDisabled : Allow user to set Disabled +func (_options *CreateCatalogOptions) SetDisabled(disabled bool) *CreateCatalogOptions { + _options.Disabled = core.BoolPtr(disabled) return _options } -// SetOffset : Allow user to set Offset -func (_options *GetConsumptionOfferingsOptions) SetOffset(offset int64) *GetConsumptionOfferingsOptions { - _options.Offset = core.Int64Ptr(offset) +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *CreateCatalogOptions) SetResourceGroupID(resourceGroupID string) *CreateCatalogOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) return _options } -// SetHeaders : Allow user to set Headers -func (options *GetConsumptionOfferingsOptions) SetHeaders(param map[string]string) *GetConsumptionOfferingsOptions { - options.Headers = param - return options -} - -// GetNamespacesOptions : The GetNamespaces options. -type GetNamespacesOptions struct { - // ID of the cluster. - ClusterID *string `json:"cluster_id" validate:"required,ne="` - - // Cluster region. - Region *string `json:"region" validate:"required"` - - // IAM Refresh token. - XAuthRefreshToken *string `json:"X-Auth-Refresh-Token" validate:"required"` - - // The maximum number of results to return. - Limit *int64 `json:"limit,omitempty"` - - // The number of results to skip before returning values. - Offset *int64 `json:"offset,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetNamespacesOptions : Instantiate GetNamespacesOptions -func (*CatalogManagementV1) NewGetNamespacesOptions(clusterID string, region string, xAuthRefreshToken string) *GetNamespacesOptions { - return &GetNamespacesOptions{ - ClusterID: core.StringPtr(clusterID), - Region: core.StringPtr(region), - XAuthRefreshToken: core.StringPtr(xAuthRefreshToken), - } -} - -// SetClusterID : Allow user to set ClusterID -func (_options *GetNamespacesOptions) SetClusterID(clusterID string) *GetNamespacesOptions { - _options.ClusterID = core.StringPtr(clusterID) +// SetOwningAccount : Allow user to set OwningAccount +func (_options *CreateCatalogOptions) SetOwningAccount(owningAccount string) *CreateCatalogOptions { + _options.OwningAccount = core.StringPtr(owningAccount) return _options } -// SetRegion : Allow user to set Region -func (_options *GetNamespacesOptions) SetRegion(region string) *GetNamespacesOptions { - _options.Region = core.StringPtr(region) +// SetCatalogFilters : Allow user to set CatalogFilters +func (_options *CreateCatalogOptions) SetCatalogFilters(catalogFilters *Filters) *CreateCatalogOptions { + _options.CatalogFilters = catalogFilters return _options } -// SetXAuthRefreshToken : Allow user to set XAuthRefreshToken -func (_options *GetNamespacesOptions) SetXAuthRefreshToken(xAuthRefreshToken string) *GetNamespacesOptions { - _options.XAuthRefreshToken = core.StringPtr(xAuthRefreshToken) +// SetSyndicationSettings : Allow user to set SyndicationSettings +func (_options *CreateCatalogOptions) SetSyndicationSettings(syndicationSettings *SyndicationResource) *CreateCatalogOptions { + _options.SyndicationSettings = syndicationSettings return _options } -// SetLimit : Allow user to set Limit -func (_options *GetNamespacesOptions) SetLimit(limit int64) *GetNamespacesOptions { - _options.Limit = core.Int64Ptr(limit) +// SetKind : Allow user to set Kind +func (_options *CreateCatalogOptions) SetKind(kind string) *CreateCatalogOptions { + _options.Kind = core.StringPtr(kind) return _options } -// SetOffset : Allow user to set Offset -func (_options *GetNamespacesOptions) SetOffset(offset int64) *GetNamespacesOptions { - _options.Offset = core.Int64Ptr(offset) +// SetMetadata : Allow user to set Metadata +func (_options *CreateCatalogOptions) SetMetadata(metadata map[string]interface{}) *CreateCatalogOptions { + _options.Metadata = metadata return _options } // SetHeaders : Allow user to set Headers -func (options *GetNamespacesOptions) SetHeaders(param map[string]string) *GetNamespacesOptions { +func (options *CreateCatalogOptions) SetHeaders(param map[string]string) *CreateCatalogOptions { options.Headers = param return options } -// GetObjectAccessListOptions : The GetObjectAccessList options. -type GetObjectAccessListOptions struct { +// CreateObjectAccessOptions : The CreateObjectAccess options. +type CreateObjectAccessOptions struct { // Catalog identifier. CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` // Object identifier. ObjectIdentifier *string `json:"object_identifier" validate:"required,ne="` - // The maximum number of results to return. - Limit *int64 `json:"limit,omitempty"` - - // The number of results to skip before returning values. - Offset *int64 `json:"offset,omitempty"` + // Identifier for access. Use 'accountId' for an account, '-ent-enterpriseid' for an enterprise, and + // '-entgroup-enterprisegroupid' for an enterprise group. + AccessIdentifier *string `json:"access_identifier" validate:"required,ne="` // Allows users to set headers on API requests Headers map[string]string } -// NewGetObjectAccessListOptions : Instantiate GetObjectAccessListOptions -func (*CatalogManagementV1) NewGetObjectAccessListOptions(catalogIdentifier string, objectIdentifier string) *GetObjectAccessListOptions { - return &GetObjectAccessListOptions{ +// NewCreateObjectAccessOptions : Instantiate CreateObjectAccessOptions +func (*CatalogManagementV1) NewCreateObjectAccessOptions(catalogIdentifier string, objectIdentifier string, accessIdentifier string) *CreateObjectAccessOptions { + return &CreateObjectAccessOptions{ CatalogIdentifier: core.StringPtr(catalogIdentifier), ObjectIdentifier: core.StringPtr(objectIdentifier), + AccessIdentifier: core.StringPtr(accessIdentifier), } } // SetCatalogIdentifier : Allow user to set CatalogIdentifier -func (_options *GetObjectAccessListOptions) SetCatalogIdentifier(catalogIdentifier string) *GetObjectAccessListOptions { +func (_options *CreateObjectAccessOptions) SetCatalogIdentifier(catalogIdentifier string) *CreateObjectAccessOptions { _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) return _options } // SetObjectIdentifier : Allow user to set ObjectIdentifier -func (_options *GetObjectAccessListOptions) SetObjectIdentifier(objectIdentifier string) *GetObjectAccessListOptions { +func (_options *CreateObjectAccessOptions) SetObjectIdentifier(objectIdentifier string) *CreateObjectAccessOptions { _options.ObjectIdentifier = core.StringPtr(objectIdentifier) return _options } -// SetLimit : Allow user to set Limit -func (_options *GetObjectAccessListOptions) SetLimit(limit int64) *GetObjectAccessListOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetOffset : Allow user to set Offset -func (_options *GetObjectAccessListOptions) SetOffset(offset int64) *GetObjectAccessListOptions { - _options.Offset = core.Int64Ptr(offset) +// SetAccessIdentifier : Allow user to set AccessIdentifier +func (_options *CreateObjectAccessOptions) SetAccessIdentifier(accessIdentifier string) *CreateObjectAccessOptions { + _options.AccessIdentifier = core.StringPtr(accessIdentifier) return _options } // SetHeaders : Allow user to set Headers -func (options *GetObjectAccessListOptions) SetHeaders(param map[string]string) *GetObjectAccessListOptions { +func (options *CreateObjectAccessOptions) SetHeaders(param map[string]string) *CreateObjectAccessOptions { options.Headers = param return options } -// GetObjectAccessOptions : The GetObjectAccess options. -type GetObjectAccessOptions struct { +// CreateObjectOptions : The CreateObject options. +type CreateObjectOptions struct { // Catalog identifier. CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` - // Object identifier. - ObjectIdentifier *string `json:"object_identifier" validate:"required,ne="` + // unique id. + ID *string `json:"id,omitempty"` - // Account identifier. - AccountIdentifier *string `json:"account_identifier" validate:"required,ne="` + // The programmatic name of this object. + Name *string `json:"name,omitempty"` - // Allows users to set headers on API requests - Headers map[string]string -} + // Cloudant revision. + Rev *string `json:"_rev,omitempty"` -// NewGetObjectAccessOptions : Instantiate GetObjectAccessOptions -func (*CatalogManagementV1) NewGetObjectAccessOptions(catalogIdentifier string, objectIdentifier string, accountIdentifier string) *GetObjectAccessOptions { - return &GetObjectAccessOptions{ - CatalogIdentifier: core.StringPtr(catalogIdentifier), - ObjectIdentifier: core.StringPtr(objectIdentifier), - AccountIdentifier: core.StringPtr(accountIdentifier), - } -} + // The crn for this specific object. + CRN *string `json:"crn,omitempty"` -// SetCatalogIdentifier : Allow user to set CatalogIdentifier -func (_options *GetObjectAccessOptions) SetCatalogIdentifier(catalogIdentifier string) *GetObjectAccessOptions { - _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) - return _options -} + // The url for this specific object. + URL *string `json:"url,omitempty"` -// SetObjectIdentifier : Allow user to set ObjectIdentifier -func (_options *GetObjectAccessOptions) SetObjectIdentifier(objectIdentifier string) *GetObjectAccessOptions { - _options.ObjectIdentifier = core.StringPtr(objectIdentifier) - return _options -} + // The parent for this specific object. + ParentID *string `json:"parent_id,omitempty"` -// SetAccountIdentifier : Allow user to set AccountIdentifier -func (_options *GetObjectAccessOptions) SetAccountIdentifier(accountIdentifier string) *GetObjectAccessOptions { - _options.AccountIdentifier = core.StringPtr(accountIdentifier) - return _options -} + // A map of translated strings, by language code. + LabelI18n map[string]string `json:"label_i18n,omitempty"` -// SetHeaders : Allow user to set Headers -func (options *GetObjectAccessOptions) SetHeaders(param map[string]string) *GetObjectAccessOptions { - options.Headers = param - return options -} + // Display name in the requested language. + Label *string `json:"label,omitempty"` -// GetObjectAuditOptions : The GetObjectAudit options. -type GetObjectAuditOptions struct { - // Catalog identifier. - CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` + // List of tags associated with this catalog. + Tags []string `json:"tags,omitempty"` - // Object identifier. - ObjectIdentifier *string `json:"object_identifier" validate:"required,ne="` + // The date and time this catalog was created. + Created *strfmt.DateTime `json:"created,omitempty"` - // Allows users to set headers on API requests - Headers map[string]string -} + // The date and time this catalog was last updated. + Updated *strfmt.DateTime `json:"updated,omitempty"` -// NewGetObjectAuditOptions : Instantiate GetObjectAuditOptions -func (*CatalogManagementV1) NewGetObjectAuditOptions(catalogIdentifier string, objectIdentifier string) *GetObjectAuditOptions { - return &GetObjectAuditOptions{ - CatalogIdentifier: core.StringPtr(catalogIdentifier), - ObjectIdentifier: core.StringPtr(objectIdentifier), - } -} + // Short description in the requested language. + ShortDescription *string `json:"short_description,omitempty"` -// SetCatalogIdentifier : Allow user to set CatalogIdentifier -func (_options *GetObjectAuditOptions) SetCatalogIdentifier(catalogIdentifier string) *GetObjectAuditOptions { - _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) - return _options -} + // A map of translated strings, by language code. + ShortDescriptionI18n map[string]string `json:"short_description_i18n,omitempty"` -// SetObjectIdentifier : Allow user to set ObjectIdentifier -func (_options *GetObjectAuditOptions) SetObjectIdentifier(objectIdentifier string) *GetObjectAuditOptions { - _options.ObjectIdentifier = core.StringPtr(objectIdentifier) - return _options -} + // Kind of object. + Kind *string `json:"kind,omitempty"` -// SetHeaders : Allow user to set Headers -func (options *GetObjectAuditOptions) SetHeaders(param map[string]string) *GetObjectAuditOptions { - options.Headers = param - return options -} + // Publish information. + Publish *PublishObject `json:"publish,omitempty"` -// GetObjectOptions : The GetObject options. -type GetObjectOptions struct { - // Catalog identifier. - CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` + // Offering state. + State *State `json:"state,omitempty"` - // Object identifier. - ObjectIdentifier *string `json:"object_identifier" validate:"required,ne="` + // The id of the catalog containing this offering. + CatalogID *string `json:"catalog_id,omitempty"` + + // The name of the catalog. + CatalogName *string `json:"catalog_name,omitempty"` + + // Map of data values for this object. + Data map[string]interface{} `json:"data,omitempty"` // Allows users to set headers on API requests Headers map[string]string } -// NewGetObjectOptions : Instantiate GetObjectOptions -func (*CatalogManagementV1) NewGetObjectOptions(catalogIdentifier string, objectIdentifier string) *GetObjectOptions { - return &GetObjectOptions{ +// NewCreateObjectOptions : Instantiate CreateObjectOptions +func (*CatalogManagementV1) NewCreateObjectOptions(catalogIdentifier string) *CreateObjectOptions { + return &CreateObjectOptions{ CatalogIdentifier: core.StringPtr(catalogIdentifier), - ObjectIdentifier: core.StringPtr(objectIdentifier), } } // SetCatalogIdentifier : Allow user to set CatalogIdentifier -func (_options *GetObjectOptions) SetCatalogIdentifier(catalogIdentifier string) *GetObjectOptions { +func (_options *CreateObjectOptions) SetCatalogIdentifier(catalogIdentifier string) *CreateObjectOptions { _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) return _options } -// SetObjectIdentifier : Allow user to set ObjectIdentifier -func (_options *GetObjectOptions) SetObjectIdentifier(objectIdentifier string) *GetObjectOptions { - _options.ObjectIdentifier = core.StringPtr(objectIdentifier) +// SetID : Allow user to set ID +func (_options *CreateObjectOptions) SetID(id string) *CreateObjectOptions { + _options.ID = core.StringPtr(id) return _options } -// SetHeaders : Allow user to set Headers -func (options *GetObjectOptions) SetHeaders(param map[string]string) *GetObjectOptions { - options.Headers = param - return options +// SetName : Allow user to set Name +func (_options *CreateObjectOptions) SetName(name string) *CreateObjectOptions { + _options.Name = core.StringPtr(name) + return _options } -// GetOfferingAboutOptions : The GetOfferingAbout options. -type GetOfferingAboutOptions struct { - // A dotted value of `catalogID`.`versionID`. - VersionLocID *string `json:"version_loc_id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string +// SetRev : Allow user to set Rev +func (_options *CreateObjectOptions) SetRev(rev string) *CreateObjectOptions { + _options.Rev = core.StringPtr(rev) + return _options } -// NewGetOfferingAboutOptions : Instantiate GetOfferingAboutOptions -func (*CatalogManagementV1) NewGetOfferingAboutOptions(versionLocID string) *GetOfferingAboutOptions { - return &GetOfferingAboutOptions{ - VersionLocID: core.StringPtr(versionLocID), - } +// SetCRN : Allow user to set CRN +func (_options *CreateObjectOptions) SetCRN(crn string) *CreateObjectOptions { + _options.CRN = core.StringPtr(crn) + return _options } -// SetVersionLocID : Allow user to set VersionLocID -func (_options *GetOfferingAboutOptions) SetVersionLocID(versionLocID string) *GetOfferingAboutOptions { - _options.VersionLocID = core.StringPtr(versionLocID) +// SetURL : Allow user to set URL +func (_options *CreateObjectOptions) SetURL(url string) *CreateObjectOptions { + _options.URL = core.StringPtr(url) return _options } -// SetHeaders : Allow user to set Headers -func (options *GetOfferingAboutOptions) SetHeaders(param map[string]string) *GetOfferingAboutOptions { - options.Headers = param - return options +// SetParentID : Allow user to set ParentID +func (_options *CreateObjectOptions) SetParentID(parentID string) *CreateObjectOptions { + _options.ParentID = core.StringPtr(parentID) + return _options } -// GetOfferingAuditOptions : The GetOfferingAudit options. -type GetOfferingAuditOptions struct { - // Catalog identifier. - CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` - - // Offering identifier. - OfferingID *string `json:"offering_id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string +// SetLabelI18n : Allow user to set LabelI18n +func (_options *CreateObjectOptions) SetLabelI18n(labelI18n map[string]string) *CreateObjectOptions { + _options.LabelI18n = labelI18n + return _options } -// NewGetOfferingAuditOptions : Instantiate GetOfferingAuditOptions -func (*CatalogManagementV1) NewGetOfferingAuditOptions(catalogIdentifier string, offeringID string) *GetOfferingAuditOptions { - return &GetOfferingAuditOptions{ - CatalogIdentifier: core.StringPtr(catalogIdentifier), - OfferingID: core.StringPtr(offeringID), - } +// SetLabel : Allow user to set Label +func (_options *CreateObjectOptions) SetLabel(label string) *CreateObjectOptions { + _options.Label = core.StringPtr(label) + return _options } -// SetCatalogIdentifier : Allow user to set CatalogIdentifier -func (_options *GetOfferingAuditOptions) SetCatalogIdentifier(catalogIdentifier string) *GetOfferingAuditOptions { - _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) +// SetTags : Allow user to set Tags +func (_options *CreateObjectOptions) SetTags(tags []string) *CreateObjectOptions { + _options.Tags = tags return _options } -// SetOfferingID : Allow user to set OfferingID -func (_options *GetOfferingAuditOptions) SetOfferingID(offeringID string) *GetOfferingAuditOptions { - _options.OfferingID = core.StringPtr(offeringID) +// SetCreated : Allow user to set Created +func (_options *CreateObjectOptions) SetCreated(created *strfmt.DateTime) *CreateObjectOptions { + _options.Created = created return _options } -// SetHeaders : Allow user to set Headers -func (options *GetOfferingAuditOptions) SetHeaders(param map[string]string) *GetOfferingAuditOptions { - options.Headers = param - return options +// SetUpdated : Allow user to set Updated +func (_options *CreateObjectOptions) SetUpdated(updated *strfmt.DateTime) *CreateObjectOptions { + _options.Updated = updated + return _options } -// GetOfferingContainerImagesOptions : The GetOfferingContainerImages options. -type GetOfferingContainerImagesOptions struct { - // A dotted value of `catalogID`.`versionID`. - VersionLocID *string `json:"version_loc_id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string +// SetShortDescription : Allow user to set ShortDescription +func (_options *CreateObjectOptions) SetShortDescription(shortDescription string) *CreateObjectOptions { + _options.ShortDescription = core.StringPtr(shortDescription) + return _options } -// NewGetOfferingContainerImagesOptions : Instantiate GetOfferingContainerImagesOptions -func (*CatalogManagementV1) NewGetOfferingContainerImagesOptions(versionLocID string) *GetOfferingContainerImagesOptions { - return &GetOfferingContainerImagesOptions{ - VersionLocID: core.StringPtr(versionLocID), - } +// SetShortDescriptionI18n : Allow user to set ShortDescriptionI18n +func (_options *CreateObjectOptions) SetShortDescriptionI18n(shortDescriptionI18n map[string]string) *CreateObjectOptions { + _options.ShortDescriptionI18n = shortDescriptionI18n + return _options } -// SetVersionLocID : Allow user to set VersionLocID -func (_options *GetOfferingContainerImagesOptions) SetVersionLocID(versionLocID string) *GetOfferingContainerImagesOptions { - _options.VersionLocID = core.StringPtr(versionLocID) +// SetKind : Allow user to set Kind +func (_options *CreateObjectOptions) SetKind(kind string) *CreateObjectOptions { + _options.Kind = core.StringPtr(kind) return _options } -// SetHeaders : Allow user to set Headers -func (options *GetOfferingContainerImagesOptions) SetHeaders(param map[string]string) *GetOfferingContainerImagesOptions { - options.Headers = param - return options +// SetPublish : Allow user to set Publish +func (_options *CreateObjectOptions) SetPublish(publish *PublishObject) *CreateObjectOptions { + _options.Publish = publish + return _options } -// GetOfferingInstanceOptions : The GetOfferingInstance options. -type GetOfferingInstanceOptions struct { - // Version Instance identifier. - InstanceIdentifier *string `json:"instance_identifier" validate:"required,ne="` +// SetState : Allow user to set State +func (_options *CreateObjectOptions) SetState(state *State) *CreateObjectOptions { + _options.State = state + return _options +} - // Allows users to set headers on API requests - Headers map[string]string +// SetCatalogID : Allow user to set CatalogID +func (_options *CreateObjectOptions) SetCatalogID(catalogID string) *CreateObjectOptions { + _options.CatalogID = core.StringPtr(catalogID) + return _options } -// NewGetOfferingInstanceOptions : Instantiate GetOfferingInstanceOptions -func (*CatalogManagementV1) NewGetOfferingInstanceOptions(instanceIdentifier string) *GetOfferingInstanceOptions { - return &GetOfferingInstanceOptions{ - InstanceIdentifier: core.StringPtr(instanceIdentifier), - } +// SetCatalogName : Allow user to set CatalogName +func (_options *CreateObjectOptions) SetCatalogName(catalogName string) *CreateObjectOptions { + _options.CatalogName = core.StringPtr(catalogName) + return _options } -// SetInstanceIdentifier : Allow user to set InstanceIdentifier -func (_options *GetOfferingInstanceOptions) SetInstanceIdentifier(instanceIdentifier string) *GetOfferingInstanceOptions { - _options.InstanceIdentifier = core.StringPtr(instanceIdentifier) +// SetData : Allow user to set Data +func (_options *CreateObjectOptions) SetData(data map[string]interface{}) *CreateObjectOptions { + _options.Data = data return _options } // SetHeaders : Allow user to set Headers -func (options *GetOfferingInstanceOptions) SetHeaders(param map[string]string) *GetOfferingInstanceOptions { +func (options *CreateObjectOptions) SetHeaders(param map[string]string) *CreateObjectOptions { options.Headers = param return options } -// GetOfferingLicenseOptions : The GetOfferingLicense options. -type GetOfferingLicenseOptions struct { - // A dotted value of `catalogID`.`versionID`. - VersionLocID *string `json:"version_loc_id" validate:"required,ne="` - - // The ID of the license, which maps to the file name in the 'licenses' directory of this verions tgz file. - LicenseID *string `json:"license_id" validate:"required,ne="` +// CreateOfferingInstanceOptions : The CreateOfferingInstance options. +type CreateOfferingInstanceOptions struct { + // IAM Refresh token. + XAuthRefreshToken *string `json:"X-Auth-Refresh-Token" validate:"required"` + + // provisioned instance ID (part of the CRN). + ID *string `json:"id,omitempty"` + + // Cloudant revision. + Rev *string `json:"_rev,omitempty"` + + // url reference to this object. + URL *string `json:"url,omitempty"` + + // platform CRN for this instance. + CRN *string `json:"crn,omitempty"` + + // the label for this instance. + Label *string `json:"label,omitempty"` + + // Catalog ID this instance was created from. + CatalogID *string `json:"catalog_id,omitempty"` + + // Offering ID this instance was created from. + OfferingID *string `json:"offering_id,omitempty"` + + // the format this instance has (helm, operator, ova...). + KindFormat *string `json:"kind_format,omitempty"` + + // The version this instance was installed from (semver - not version id). + Version *string `json:"version,omitempty"` + + // The version id this instance was installed from (version id - not semver). + VersionID *string `json:"version_id,omitempty"` + + // Cluster ID. + ClusterID *string `json:"cluster_id,omitempty"` + + // Cluster region (e.g., us-south). + ClusterRegion *string `json:"cluster_region,omitempty"` + + // List of target namespaces to install into. + ClusterNamespaces []string `json:"cluster_namespaces,omitempty"` + + // designate to install into all namespaces. + ClusterAllNamespaces *bool `json:"cluster_all_namespaces,omitempty"` + + // Id of the schematics workspace, for offering instances provisioned through schematics. + SchematicsWorkspaceID *string `json:"schematics_workspace_id,omitempty"` + + // Type of install plan (also known as approval strategy) for operator subscriptions. Can be either automatic, which + // automatically upgrades operators to the latest in a channel, or manual, which requires approval on the cluster. + InstallPlan *string `json:"install_plan,omitempty"` + + // Channel to pin the operator subscription to. + Channel *string `json:"channel,omitempty"` + + // date and time create. + Created *strfmt.DateTime `json:"created,omitempty"` + + // date and time updated. + Updated *strfmt.DateTime `json:"updated,omitempty"` + + // Map of metadata values for this offering instance. + Metadata map[string]interface{} `json:"metadata,omitempty"` + + // Id of the resource group to provision the offering instance into. + ResourceGroupID *string `json:"resource_group_id,omitempty"` + + // String location of OfferingInstance deployment. + Location *string `json:"location,omitempty"` + + // Indicates if Resource Controller has disabled this instance. + Disabled *bool `json:"disabled,omitempty"` + + // The account this instance is owned by. + Account *string `json:"account,omitempty"` + + // the last operation performed and status. + LastOperation *OfferingInstanceLastOperation `json:"last_operation,omitempty"` + + // The target kind for the installed software version. + KindTarget *string `json:"kind_target,omitempty"` + + // The digest value of the installed software version. + Sha *string `json:"sha,omitempty"` // Allows users to set headers on API requests Headers map[string]string } -// NewGetOfferingLicenseOptions : Instantiate GetOfferingLicenseOptions -func (*CatalogManagementV1) NewGetOfferingLicenseOptions(versionLocID string, licenseID string) *GetOfferingLicenseOptions { - return &GetOfferingLicenseOptions{ - VersionLocID: core.StringPtr(versionLocID), - LicenseID: core.StringPtr(licenseID), +// NewCreateOfferingInstanceOptions : Instantiate CreateOfferingInstanceOptions +func (*CatalogManagementV1) NewCreateOfferingInstanceOptions(xAuthRefreshToken string) *CreateOfferingInstanceOptions { + return &CreateOfferingInstanceOptions{ + XAuthRefreshToken: core.StringPtr(xAuthRefreshToken), } } -// SetVersionLocID : Allow user to set VersionLocID -func (_options *GetOfferingLicenseOptions) SetVersionLocID(versionLocID string) *GetOfferingLicenseOptions { - _options.VersionLocID = core.StringPtr(versionLocID) +// SetXAuthRefreshToken : Allow user to set XAuthRefreshToken +func (_options *CreateOfferingInstanceOptions) SetXAuthRefreshToken(xAuthRefreshToken string) *CreateOfferingInstanceOptions { + _options.XAuthRefreshToken = core.StringPtr(xAuthRefreshToken) return _options } -// SetLicenseID : Allow user to set LicenseID -func (_options *GetOfferingLicenseOptions) SetLicenseID(licenseID string) *GetOfferingLicenseOptions { - _options.LicenseID = core.StringPtr(licenseID) +// SetID : Allow user to set ID +func (_options *CreateOfferingInstanceOptions) SetID(id string) *CreateOfferingInstanceOptions { + _options.ID = core.StringPtr(id) return _options } -// SetHeaders : Allow user to set Headers -func (options *GetOfferingLicenseOptions) SetHeaders(param map[string]string) *GetOfferingLicenseOptions { - options.Headers = param - return options +// SetRev : Allow user to set Rev +func (_options *CreateOfferingInstanceOptions) SetRev(rev string) *CreateOfferingInstanceOptions { + _options.Rev = core.StringPtr(rev) + return _options } -// GetOfferingOptions : The GetOffering options. -type GetOfferingOptions struct { - // Catalog identifier. - CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` - - // Offering identification. - OfferingID *string `json:"offering_id" validate:"required,ne="` - - // Offering Parameter Type. Valid values are 'name' or 'id'. Default is 'id'. - Type *string `json:"type,omitempty"` - - // Return the digest format of the specified offering. Default is false. - Digest *bool `json:"digest,omitempty"` +// SetURL : Allow user to set URL +func (_options *CreateOfferingInstanceOptions) SetURL(url string) *CreateOfferingInstanceOptions { + _options.URL = core.StringPtr(url) + return _options +} - // Allows users to set headers on API requests - Headers map[string]string +// SetCRN : Allow user to set CRN +func (_options *CreateOfferingInstanceOptions) SetCRN(crn string) *CreateOfferingInstanceOptions { + _options.CRN = core.StringPtr(crn) + return _options } -// NewGetOfferingOptions : Instantiate GetOfferingOptions -func (*CatalogManagementV1) NewGetOfferingOptions(catalogIdentifier string, offeringID string) *GetOfferingOptions { - return &GetOfferingOptions{ - CatalogIdentifier: core.StringPtr(catalogIdentifier), - OfferingID: core.StringPtr(offeringID), - } +// SetLabel : Allow user to set Label +func (_options *CreateOfferingInstanceOptions) SetLabel(label string) *CreateOfferingInstanceOptions { + _options.Label = core.StringPtr(label) + return _options } -// SetCatalogIdentifier : Allow user to set CatalogIdentifier -func (_options *GetOfferingOptions) SetCatalogIdentifier(catalogIdentifier string) *GetOfferingOptions { - _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) +// SetCatalogID : Allow user to set CatalogID +func (_options *CreateOfferingInstanceOptions) SetCatalogID(catalogID string) *CreateOfferingInstanceOptions { + _options.CatalogID = core.StringPtr(catalogID) return _options } // SetOfferingID : Allow user to set OfferingID -func (_options *GetOfferingOptions) SetOfferingID(offeringID string) *GetOfferingOptions { +func (_options *CreateOfferingInstanceOptions) SetOfferingID(offeringID string) *CreateOfferingInstanceOptions { _options.OfferingID = core.StringPtr(offeringID) return _options } -// SetType : Allow user to set Type -func (_options *GetOfferingOptions) SetType(typeVar string) *GetOfferingOptions { - _options.Type = core.StringPtr(typeVar) +// SetKindFormat : Allow user to set KindFormat +func (_options *CreateOfferingInstanceOptions) SetKindFormat(kindFormat string) *CreateOfferingInstanceOptions { + _options.KindFormat = core.StringPtr(kindFormat) return _options } -// SetDigest : Allow user to set Digest -func (_options *GetOfferingOptions) SetDigest(digest bool) *GetOfferingOptions { - _options.Digest = core.BoolPtr(digest) +// SetVersion : Allow user to set Version +func (_options *CreateOfferingInstanceOptions) SetVersion(version string) *CreateOfferingInstanceOptions { + _options.Version = core.StringPtr(version) return _options } -// SetHeaders : Allow user to set Headers -func (options *GetOfferingOptions) SetHeaders(param map[string]string) *GetOfferingOptions { - options.Headers = param - return options +// SetVersionID : Allow user to set VersionID +func (_options *CreateOfferingInstanceOptions) SetVersionID(versionID string) *CreateOfferingInstanceOptions { + _options.VersionID = core.StringPtr(versionID) + return _options } -// GetOfferingSourceOptions : The GetOfferingSource options. -type GetOfferingSourceOptions struct { - // The version being requested. - Version *string `json:"version" validate:"required"` - - // The type of the response: application/yaml, application/json, or application/x-gzip. - Accept *string `json:"Accept,omitempty"` - - // Catlaog ID. If not specified, this value will default to the public catalog. - CatalogID *string `json:"catalogID,omitempty"` +// SetClusterID : Allow user to set ClusterID +func (_options *CreateOfferingInstanceOptions) SetClusterID(clusterID string) *CreateOfferingInstanceOptions { + _options.ClusterID = core.StringPtr(clusterID) + return _options +} - // Offering name. An offering name or ID must be specified. - Name *string `json:"name,omitempty"` +// SetClusterRegion : Allow user to set ClusterRegion +func (_options *CreateOfferingInstanceOptions) SetClusterRegion(clusterRegion string) *CreateOfferingInstanceOptions { + _options.ClusterRegion = core.StringPtr(clusterRegion) + return _options +} - // Offering id. An offering name or ID must be specified. - ID *string `json:"id,omitempty"` +// SetClusterNamespaces : Allow user to set ClusterNamespaces +func (_options *CreateOfferingInstanceOptions) SetClusterNamespaces(clusterNamespaces []string) *CreateOfferingInstanceOptions { + _options.ClusterNamespaces = clusterNamespaces + return _options +} - // The kind of offering (e.g. helm, ova, terraform...). - Kind *string `json:"kind,omitempty"` +// SetClusterAllNamespaces : Allow user to set ClusterAllNamespaces +func (_options *CreateOfferingInstanceOptions) SetClusterAllNamespaces(clusterAllNamespaces bool) *CreateOfferingInstanceOptions { + _options.ClusterAllNamespaces = core.BoolPtr(clusterAllNamespaces) + return _options +} - // The channel value of the specified version. - Channel *string `json:"channel,omitempty"` +// SetSchematicsWorkspaceID : Allow user to set SchematicsWorkspaceID +func (_options *CreateOfferingInstanceOptions) SetSchematicsWorkspaceID(schematicsWorkspaceID string) *CreateOfferingInstanceOptions { + _options.SchematicsWorkspaceID = core.StringPtr(schematicsWorkspaceID) + return _options +} - // Allows users to set headers on API requests - Headers map[string]string +// SetInstallPlan : Allow user to set InstallPlan +func (_options *CreateOfferingInstanceOptions) SetInstallPlan(installPlan string) *CreateOfferingInstanceOptions { + _options.InstallPlan = core.StringPtr(installPlan) + return _options } -// NewGetOfferingSourceOptions : Instantiate GetOfferingSourceOptions -func (*CatalogManagementV1) NewGetOfferingSourceOptions(version string) *GetOfferingSourceOptions { - return &GetOfferingSourceOptions{ - Version: core.StringPtr(version), - } +// SetChannel : Allow user to set Channel +func (_options *CreateOfferingInstanceOptions) SetChannel(channel string) *CreateOfferingInstanceOptions { + _options.Channel = core.StringPtr(channel) + return _options } -// SetVersion : Allow user to set Version -func (_options *GetOfferingSourceOptions) SetVersion(version string) *GetOfferingSourceOptions { - _options.Version = core.StringPtr(version) +// SetCreated : Allow user to set Created +func (_options *CreateOfferingInstanceOptions) SetCreated(created *strfmt.DateTime) *CreateOfferingInstanceOptions { + _options.Created = created return _options } -// SetAccept : Allow user to set Accept -func (_options *GetOfferingSourceOptions) SetAccept(accept string) *GetOfferingSourceOptions { - _options.Accept = core.StringPtr(accept) +// SetUpdated : Allow user to set Updated +func (_options *CreateOfferingInstanceOptions) SetUpdated(updated *strfmt.DateTime) *CreateOfferingInstanceOptions { + _options.Updated = updated return _options } -// SetCatalogID : Allow user to set CatalogID -func (_options *GetOfferingSourceOptions) SetCatalogID(catalogID string) *GetOfferingSourceOptions { - _options.CatalogID = core.StringPtr(catalogID) +// SetMetadata : Allow user to set Metadata +func (_options *CreateOfferingInstanceOptions) SetMetadata(metadata map[string]interface{}) *CreateOfferingInstanceOptions { + _options.Metadata = metadata return _options } -// SetName : Allow user to set Name -func (_options *GetOfferingSourceOptions) SetName(name string) *GetOfferingSourceOptions { - _options.Name = core.StringPtr(name) +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *CreateOfferingInstanceOptions) SetResourceGroupID(resourceGroupID string) *CreateOfferingInstanceOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) return _options } -// SetID : Allow user to set ID -func (_options *GetOfferingSourceOptions) SetID(id string) *GetOfferingSourceOptions { - _options.ID = core.StringPtr(id) +// SetLocation : Allow user to set Location +func (_options *CreateOfferingInstanceOptions) SetLocation(location string) *CreateOfferingInstanceOptions { + _options.Location = core.StringPtr(location) return _options } -// SetKind : Allow user to set Kind -func (_options *GetOfferingSourceOptions) SetKind(kind string) *GetOfferingSourceOptions { - _options.Kind = core.StringPtr(kind) +// SetDisabled : Allow user to set Disabled +func (_options *CreateOfferingInstanceOptions) SetDisabled(disabled bool) *CreateOfferingInstanceOptions { + _options.Disabled = core.BoolPtr(disabled) return _options } -// SetChannel : Allow user to set Channel -func (_options *GetOfferingSourceOptions) SetChannel(channel string) *GetOfferingSourceOptions { - _options.Channel = core.StringPtr(channel) +// SetAccount : Allow user to set Account +func (_options *CreateOfferingInstanceOptions) SetAccount(account string) *CreateOfferingInstanceOptions { + _options.Account = core.StringPtr(account) return _options } -// SetHeaders : Allow user to set Headers -func (options *GetOfferingSourceOptions) SetHeaders(param map[string]string) *GetOfferingSourceOptions { +// SetLastOperation : Allow user to set LastOperation +func (_options *CreateOfferingInstanceOptions) SetLastOperation(lastOperation *OfferingInstanceLastOperation) *CreateOfferingInstanceOptions { + _options.LastOperation = lastOperation + return _options +} + +// SetKindTarget : Allow user to set KindTarget +func (_options *CreateOfferingInstanceOptions) SetKindTarget(kindTarget string) *CreateOfferingInstanceOptions { + _options.KindTarget = core.StringPtr(kindTarget) + return _options +} + +// SetSha : Allow user to set Sha +func (_options *CreateOfferingInstanceOptions) SetSha(sha string) *CreateOfferingInstanceOptions { + _options.Sha = core.StringPtr(sha) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateOfferingInstanceOptions) SetHeaders(param map[string]string) *CreateOfferingInstanceOptions { options.Headers = param return options } -// GetOfferingUpdatesOptions : The GetOfferingUpdates options. -type GetOfferingUpdatesOptions struct { +// CreateOfferingOptions : The CreateOffering options. +type CreateOfferingOptions struct { // Catalog identifier. CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` - // Offering identification. - OfferingID *string `json:"offering_id" validate:"required,ne="` + // unique id. + ID *string `json:"id,omitempty"` - // The kind of offering (e.g, helm, ova, terraform ...). - Kind *string `json:"kind" validate:"required"` + // Cloudant revision. + Rev *string `json:"_rev,omitempty"` - // IAM Refresh token. - XAuthRefreshToken *string `json:"X-Auth-Refresh-Token" validate:"required"` + // The url for this specific offering. + URL *string `json:"url,omitempty"` - // The target kind of the currently installed version (e.g. iks, roks, etc). - Target *string `json:"target,omitempty"` + // The crn for this specific offering. + CRN *string `json:"crn,omitempty"` - // optionaly provide an existing version to check updates for if one is not given, all version will be returned. - Version *string `json:"version,omitempty"` + // Display Name in the requested language. + Label *string `json:"label,omitempty"` - // The id of the cluster where this version was installed. - ClusterID *string `json:"cluster_id,omitempty"` + // A map of translated strings, by language code. + LabelI18n map[string]string `json:"label_i18n,omitempty"` - // The region of the cluster where this version was installed. - Region *string `json:"region,omitempty"` + // The programmatic name of this offering. + Name *string `json:"name,omitempty"` - // The resource group id of the cluster where this version was installed. - ResourceGroupID *string `json:"resource_group_id,omitempty"` + // URL for an icon associated with this offering. + OfferingIconURL *string `json:"offering_icon_url,omitempty"` - // The namespace of the cluster where this version was installed. - Namespace *string `json:"namespace,omitempty"` + // URL for an additional docs with this offering. + OfferingDocsURL *string `json:"offering_docs_url,omitempty"` - // The sha value of the currently installed version. - Sha *string `json:"sha,omitempty"` + // [deprecated] - Use offering.support instead. URL to be displayed in the Consumption UI for getting support on this + // offering. + OfferingSupportURL *string `json:"offering_support_url,omitempty"` - // Optionally provide the channel value of the currently installed version. - Channel *string `json:"channel,omitempty"` + // List of tags associated with this catalog. + Tags []string `json:"tags,omitempty"` - // Optionally provide a list of namespaces used for the currently installed version. - Namespaces []string `json:"namespaces,omitempty"` + // List of keywords associated with offering, typically used to search for it. + Keywords []string `json:"keywords,omitempty"` - // Optionally indicate that the current version was installed in all namespaces. - AllNamespaces *bool `json:"all_namespaces,omitempty"` + // Repository info for offerings. + Rating *Rating `json:"rating,omitempty"` + + // The date and time this catalog was created. + Created *strfmt.DateTime `json:"created,omitempty"` + + // The date and time this catalog was last updated. + Updated *strfmt.DateTime `json:"updated,omitempty"` + + // Short description in the requested language. + ShortDescription *string `json:"short_description,omitempty"` + + // A map of translated strings, by language code. + ShortDescriptionI18n map[string]string `json:"short_description_i18n,omitempty"` + + // Long description in the requested language. + LongDescription *string `json:"long_description,omitempty"` + + // A map of translated strings, by language code. + LongDescriptionI18n map[string]string `json:"long_description_i18n,omitempty"` + + // list of features associated with this offering. + Features []Feature `json:"features,omitempty"` + + // Array of kind. + Kinds []Kind `json:"kinds,omitempty"` + + // Offering is managed by Partner Center. + PcManaged *bool `json:"pc_managed,omitempty"` + + // Offering has been approved to publish to permitted to IBM or Public Catalog. + PublishApproved *bool `json:"publish_approved,omitempty"` + + // Denotes public availability of an Offering - if share_enabled is true. + ShareWithAll *bool `json:"share_with_all,omitempty"` + + // Denotes IBM employee availability of an Offering - if share_enabled is true. + ShareWithIBM *bool `json:"share_with_ibm,omitempty"` + + // Denotes sharing including access list availability of an Offering is enabled. + ShareEnabled *bool `json:"share_enabled,omitempty"` + + // Is it permitted to request publishing to IBM or Public. + PermitRequestIBMPublicPublish *bool `json:"permit_request_ibm_public_publish,omitempty"` + + // Indicates if this offering has been approved for use by all IBMers. + IBMPublishApproved *bool `json:"ibm_publish_approved,omitempty"` + + // Indicates if this offering has been approved for use by all IBM Cloud users. + PublicPublishApproved *bool `json:"public_publish_approved,omitempty"` + + // The original offering CRN that this publish entry came from. + PublicOriginalCRN *string `json:"public_original_crn,omitempty"` + + // The crn of the public catalog entry of this offering. + PublishPublicCRN *string `json:"publish_public_crn,omitempty"` + + // The portal's approval record ID. + PortalApprovalRecord *string `json:"portal_approval_record,omitempty"` + + // The portal UI URL. + PortalUIURL *string `json:"portal_ui_url,omitempty"` + + // The id of the catalog containing this offering. + CatalogID *string `json:"catalog_id,omitempty"` + + // The name of the catalog. + CatalogName *string `json:"catalog_name,omitempty"` + + // Map of metadata values for this offering. + Metadata map[string]interface{} `json:"metadata,omitempty"` + + // A disclaimer for this offering. + Disclaimer *string `json:"disclaimer,omitempty"` + + // Determine if this offering should be displayed in the Consumption UI. + Hidden *bool `json:"hidden,omitempty"` + + // Deprecated - Provider of this offering. + Provider *string `json:"provider,omitempty"` + + // Information on the provider for this offering, or omitted if no provider information is given. + ProviderInfo *ProviderInfo `json:"provider_info,omitempty"` + + // Repository info for offerings. + RepoInfo *RepoInfo `json:"repo_info,omitempty"` + + // Image pull keys for this offering. + ImagePullKeys []ImagePullKey `json:"image_pull_keys,omitempty"` + + // Offering Support information. + Support *Support `json:"support,omitempty"` + + // A list of media items related to this offering. + Media []MediaItem `json:"media,omitempty"` + + // Deprecation information for an Offering. + DeprecatePending *DeprecatePending `json:"deprecate_pending,omitempty"` + + // The product kind. Valid values are module, solution, or empty string. + ProductKind *string `json:"product_kind,omitempty"` + + // A list of badges for this offering. + Badges []Badge `json:"badges,omitempty"` // Allows users to set headers on API requests Headers map[string]string } -// NewGetOfferingUpdatesOptions : Instantiate GetOfferingUpdatesOptions -func (*CatalogManagementV1) NewGetOfferingUpdatesOptions(catalogIdentifier string, offeringID string, kind string, xAuthRefreshToken string) *GetOfferingUpdatesOptions { - return &GetOfferingUpdatesOptions{ +// NewCreateOfferingOptions : Instantiate CreateOfferingOptions +func (*CatalogManagementV1) NewCreateOfferingOptions(catalogIdentifier string) *CreateOfferingOptions { + return &CreateOfferingOptions{ CatalogIdentifier: core.StringPtr(catalogIdentifier), - OfferingID: core.StringPtr(offeringID), - Kind: core.StringPtr(kind), - XAuthRefreshToken: core.StringPtr(xAuthRefreshToken), } } // SetCatalogIdentifier : Allow user to set CatalogIdentifier -func (_options *GetOfferingUpdatesOptions) SetCatalogIdentifier(catalogIdentifier string) *GetOfferingUpdatesOptions { +func (_options *CreateOfferingOptions) SetCatalogIdentifier(catalogIdentifier string) *CreateOfferingOptions { _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) return _options } -// SetOfferingID : Allow user to set OfferingID -func (_options *GetOfferingUpdatesOptions) SetOfferingID(offeringID string) *GetOfferingUpdatesOptions { - _options.OfferingID = core.StringPtr(offeringID) +// SetID : Allow user to set ID +func (_options *CreateOfferingOptions) SetID(id string) *CreateOfferingOptions { + _options.ID = core.StringPtr(id) return _options } -// SetKind : Allow user to set Kind -func (_options *GetOfferingUpdatesOptions) SetKind(kind string) *GetOfferingUpdatesOptions { - _options.Kind = core.StringPtr(kind) +// SetRev : Allow user to set Rev +func (_options *CreateOfferingOptions) SetRev(rev string) *CreateOfferingOptions { + _options.Rev = core.StringPtr(rev) return _options } -// SetXAuthRefreshToken : Allow user to set XAuthRefreshToken -func (_options *GetOfferingUpdatesOptions) SetXAuthRefreshToken(xAuthRefreshToken string) *GetOfferingUpdatesOptions { - _options.XAuthRefreshToken = core.StringPtr(xAuthRefreshToken) +// SetURL : Allow user to set URL +func (_options *CreateOfferingOptions) SetURL(url string) *CreateOfferingOptions { + _options.URL = core.StringPtr(url) return _options } -// SetTarget : Allow user to set Target -func (_options *GetOfferingUpdatesOptions) SetTarget(target string) *GetOfferingUpdatesOptions { - _options.Target = core.StringPtr(target) +// SetCRN : Allow user to set CRN +func (_options *CreateOfferingOptions) SetCRN(crn string) *CreateOfferingOptions { + _options.CRN = core.StringPtr(crn) return _options } -// SetVersion : Allow user to set Version -func (_options *GetOfferingUpdatesOptions) SetVersion(version string) *GetOfferingUpdatesOptions { - _options.Version = core.StringPtr(version) +// SetLabel : Allow user to set Label +func (_options *CreateOfferingOptions) SetLabel(label string) *CreateOfferingOptions { + _options.Label = core.StringPtr(label) return _options } -// SetClusterID : Allow user to set ClusterID -func (_options *GetOfferingUpdatesOptions) SetClusterID(clusterID string) *GetOfferingUpdatesOptions { - _options.ClusterID = core.StringPtr(clusterID) +// SetLabelI18n : Allow user to set LabelI18n +func (_options *CreateOfferingOptions) SetLabelI18n(labelI18n map[string]string) *CreateOfferingOptions { + _options.LabelI18n = labelI18n return _options } -// SetRegion : Allow user to set Region -func (_options *GetOfferingUpdatesOptions) SetRegion(region string) *GetOfferingUpdatesOptions { - _options.Region = core.StringPtr(region) +// SetName : Allow user to set Name +func (_options *CreateOfferingOptions) SetName(name string) *CreateOfferingOptions { + _options.Name = core.StringPtr(name) return _options } -// SetResourceGroupID : Allow user to set ResourceGroupID -func (_options *GetOfferingUpdatesOptions) SetResourceGroupID(resourceGroupID string) *GetOfferingUpdatesOptions { - _options.ResourceGroupID = core.StringPtr(resourceGroupID) +// SetOfferingIconURL : Allow user to set OfferingIconURL +func (_options *CreateOfferingOptions) SetOfferingIconURL(offeringIconURL string) *CreateOfferingOptions { + _options.OfferingIconURL = core.StringPtr(offeringIconURL) return _options } -// SetNamespace : Allow user to set Namespace -func (_options *GetOfferingUpdatesOptions) SetNamespace(namespace string) *GetOfferingUpdatesOptions { - _options.Namespace = core.StringPtr(namespace) +// SetOfferingDocsURL : Allow user to set OfferingDocsURL +func (_options *CreateOfferingOptions) SetOfferingDocsURL(offeringDocsURL string) *CreateOfferingOptions { + _options.OfferingDocsURL = core.StringPtr(offeringDocsURL) return _options } -// SetSha : Allow user to set Sha -func (_options *GetOfferingUpdatesOptions) SetSha(sha string) *GetOfferingUpdatesOptions { - _options.Sha = core.StringPtr(sha) +// SetOfferingSupportURL : Allow user to set OfferingSupportURL +func (_options *CreateOfferingOptions) SetOfferingSupportURL(offeringSupportURL string) *CreateOfferingOptions { + _options.OfferingSupportURL = core.StringPtr(offeringSupportURL) return _options } -// SetChannel : Allow user to set Channel -func (_options *GetOfferingUpdatesOptions) SetChannel(channel string) *GetOfferingUpdatesOptions { - _options.Channel = core.StringPtr(channel) +// SetTags : Allow user to set Tags +func (_options *CreateOfferingOptions) SetTags(tags []string) *CreateOfferingOptions { + _options.Tags = tags return _options } -// SetNamespaces : Allow user to set Namespaces -func (_options *GetOfferingUpdatesOptions) SetNamespaces(namespaces []string) *GetOfferingUpdatesOptions { - _options.Namespaces = namespaces +// SetKeywords : Allow user to set Keywords +func (_options *CreateOfferingOptions) SetKeywords(keywords []string) *CreateOfferingOptions { + _options.Keywords = keywords return _options } -// SetAllNamespaces : Allow user to set AllNamespaces -func (_options *GetOfferingUpdatesOptions) SetAllNamespaces(allNamespaces bool) *GetOfferingUpdatesOptions { - _options.AllNamespaces = core.BoolPtr(allNamespaces) +// SetRating : Allow user to set Rating +func (_options *CreateOfferingOptions) SetRating(rating *Rating) *CreateOfferingOptions { + _options.Rating = rating return _options } -// SetHeaders : Allow user to set Headers -func (options *GetOfferingUpdatesOptions) SetHeaders(param map[string]string) *GetOfferingUpdatesOptions { - options.Headers = param - return options +// SetCreated : Allow user to set Created +func (_options *CreateOfferingOptions) SetCreated(created *strfmt.DateTime) *CreateOfferingOptions { + _options.Created = created + return _options } -// GetOfferingWorkingCopyOptions : The GetOfferingWorkingCopy options. -type GetOfferingWorkingCopyOptions struct { - // A dotted value of `catalogID`.`versionID`. - VersionLocID *string `json:"version_loc_id" validate:"required,ne="` +// SetUpdated : Allow user to set Updated +func (_options *CreateOfferingOptions) SetUpdated(updated *strfmt.DateTime) *CreateOfferingOptions { + _options.Updated = updated + return _options +} - // Allows users to set headers on API requests - Headers map[string]string +// SetShortDescription : Allow user to set ShortDescription +func (_options *CreateOfferingOptions) SetShortDescription(shortDescription string) *CreateOfferingOptions { + _options.ShortDescription = core.StringPtr(shortDescription) + return _options } -// NewGetOfferingWorkingCopyOptions : Instantiate GetOfferingWorkingCopyOptions -func (*CatalogManagementV1) NewGetOfferingWorkingCopyOptions(versionLocID string) *GetOfferingWorkingCopyOptions { - return &GetOfferingWorkingCopyOptions{ - VersionLocID: core.StringPtr(versionLocID), - } +// SetShortDescriptionI18n : Allow user to set ShortDescriptionI18n +func (_options *CreateOfferingOptions) SetShortDescriptionI18n(shortDescriptionI18n map[string]string) *CreateOfferingOptions { + _options.ShortDescriptionI18n = shortDescriptionI18n + return _options } -// SetVersionLocID : Allow user to set VersionLocID -func (_options *GetOfferingWorkingCopyOptions) SetVersionLocID(versionLocID string) *GetOfferingWorkingCopyOptions { - _options.VersionLocID = core.StringPtr(versionLocID) +// SetLongDescription : Allow user to set LongDescription +func (_options *CreateOfferingOptions) SetLongDescription(longDescription string) *CreateOfferingOptions { + _options.LongDescription = core.StringPtr(longDescription) return _options } -// SetHeaders : Allow user to set Headers -func (options *GetOfferingWorkingCopyOptions) SetHeaders(param map[string]string) *GetOfferingWorkingCopyOptions { - options.Headers = param - return options +// SetLongDescriptionI18n : Allow user to set LongDescriptionI18n +func (_options *CreateOfferingOptions) SetLongDescriptionI18n(longDescriptionI18n map[string]string) *CreateOfferingOptions { + _options.LongDescriptionI18n = longDescriptionI18n + return _options } -// GetOverrideValuesOptions : The GetOverrideValues options. -type GetOverrideValuesOptions struct { - // A dotted value of `catalogID`.`versionID`. - VersionLocID *string `json:"version_loc_id" validate:"required,ne="` +// SetFeatures : Allow user to set Features +func (_options *CreateOfferingOptions) SetFeatures(features []Feature) *CreateOfferingOptions { + _options.Features = features + return _options +} - // Allows users to set headers on API requests - Headers map[string]string +// SetKinds : Allow user to set Kinds +func (_options *CreateOfferingOptions) SetKinds(kinds []Kind) *CreateOfferingOptions { + _options.Kinds = kinds + return _options } -// NewGetOverrideValuesOptions : Instantiate GetOverrideValuesOptions -func (*CatalogManagementV1) NewGetOverrideValuesOptions(versionLocID string) *GetOverrideValuesOptions { - return &GetOverrideValuesOptions{ - VersionLocID: core.StringPtr(versionLocID), - } +// SetPcManaged : Allow user to set PcManaged +func (_options *CreateOfferingOptions) SetPcManaged(pcManaged bool) *CreateOfferingOptions { + _options.PcManaged = core.BoolPtr(pcManaged) + return _options } -// SetVersionLocID : Allow user to set VersionLocID -func (_options *GetOverrideValuesOptions) SetVersionLocID(versionLocID string) *GetOverrideValuesOptions { - _options.VersionLocID = core.StringPtr(versionLocID) +// SetPublishApproved : Allow user to set PublishApproved +func (_options *CreateOfferingOptions) SetPublishApproved(publishApproved bool) *CreateOfferingOptions { + _options.PublishApproved = core.BoolPtr(publishApproved) return _options } -// SetHeaders : Allow user to set Headers -func (options *GetOverrideValuesOptions) SetHeaders(param map[string]string) *GetOverrideValuesOptions { - options.Headers = param - return options +// SetShareWithAll : Allow user to set ShareWithAll +func (_options *CreateOfferingOptions) SetShareWithAll(shareWithAll bool) *CreateOfferingOptions { + _options.ShareWithAll = core.BoolPtr(shareWithAll) + return _options } -// GetPreinstallOptions : The GetPreinstall options. -type GetPreinstallOptions struct { - // A dotted value of `catalogID`.`versionID`. - VersionLocID *string `json:"version_loc_id" validate:"required,ne="` +// SetShareWithIBM : Allow user to set ShareWithIBM +func (_options *CreateOfferingOptions) SetShareWithIBM(shareWithIBM bool) *CreateOfferingOptions { + _options.ShareWithIBM = core.BoolPtr(shareWithIBM) + return _options +} - // IAM Refresh token. - XAuthRefreshToken *string `json:"X-Auth-Refresh-Token" validate:"required"` +// SetShareEnabled : Allow user to set ShareEnabled +func (_options *CreateOfferingOptions) SetShareEnabled(shareEnabled bool) *CreateOfferingOptions { + _options.ShareEnabled = core.BoolPtr(shareEnabled) + return _options +} - // ID of the cluster. - ClusterID *string `json:"cluster_id,omitempty"` +// SetPermitRequestIBMPublicPublish : Allow user to set PermitRequestIBMPublicPublish +func (_options *CreateOfferingOptions) SetPermitRequestIBMPublicPublish(permitRequestIBMPublicPublish bool) *CreateOfferingOptions { + _options.PermitRequestIBMPublicPublish = core.BoolPtr(permitRequestIBMPublicPublish) + return _options +} - // Cluster region. - Region *string `json:"region,omitempty"` +// SetIBMPublishApproved : Allow user to set IBMPublishApproved +func (_options *CreateOfferingOptions) SetIBMPublishApproved(ibmPublishApproved bool) *CreateOfferingOptions { + _options.IBMPublishApproved = core.BoolPtr(ibmPublishApproved) + return _options +} - // Required if the version's pre-install scope is `namespace`. - Namespace *string `json:"namespace,omitempty"` +// SetPublicPublishApproved : Allow user to set PublicPublishApproved +func (_options *CreateOfferingOptions) SetPublicPublishApproved(publicPublishApproved bool) *CreateOfferingOptions { + _options.PublicPublishApproved = core.BoolPtr(publicPublishApproved) + return _options +} - // Allows users to set headers on API requests - Headers map[string]string +// SetPublicOriginalCRN : Allow user to set PublicOriginalCRN +func (_options *CreateOfferingOptions) SetPublicOriginalCRN(publicOriginalCRN string) *CreateOfferingOptions { + _options.PublicOriginalCRN = core.StringPtr(publicOriginalCRN) + return _options } -// NewGetPreinstallOptions : Instantiate GetPreinstallOptions -func (*CatalogManagementV1) NewGetPreinstallOptions(versionLocID string, xAuthRefreshToken string) *GetPreinstallOptions { - return &GetPreinstallOptions{ - VersionLocID: core.StringPtr(versionLocID), - XAuthRefreshToken: core.StringPtr(xAuthRefreshToken), - } +// SetPublishPublicCRN : Allow user to set PublishPublicCRN +func (_options *CreateOfferingOptions) SetPublishPublicCRN(publishPublicCRN string) *CreateOfferingOptions { + _options.PublishPublicCRN = core.StringPtr(publishPublicCRN) + return _options } -// SetVersionLocID : Allow user to set VersionLocID -func (_options *GetPreinstallOptions) SetVersionLocID(versionLocID string) *GetPreinstallOptions { - _options.VersionLocID = core.StringPtr(versionLocID) +// SetPortalApprovalRecord : Allow user to set PortalApprovalRecord +func (_options *CreateOfferingOptions) SetPortalApprovalRecord(portalApprovalRecord string) *CreateOfferingOptions { + _options.PortalApprovalRecord = core.StringPtr(portalApprovalRecord) return _options } -// SetXAuthRefreshToken : Allow user to set XAuthRefreshToken -func (_options *GetPreinstallOptions) SetXAuthRefreshToken(xAuthRefreshToken string) *GetPreinstallOptions { - _options.XAuthRefreshToken = core.StringPtr(xAuthRefreshToken) +// SetPortalUIURL : Allow user to set PortalUIURL +func (_options *CreateOfferingOptions) SetPortalUIURL(portalUIURL string) *CreateOfferingOptions { + _options.PortalUIURL = core.StringPtr(portalUIURL) return _options } -// SetClusterID : Allow user to set ClusterID -func (_options *GetPreinstallOptions) SetClusterID(clusterID string) *GetPreinstallOptions { - _options.ClusterID = core.StringPtr(clusterID) +// SetCatalogID : Allow user to set CatalogID +func (_options *CreateOfferingOptions) SetCatalogID(catalogID string) *CreateOfferingOptions { + _options.CatalogID = core.StringPtr(catalogID) return _options } -// SetRegion : Allow user to set Region -func (_options *GetPreinstallOptions) SetRegion(region string) *GetPreinstallOptions { - _options.Region = core.StringPtr(region) +// SetCatalogName : Allow user to set CatalogName +func (_options *CreateOfferingOptions) SetCatalogName(catalogName string) *CreateOfferingOptions { + _options.CatalogName = core.StringPtr(catalogName) return _options } -// SetNamespace : Allow user to set Namespace -func (_options *GetPreinstallOptions) SetNamespace(namespace string) *GetPreinstallOptions { - _options.Namespace = core.StringPtr(namespace) +// SetMetadata : Allow user to set Metadata +func (_options *CreateOfferingOptions) SetMetadata(metadata map[string]interface{}) *CreateOfferingOptions { + _options.Metadata = metadata return _options } -// SetHeaders : Allow user to set Headers -func (options *GetPreinstallOptions) SetHeaders(param map[string]string) *GetPreinstallOptions { - options.Headers = param - return options +// SetDisclaimer : Allow user to set Disclaimer +func (_options *CreateOfferingOptions) SetDisclaimer(disclaimer string) *CreateOfferingOptions { + _options.Disclaimer = core.StringPtr(disclaimer) + return _options } -// GetValidationStatusOptions : The GetValidationStatus options. -type GetValidationStatusOptions struct { - // A dotted value of `catalogID`.`versionID`. - VersionLocID *string `json:"version_loc_id" validate:"required,ne="` +// SetHidden : Allow user to set Hidden +func (_options *CreateOfferingOptions) SetHidden(hidden bool) *CreateOfferingOptions { + _options.Hidden = core.BoolPtr(hidden) + return _options +} - // IAM Refresh token. - XAuthRefreshToken *string `json:"X-Auth-Refresh-Token" validate:"required"` +// SetProvider : Allow user to set Provider +func (_options *CreateOfferingOptions) SetProvider(provider string) *CreateOfferingOptions { + _options.Provider = core.StringPtr(provider) + return _options +} - // Allows users to set headers on API requests - Headers map[string]string +// SetProviderInfo : Allow user to set ProviderInfo +func (_options *CreateOfferingOptions) SetProviderInfo(providerInfo *ProviderInfo) *CreateOfferingOptions { + _options.ProviderInfo = providerInfo + return _options } -// NewGetValidationStatusOptions : Instantiate GetValidationStatusOptions -func (*CatalogManagementV1) NewGetValidationStatusOptions(versionLocID string, xAuthRefreshToken string) *GetValidationStatusOptions { - return &GetValidationStatusOptions{ - VersionLocID: core.StringPtr(versionLocID), - XAuthRefreshToken: core.StringPtr(xAuthRefreshToken), - } +// SetRepoInfo : Allow user to set RepoInfo +func (_options *CreateOfferingOptions) SetRepoInfo(repoInfo *RepoInfo) *CreateOfferingOptions { + _options.RepoInfo = repoInfo + return _options } -// SetVersionLocID : Allow user to set VersionLocID -func (_options *GetValidationStatusOptions) SetVersionLocID(versionLocID string) *GetValidationStatusOptions { - _options.VersionLocID = core.StringPtr(versionLocID) +// SetImagePullKeys : Allow user to set ImagePullKeys +func (_options *CreateOfferingOptions) SetImagePullKeys(imagePullKeys []ImagePullKey) *CreateOfferingOptions { + _options.ImagePullKeys = imagePullKeys return _options } -// SetXAuthRefreshToken : Allow user to set XAuthRefreshToken -func (_options *GetValidationStatusOptions) SetXAuthRefreshToken(xAuthRefreshToken string) *GetValidationStatusOptions { - _options.XAuthRefreshToken = core.StringPtr(xAuthRefreshToken) +// SetSupport : Allow user to set Support +func (_options *CreateOfferingOptions) SetSupport(support *Support) *CreateOfferingOptions { + _options.Support = support + return _options +} + +// SetMedia : Allow user to set Media +func (_options *CreateOfferingOptions) SetMedia(media []MediaItem) *CreateOfferingOptions { + _options.Media = media + return _options +} + +// SetDeprecatePending : Allow user to set DeprecatePending +func (_options *CreateOfferingOptions) SetDeprecatePending(deprecatePending *DeprecatePending) *CreateOfferingOptions { + _options.DeprecatePending = deprecatePending + return _options +} + +// SetProductKind : Allow user to set ProductKind +func (_options *CreateOfferingOptions) SetProductKind(productKind string) *CreateOfferingOptions { + _options.ProductKind = core.StringPtr(productKind) + return _options +} + +// SetBadges : Allow user to set Badges +func (_options *CreateOfferingOptions) SetBadges(badges []Badge) *CreateOfferingOptions { + _options.Badges = badges return _options } // SetHeaders : Allow user to set Headers -func (options *GetValidationStatusOptions) SetHeaders(param map[string]string) *GetValidationStatusOptions { +func (options *CreateOfferingOptions) SetHeaders(param map[string]string) *CreateOfferingOptions { options.Headers = param return options } -// GetVersionOptions : The GetVersion options. -type GetVersionOptions struct { - // A dotted value of `catalogID`.`versionID`. - VersionLocID *string `json:"version_loc_id" validate:"required,ne="` +// DeleteCatalogOptions : The DeleteCatalog options. +type DeleteCatalogOptions struct { + // Catalog identifier. + CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` // Allows users to set headers on API requests Headers map[string]string } -// NewGetVersionOptions : Instantiate GetVersionOptions -func (*CatalogManagementV1) NewGetVersionOptions(versionLocID string) *GetVersionOptions { - return &GetVersionOptions{ - VersionLocID: core.StringPtr(versionLocID), +// NewDeleteCatalogOptions : Instantiate DeleteCatalogOptions +func (*CatalogManagementV1) NewDeleteCatalogOptions(catalogIdentifier string) *DeleteCatalogOptions { + return &DeleteCatalogOptions{ + CatalogIdentifier: core.StringPtr(catalogIdentifier), } } -// SetVersionLocID : Allow user to set VersionLocID -func (_options *GetVersionOptions) SetVersionLocID(versionLocID string) *GetVersionOptions { - _options.VersionLocID = core.StringPtr(versionLocID) +// SetCatalogIdentifier : Allow user to set CatalogIdentifier +func (_options *DeleteCatalogOptions) SetCatalogIdentifier(catalogIdentifier string) *DeleteCatalogOptions { + _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) return _options } // SetHeaders : Allow user to set Headers -func (options *GetVersionOptions) SetHeaders(param map[string]string) *GetVersionOptions { +func (options *DeleteCatalogOptions) SetHeaders(param map[string]string) *DeleteCatalogOptions { options.Headers = param return options } -// IDFilter : Filter on offering ID's. There is an include filter and an exclule filter. Both can be set. -type IDFilter struct { - // Offering filter terms. - Include *FilterTerms `json:"include,omitempty"` - - // Offering filter terms. - Exclude *FilterTerms `json:"exclude,omitempty"` -} - -// UnmarshalIDFilter unmarshals an instance of IDFilter from the specified map of raw messages. -func UnmarshalIDFilter(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(IDFilter) - err = core.UnmarshalModel(m, "include", &obj.Include, UnmarshalFilterTerms) - if err != nil { - return - } - err = core.UnmarshalModel(m, "exclude", &obj.Exclude, UnmarshalFilterTerms) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// IBMPublishObjectOptions : The IBMPublishObject options. -type IBMPublishObjectOptions struct { +// DeleteObjectAccessListOptions : The DeleteObjectAccessList options. +type DeleteObjectAccessListOptions struct { // Catalog identifier. CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` // Object identifier. ObjectIdentifier *string `json:"object_identifier" validate:"required,ne="` + // A list of accesses to delete. An entry with star["*"] will remove all accesses. + Accesses []string `json:"accesses" validate:"required"` + // Allows users to set headers on API requests Headers map[string]string } -// NewIBMPublishObjectOptions : Instantiate IBMPublishObjectOptions -func (*CatalogManagementV1) NewIBMPublishObjectOptions(catalogIdentifier string, objectIdentifier string) *IBMPublishObjectOptions { - return &IBMPublishObjectOptions{ +// NewDeleteObjectAccessListOptions : Instantiate DeleteObjectAccessListOptions +func (*CatalogManagementV1) NewDeleteObjectAccessListOptions(catalogIdentifier string, objectIdentifier string, accesses []string) *DeleteObjectAccessListOptions { + return &DeleteObjectAccessListOptions{ CatalogIdentifier: core.StringPtr(catalogIdentifier), ObjectIdentifier: core.StringPtr(objectIdentifier), + Accesses: accesses, } } // SetCatalogIdentifier : Allow user to set CatalogIdentifier -func (_options *IBMPublishObjectOptions) SetCatalogIdentifier(catalogIdentifier string) *IBMPublishObjectOptions { +func (_options *DeleteObjectAccessListOptions) SetCatalogIdentifier(catalogIdentifier string) *DeleteObjectAccessListOptions { _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) return _options } // SetObjectIdentifier : Allow user to set ObjectIdentifier -func (_options *IBMPublishObjectOptions) SetObjectIdentifier(objectIdentifier string) *IBMPublishObjectOptions { +func (_options *DeleteObjectAccessListOptions) SetObjectIdentifier(objectIdentifier string) *DeleteObjectAccessListOptions { _options.ObjectIdentifier = core.StringPtr(objectIdentifier) return _options } +// SetAccesses : Allow user to set Accesses +func (_options *DeleteObjectAccessListOptions) SetAccesses(accesses []string) *DeleteObjectAccessListOptions { + _options.Accesses = accesses + return _options +} + // SetHeaders : Allow user to set Headers -func (options *IBMPublishObjectOptions) SetHeaders(param map[string]string) *IBMPublishObjectOptions { +func (options *DeleteObjectAccessListOptions) SetHeaders(param map[string]string) *DeleteObjectAccessListOptions { options.Headers = param return options } -// IBMPublishVersionOptions : The IBMPublishVersion options. -type IBMPublishVersionOptions struct { - // A dotted value of `catalogID`.`versionID`. - VersionLocID *string `json:"version_loc_id" validate:"required,ne="` +// DeleteObjectAccessOptions : The DeleteObjectAccess options. +type DeleteObjectAccessOptions struct { + // Catalog identifier. + CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` + + // Object identifier. + ObjectIdentifier *string `json:"object_identifier" validate:"required,ne="` + + // Identifier for access. Use 'accountId' for an account, '-ent-enterpriseid' for an enterprise, and + // '-entgroup-enterprisegroupid' for an enterprise group. + AccessIdentifier *string `json:"access_identifier" validate:"required,ne="` // Allows users to set headers on API requests Headers map[string]string } -// NewIBMPublishVersionOptions : Instantiate IBMPublishVersionOptions -func (*CatalogManagementV1) NewIBMPublishVersionOptions(versionLocID string) *IBMPublishVersionOptions { - return &IBMPublishVersionOptions{ - VersionLocID: core.StringPtr(versionLocID), +// NewDeleteObjectAccessOptions : Instantiate DeleteObjectAccessOptions +func (*CatalogManagementV1) NewDeleteObjectAccessOptions(catalogIdentifier string, objectIdentifier string, accessIdentifier string) *DeleteObjectAccessOptions { + return &DeleteObjectAccessOptions{ + CatalogIdentifier: core.StringPtr(catalogIdentifier), + ObjectIdentifier: core.StringPtr(objectIdentifier), + AccessIdentifier: core.StringPtr(accessIdentifier), } } -// SetVersionLocID : Allow user to set VersionLocID -func (_options *IBMPublishVersionOptions) SetVersionLocID(versionLocID string) *IBMPublishVersionOptions { - _options.VersionLocID = core.StringPtr(versionLocID) +// SetCatalogIdentifier : Allow user to set CatalogIdentifier +func (_options *DeleteObjectAccessOptions) SetCatalogIdentifier(catalogIdentifier string) *DeleteObjectAccessOptions { + _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) + return _options +} + +// SetObjectIdentifier : Allow user to set ObjectIdentifier +func (_options *DeleteObjectAccessOptions) SetObjectIdentifier(objectIdentifier string) *DeleteObjectAccessOptions { + _options.ObjectIdentifier = core.StringPtr(objectIdentifier) + return _options +} + +// SetAccessIdentifier : Allow user to set AccessIdentifier +func (_options *DeleteObjectAccessOptions) SetAccessIdentifier(accessIdentifier string) *DeleteObjectAccessOptions { + _options.AccessIdentifier = core.StringPtr(accessIdentifier) return _options } // SetHeaders : Allow user to set Headers -func (options *IBMPublishVersionOptions) SetHeaders(param map[string]string) *IBMPublishVersionOptions { +func (options *DeleteObjectAccessOptions) SetHeaders(param map[string]string) *DeleteObjectAccessOptions { options.Headers = param return options } -// Image : Image. -type Image struct { - // Image. - Image *string `json:"image,omitempty"` +// DeleteObjectOptions : The DeleteObject options. +type DeleteObjectOptions struct { + // Catalog identifier. + CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` + + // Object identifier. + ObjectIdentifier *string `json:"object_identifier" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string } -// UnmarshalImage unmarshals an instance of Image from the specified map of raw messages. -func UnmarshalImage(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(Image) - err = core.UnmarshalPrimitive(m, "image", &obj.Image) - if err != nil { - return +// NewDeleteObjectOptions : Instantiate DeleteObjectOptions +func (*CatalogManagementV1) NewDeleteObjectOptions(catalogIdentifier string, objectIdentifier string) *DeleteObjectOptions { + return &DeleteObjectOptions{ + CatalogIdentifier: core.StringPtr(catalogIdentifier), + ObjectIdentifier: core.StringPtr(objectIdentifier), } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return } -// ImageManifest : Image Manifest. -type ImageManifest struct { - // Image manifest description. - Description *string `json:"description,omitempty"` +// SetCatalogIdentifier : Allow user to set CatalogIdentifier +func (_options *DeleteObjectOptions) SetCatalogIdentifier(catalogIdentifier string) *DeleteObjectOptions { + _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) + return _options +} - // List of images. - Images []Image `json:"images,omitempty"` +// SetObjectIdentifier : Allow user to set ObjectIdentifier +func (_options *DeleteObjectOptions) SetObjectIdentifier(objectIdentifier string) *DeleteObjectOptions { + _options.ObjectIdentifier = core.StringPtr(objectIdentifier) + return _options } -// UnmarshalImageManifest unmarshals an instance of ImageManifest from the specified map of raw messages. -func UnmarshalImageManifest(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ImageManifest) - err = core.UnmarshalPrimitive(m, "description", &obj.Description) - if err != nil { - return - } - err = core.UnmarshalModel(m, "images", &obj.Images, UnmarshalImage) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return +// SetHeaders : Allow user to set Headers +func (options *DeleteObjectOptions) SetHeaders(param map[string]string) *DeleteObjectOptions { + options.Headers = param + return options } -// ImportOfferingOptions : The ImportOffering options. -type ImportOfferingOptions struct { +// DeleteOfferingAccessListOptions : The DeleteOfferingAccessList options. +type DeleteOfferingAccessListOptions struct { // Catalog identifier. CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` - // Tags array. - Tags []string `json:"tags,omitempty"` - - // Target kinds. Current valid values are 'iks', 'roks', 'vcenter', and 'terraform'. - TargetKinds []string `json:"target_kinds,omitempty"` - - // byte array representing the content to be imported. Only supported for OVA images at this time. - Content *[]byte `json:"content,omitempty"` - - // URL path to zip location. If not specified, must provide content in this post body. - Zipurl *string `json:"zipurl,omitempty"` - - // Re-use the specified offeringID during import. - OfferingID *string `json:"offeringID,omitempty"` - - // The semver value for this new version. - TargetVersion *string `json:"targetVersion,omitempty"` - - // Add all possible configuration items when creating this version. - IncludeConfig *bool `json:"includeConfig,omitempty"` - - // Indicates that the current terraform template is used to install a VSI Image. - IsVsi *bool `json:"isVSI,omitempty"` - - // The type of repository containing this version. Valid values are 'public_git' or 'enterprise_git'. - RepoType *string `json:"repoType,omitempty"` + // Offering identification. + OfferingID *string `json:"offering_id" validate:"required,ne="` - // Authentication token used to access the specified zip file. - XAuthToken *string `json:"X-Auth-Token,omitempty"` + // A list of accesses to delete. An entry with star["*"] will remove all accesses. + Accesses []string `json:"accesses" validate:"required"` // Allows users to set headers on API requests Headers map[string]string } -// NewImportOfferingOptions : Instantiate ImportOfferingOptions -func (*CatalogManagementV1) NewImportOfferingOptions(catalogIdentifier string) *ImportOfferingOptions { - return &ImportOfferingOptions{ +// NewDeleteOfferingAccessListOptions : Instantiate DeleteOfferingAccessListOptions +func (*CatalogManagementV1) NewDeleteOfferingAccessListOptions(catalogIdentifier string, offeringID string, accesses []string) *DeleteOfferingAccessListOptions { + return &DeleteOfferingAccessListOptions{ CatalogIdentifier: core.StringPtr(catalogIdentifier), + OfferingID: core.StringPtr(offeringID), + Accesses: accesses, } } // SetCatalogIdentifier : Allow user to set CatalogIdentifier -func (_options *ImportOfferingOptions) SetCatalogIdentifier(catalogIdentifier string) *ImportOfferingOptions { +func (_options *DeleteOfferingAccessListOptions) SetCatalogIdentifier(catalogIdentifier string) *DeleteOfferingAccessListOptions { _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) return _options } -// SetTags : Allow user to set Tags -func (_options *ImportOfferingOptions) SetTags(tags []string) *ImportOfferingOptions { - _options.Tags = tags - return _options -} - -// SetTargetKinds : Allow user to set TargetKinds -func (_options *ImportOfferingOptions) SetTargetKinds(targetKinds []string) *ImportOfferingOptions { - _options.TargetKinds = targetKinds +// SetOfferingID : Allow user to set OfferingID +func (_options *DeleteOfferingAccessListOptions) SetOfferingID(offeringID string) *DeleteOfferingAccessListOptions { + _options.OfferingID = core.StringPtr(offeringID) return _options } -// SetContent : Allow user to set Content -func (_options *ImportOfferingOptions) SetContent(content []byte) *ImportOfferingOptions { - _options.Content = &content +// SetAccesses : Allow user to set Accesses +func (_options *DeleteOfferingAccessListOptions) SetAccesses(accesses []string) *DeleteOfferingAccessListOptions { + _options.Accesses = accesses return _options } -// SetZipurl : Allow user to set Zipurl -func (_options *ImportOfferingOptions) SetZipurl(zipurl string) *ImportOfferingOptions { - _options.Zipurl = core.StringPtr(zipurl) - return _options +// SetHeaders : Allow user to set Headers +func (options *DeleteOfferingAccessListOptions) SetHeaders(param map[string]string) *DeleteOfferingAccessListOptions { + options.Headers = param + return options } -// SetOfferingID : Allow user to set OfferingID -func (_options *ImportOfferingOptions) SetOfferingID(offeringID string) *ImportOfferingOptions { - _options.OfferingID = core.StringPtr(offeringID) - return _options -} +// DeleteOfferingInstanceOptions : The DeleteOfferingInstance options. +type DeleteOfferingInstanceOptions struct { + // Version Instance identifier. + InstanceIdentifier *string `json:"instance_identifier" validate:"required,ne="` -// SetTargetVersion : Allow user to set TargetVersion -func (_options *ImportOfferingOptions) SetTargetVersion(targetVersion string) *ImportOfferingOptions { - _options.TargetVersion = core.StringPtr(targetVersion) - return _options -} + // IAM Refresh token. + XAuthRefreshToken *string `json:"X-Auth-Refresh-Token" validate:"required"` -// SetIncludeConfig : Allow user to set IncludeConfig -func (_options *ImportOfferingOptions) SetIncludeConfig(includeConfig bool) *ImportOfferingOptions { - _options.IncludeConfig = core.BoolPtr(includeConfig) - return _options + // Allows users to set headers on API requests + Headers map[string]string } -// SetIsVsi : Allow user to set IsVsi -func (_options *ImportOfferingOptions) SetIsVsi(isVsi bool) *ImportOfferingOptions { - _options.IsVsi = core.BoolPtr(isVsi) - return _options +// NewDeleteOfferingInstanceOptions : Instantiate DeleteOfferingInstanceOptions +func (*CatalogManagementV1) NewDeleteOfferingInstanceOptions(instanceIdentifier string, xAuthRefreshToken string) *DeleteOfferingInstanceOptions { + return &DeleteOfferingInstanceOptions{ + InstanceIdentifier: core.StringPtr(instanceIdentifier), + XAuthRefreshToken: core.StringPtr(xAuthRefreshToken), + } } -// SetRepoType : Allow user to set RepoType -func (_options *ImportOfferingOptions) SetRepoType(repoType string) *ImportOfferingOptions { - _options.RepoType = core.StringPtr(repoType) +// SetInstanceIdentifier : Allow user to set InstanceIdentifier +func (_options *DeleteOfferingInstanceOptions) SetInstanceIdentifier(instanceIdentifier string) *DeleteOfferingInstanceOptions { + _options.InstanceIdentifier = core.StringPtr(instanceIdentifier) return _options } -// SetXAuthToken : Allow user to set XAuthToken -func (_options *ImportOfferingOptions) SetXAuthToken(xAuthToken string) *ImportOfferingOptions { - _options.XAuthToken = core.StringPtr(xAuthToken) +// SetXAuthRefreshToken : Allow user to set XAuthRefreshToken +func (_options *DeleteOfferingInstanceOptions) SetXAuthRefreshToken(xAuthRefreshToken string) *DeleteOfferingInstanceOptions { + _options.XAuthRefreshToken = core.StringPtr(xAuthRefreshToken) return _options } // SetHeaders : Allow user to set Headers -func (options *ImportOfferingOptions) SetHeaders(param map[string]string) *ImportOfferingOptions { +func (options *DeleteOfferingInstanceOptions) SetHeaders(param map[string]string) *DeleteOfferingInstanceOptions { options.Headers = param return options } -// ImportOfferingVersionOptions : The ImportOfferingVersion options. -type ImportOfferingVersionOptions struct { +// DeleteOfferingOptions : The DeleteOffering options. +type DeleteOfferingOptions struct { // Catalog identifier. CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` // Offering identification. OfferingID *string `json:"offering_id" validate:"required,ne="` - // Tags array. - Tags []string `json:"tags,omitempty"` - - // Target kinds. Current valid values are 'iks', 'roks', 'vcenter', and 'terraform'. - TargetKinds []string `json:"target_kinds,omitempty"` - - // byte array representing the content to be imported. Only supported for OVA images at this time. - Content *[]byte `json:"content,omitempty"` - - // URL path to zip location. If not specified, must provide content in the body of this call. - Zipurl *string `json:"zipurl,omitempty"` - - // The semver value for this new version, if not found in the zip url package content. - TargetVersion *string `json:"targetVersion,omitempty"` - - // Add all possible configuration values to this version when importing. - IncludeConfig *bool `json:"includeConfig,omitempty"` - - // Indicates that the current terraform template is used to install a VSI Image. - IsVsi *bool `json:"isVSI,omitempty"` - - // The type of repository containing this version. Valid values are 'public_git' or 'enterprise_git'. - RepoType *string `json:"repoType,omitempty"` - // Allows users to set headers on API requests Headers map[string]string } -// NewImportOfferingVersionOptions : Instantiate ImportOfferingVersionOptions -func (*CatalogManagementV1) NewImportOfferingVersionOptions(catalogIdentifier string, offeringID string) *ImportOfferingVersionOptions { - return &ImportOfferingVersionOptions{ +// NewDeleteOfferingOptions : Instantiate DeleteOfferingOptions +func (*CatalogManagementV1) NewDeleteOfferingOptions(catalogIdentifier string, offeringID string) *DeleteOfferingOptions { + return &DeleteOfferingOptions{ CatalogIdentifier: core.StringPtr(catalogIdentifier), OfferingID: core.StringPtr(offeringID), } } // SetCatalogIdentifier : Allow user to set CatalogIdentifier -func (_options *ImportOfferingVersionOptions) SetCatalogIdentifier(catalogIdentifier string) *ImportOfferingVersionOptions { +func (_options *DeleteOfferingOptions) SetCatalogIdentifier(catalogIdentifier string) *DeleteOfferingOptions { _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) return _options } // SetOfferingID : Allow user to set OfferingID -func (_options *ImportOfferingVersionOptions) SetOfferingID(offeringID string) *ImportOfferingVersionOptions { +func (_options *DeleteOfferingOptions) SetOfferingID(offeringID string) *DeleteOfferingOptions { _options.OfferingID = core.StringPtr(offeringID) return _options } -// SetTags : Allow user to set Tags -func (_options *ImportOfferingVersionOptions) SetTags(tags []string) *ImportOfferingVersionOptions { - _options.Tags = tags - return _options +// SetHeaders : Allow user to set Headers +func (options *DeleteOfferingOptions) SetHeaders(param map[string]string) *DeleteOfferingOptions { + options.Headers = param + return options } -// SetTargetKinds : Allow user to set TargetKinds -func (_options *ImportOfferingVersionOptions) SetTargetKinds(targetKinds []string) *ImportOfferingVersionOptions { - _options.TargetKinds = targetKinds - return _options -} +// DeleteOperatorsOptions : The DeleteOperators options. +type DeleteOperatorsOptions struct { + // IAM Refresh token. + XAuthRefreshToken *string `json:"X-Auth-Refresh-Token" validate:"required"` -// SetContent : Allow user to set Content -func (_options *ImportOfferingVersionOptions) SetContent(content []byte) *ImportOfferingVersionOptions { - _options.Content = &content - return _options + // Cluster identification. + ClusterID *string `json:"cluster_id" validate:"required"` + + // Cluster region. + Region *string `json:"region" validate:"required"` + + // A dotted value of `catalogID`.`versionID`. + VersionLocatorID *string `json:"version_locator_id" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string } -// SetZipurl : Allow user to set Zipurl -func (_options *ImportOfferingVersionOptions) SetZipurl(zipurl string) *ImportOfferingVersionOptions { - _options.Zipurl = core.StringPtr(zipurl) - return _options +// NewDeleteOperatorsOptions : Instantiate DeleteOperatorsOptions +func (*CatalogManagementV1) NewDeleteOperatorsOptions(xAuthRefreshToken string, clusterID string, region string, versionLocatorID string) *DeleteOperatorsOptions { + return &DeleteOperatorsOptions{ + XAuthRefreshToken: core.StringPtr(xAuthRefreshToken), + ClusterID: core.StringPtr(clusterID), + Region: core.StringPtr(region), + VersionLocatorID: core.StringPtr(versionLocatorID), + } } -// SetTargetVersion : Allow user to set TargetVersion -func (_options *ImportOfferingVersionOptions) SetTargetVersion(targetVersion string) *ImportOfferingVersionOptions { - _options.TargetVersion = core.StringPtr(targetVersion) +// SetXAuthRefreshToken : Allow user to set XAuthRefreshToken +func (_options *DeleteOperatorsOptions) SetXAuthRefreshToken(xAuthRefreshToken string) *DeleteOperatorsOptions { + _options.XAuthRefreshToken = core.StringPtr(xAuthRefreshToken) return _options } -// SetIncludeConfig : Allow user to set IncludeConfig -func (_options *ImportOfferingVersionOptions) SetIncludeConfig(includeConfig bool) *ImportOfferingVersionOptions { - _options.IncludeConfig = core.BoolPtr(includeConfig) +// SetClusterID : Allow user to set ClusterID +func (_options *DeleteOperatorsOptions) SetClusterID(clusterID string) *DeleteOperatorsOptions { + _options.ClusterID = core.StringPtr(clusterID) return _options } -// SetIsVsi : Allow user to set IsVsi -func (_options *ImportOfferingVersionOptions) SetIsVsi(isVsi bool) *ImportOfferingVersionOptions { - _options.IsVsi = core.BoolPtr(isVsi) +// SetRegion : Allow user to set Region +func (_options *DeleteOperatorsOptions) SetRegion(region string) *DeleteOperatorsOptions { + _options.Region = core.StringPtr(region) return _options } -// SetRepoType : Allow user to set RepoType -func (_options *ImportOfferingVersionOptions) SetRepoType(repoType string) *ImportOfferingVersionOptions { - _options.RepoType = core.StringPtr(repoType) +// SetVersionLocatorID : Allow user to set VersionLocatorID +func (_options *DeleteOperatorsOptions) SetVersionLocatorID(versionLocatorID string) *DeleteOperatorsOptions { + _options.VersionLocatorID = core.StringPtr(versionLocatorID) return _options } // SetHeaders : Allow user to set Headers -func (options *ImportOfferingVersionOptions) SetHeaders(param map[string]string) *ImportOfferingVersionOptions { +func (options *DeleteOperatorsOptions) SetHeaders(param map[string]string) *DeleteOperatorsOptions { options.Headers = param return options } -// InstallStatus : Installation status. -type InstallStatus struct { - // Installation status metadata. - Metadata *InstallStatusMetadata `json:"metadata,omitempty"` - - // Release information. - Release *InstallStatusRelease `json:"release,omitempty"` - - // Content management information. - ContentMgmt *InstallStatusContentMgmt `json:"content_mgmt,omitempty"` -} - -// UnmarshalInstallStatus unmarshals an instance of InstallStatus from the specified map of raw messages. -func UnmarshalInstallStatus(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstallStatus) - err = core.UnmarshalModel(m, "metadata", &obj.Metadata, UnmarshalInstallStatusMetadata) - if err != nil { - return - } - err = core.UnmarshalModel(m, "release", &obj.Release, UnmarshalInstallStatusRelease) - if err != nil { - return - } - err = core.UnmarshalModel(m, "content_mgmt", &obj.ContentMgmt, UnmarshalInstallStatusContentMgmt) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// InstallStatusContentMgmt : Content management information. -type InstallStatusContentMgmt struct { - // Pods. - Pods []map[string]string `json:"pods,omitempty"` +// DeleteVersionOptions : The DeleteVersion options. +type DeleteVersionOptions struct { + // A dotted value of `catalogID`.`versionID`. + VersionLocID *string `json:"version_loc_id" validate:"required,ne="` - // Errors. - Errors []map[string]string `json:"errors,omitempty"` + // Allows users to set headers on API requests + Headers map[string]string } -// UnmarshalInstallStatusContentMgmt unmarshals an instance of InstallStatusContentMgmt from the specified map of raw messages. -func UnmarshalInstallStatusContentMgmt(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstallStatusContentMgmt) - err = core.UnmarshalPrimitive(m, "pods", &obj.Pods) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "errors", &obj.Errors) - if err != nil { - return +// NewDeleteVersionOptions : Instantiate DeleteVersionOptions +func (*CatalogManagementV1) NewDeleteVersionOptions(versionLocID string) *DeleteVersionOptions { + return &DeleteVersionOptions{ + VersionLocID: core.StringPtr(versionLocID), } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return } -// InstallStatusMetadata : Installation status metadata. -type InstallStatusMetadata struct { - // Cluster ID. - ClusterID *string `json:"cluster_id,omitempty"` - - // Cluster region. - Region *string `json:"region,omitempty"` - - // Cluster namespace. - Namespace *string `json:"namespace,omitempty"` - - // Workspace ID. - WorkspaceID *string `json:"workspace_id,omitempty"` - - // Workspace name. - WorkspaceName *string `json:"workspace_name,omitempty"` +// SetVersionLocID : Allow user to set VersionLocID +func (_options *DeleteVersionOptions) SetVersionLocID(versionLocID string) *DeleteVersionOptions { + _options.VersionLocID = core.StringPtr(versionLocID) + return _options } -// UnmarshalInstallStatusMetadata unmarshals an instance of InstallStatusMetadata from the specified map of raw messages. -func UnmarshalInstallStatusMetadata(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstallStatusMetadata) - err = core.UnmarshalPrimitive(m, "cluster_id", &obj.ClusterID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "region", &obj.Region) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "namespace", &obj.Namespace) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "workspace_id", &obj.WorkspaceID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "workspace_name", &obj.WorkspaceName) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return +// SetHeaders : Allow user to set Headers +func (options *DeleteVersionOptions) SetHeaders(param map[string]string) *DeleteVersionOptions { + options.Headers = param + return options } -// InstallStatusRelease : Release information. -type InstallStatusRelease struct { - // Kube deployments. - Deployments []map[string]interface{} `json:"deployments,omitempty"` +// Dependency : Dependency definition. +type Dependency struct { + // Optional - If not specified, assumes the Public Catalog. + CatalogID *string `json:"catalog_id,omitempty"` - // Kube replica sets. - Replicasets []map[string]interface{} `json:"replicasets,omitempty"` + // Optional - Offering ID - not required if name is set. + ID *string `json:"id,omitempty"` - // Kube stateful sets. - Statefulsets []map[string]interface{} `json:"statefulsets,omitempty"` + // Optional - Programmatic Offering name. + Name *string `json:"name,omitempty"` - // Kube pods. - Pods []map[string]interface{} `json:"pods,omitempty"` + // Required - Semver value or range. + Version *string `json:"version,omitempty"` - // Kube errors. - Errors []map[string]string `json:"errors,omitempty"` + // Optional - List of dependent flavors in the specified range. + Flavors []string `json:"flavors,omitempty"` } -// UnmarshalInstallStatusRelease unmarshals an instance of InstallStatusRelease from the specified map of raw messages. -func UnmarshalInstallStatusRelease(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InstallStatusRelease) - err = core.UnmarshalPrimitive(m, "deployments", &obj.Deployments) +// UnmarshalDependency unmarshals an instance of Dependency from the specified map of raw messages. +func UnmarshalDependency(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Dependency) + err = core.UnmarshalPrimitive(m, "catalog_id", &obj.CatalogID) if err != nil { return } - err = core.UnmarshalPrimitive(m, "replicasets", &obj.Replicasets) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } - err = core.UnmarshalPrimitive(m, "statefulsets", &obj.Statefulsets) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "pods", &obj.Pods) + err = core.UnmarshalPrimitive(m, "version", &obj.Version) if err != nil { return } - err = core.UnmarshalPrimitive(m, "errors", &obj.Errors) + err = core.UnmarshalPrimitive(m, "flavors", &obj.Flavors) if err != nil { return } @@ -9371,11 +10331,8 @@ func UnmarshalInstallStatusRelease(m map[string]json.RawMessage, result interfac return } -// InstallVersionOptions : The InstallVersion options. -type InstallVersionOptions struct { - // A dotted value of `catalogID`.`versionID`. - VersionLocID *string `json:"version_loc_id" validate:"required,ne="` - +// DeployOperatorsOptions : The DeployOperators options. +type DeployOperatorsOptions struct { // IAM Refresh token. XAuthRefreshToken *string `json:"X-Auth-Refresh-Token" validate:"required"` @@ -9385,209 +10342,110 @@ type InstallVersionOptions struct { // Cluster region. Region *string `json:"region,omitempty"` - // Kube namespace. - Namespace *string `json:"namespace,omitempty"` - - // Object containing Helm chart override values. To use a secret for items of type password, specify a JSON encoded - // value of $ref:#/components/schemas/SecretInstance, prefixed with `cmsm_v1:`. - OverrideValues map[string]interface{} `json:"override_values,omitempty"` - - // Entitlement API Key for this offering. - EntitlementApikey *string `json:"entitlement_apikey,omitempty"` - - // Schematics workspace configuration. - Schematics *DeployRequestBodySchematics `json:"schematics,omitempty"` - - // Script. - Script *string `json:"script,omitempty"` + // Kube namespaces to deploy Operator(s) to. + Namespaces []string `json:"namespaces,omitempty"` - // Script ID. - ScriptID *string `json:"script_id,omitempty"` + // Denotes whether to install Operator(s) globally. + AllNamespaces *bool `json:"all_namespaces,omitempty"` // A dotted value of `catalogID`.`versionID`. VersionLocatorID *string `json:"version_locator_id,omitempty"` - // VCenter ID. - VcenterID *string `json:"vcenter_id,omitempty"` - - // VCenter User. - VcenterUser *string `json:"vcenter_user,omitempty"` - - // VCenter Password. - VcenterPassword *string `json:"vcenter_password,omitempty"` - - // VCenter Location. - VcenterLocation *string `json:"vcenter_location,omitempty"` + // Operator channel. + Channel *string `json:"channel,omitempty"` - // VCenter Datastore. - VcenterDatastore *string `json:"vcenter_datastore,omitempty"` + // Plan. + InstallPlan *string `json:"install_plan,omitempty"` // Allows users to set headers on API requests Headers map[string]string } -// NewInstallVersionOptions : Instantiate InstallVersionOptions -func (*CatalogManagementV1) NewInstallVersionOptions(versionLocID string, xAuthRefreshToken string) *InstallVersionOptions { - return &InstallVersionOptions{ - VersionLocID: core.StringPtr(versionLocID), +// NewDeployOperatorsOptions : Instantiate DeployOperatorsOptions +func (*CatalogManagementV1) NewDeployOperatorsOptions(xAuthRefreshToken string) *DeployOperatorsOptions { + return &DeployOperatorsOptions{ XAuthRefreshToken: core.StringPtr(xAuthRefreshToken), } } -// SetVersionLocID : Allow user to set VersionLocID -func (_options *InstallVersionOptions) SetVersionLocID(versionLocID string) *InstallVersionOptions { - _options.VersionLocID = core.StringPtr(versionLocID) - return _options -} - // SetXAuthRefreshToken : Allow user to set XAuthRefreshToken -func (_options *InstallVersionOptions) SetXAuthRefreshToken(xAuthRefreshToken string) *InstallVersionOptions { +func (_options *DeployOperatorsOptions) SetXAuthRefreshToken(xAuthRefreshToken string) *DeployOperatorsOptions { _options.XAuthRefreshToken = core.StringPtr(xAuthRefreshToken) return _options } // SetClusterID : Allow user to set ClusterID -func (_options *InstallVersionOptions) SetClusterID(clusterID string) *InstallVersionOptions { +func (_options *DeployOperatorsOptions) SetClusterID(clusterID string) *DeployOperatorsOptions { _options.ClusterID = core.StringPtr(clusterID) return _options } // SetRegion : Allow user to set Region -func (_options *InstallVersionOptions) SetRegion(region string) *InstallVersionOptions { +func (_options *DeployOperatorsOptions) SetRegion(region string) *DeployOperatorsOptions { _options.Region = core.StringPtr(region) return _options } -// SetNamespace : Allow user to set Namespace -func (_options *InstallVersionOptions) SetNamespace(namespace string) *InstallVersionOptions { - _options.Namespace = core.StringPtr(namespace) +// SetNamespaces : Allow user to set Namespaces +func (_options *DeployOperatorsOptions) SetNamespaces(namespaces []string) *DeployOperatorsOptions { + _options.Namespaces = namespaces return _options } -// SetOverrideValues : Allow user to set OverrideValues -func (_options *InstallVersionOptions) SetOverrideValues(overrideValues map[string]interface{}) *InstallVersionOptions { - _options.OverrideValues = overrideValues - return _options -} - -// SetEntitlementApikey : Allow user to set EntitlementApikey -func (_options *InstallVersionOptions) SetEntitlementApikey(entitlementApikey string) *InstallVersionOptions { - _options.EntitlementApikey = core.StringPtr(entitlementApikey) - return _options -} - -// SetSchematics : Allow user to set Schematics -func (_options *InstallVersionOptions) SetSchematics(schematics *DeployRequestBodySchematics) *InstallVersionOptions { - _options.Schematics = schematics - return _options -} - -// SetScript : Allow user to set Script -func (_options *InstallVersionOptions) SetScript(script string) *InstallVersionOptions { - _options.Script = core.StringPtr(script) - return _options -} - -// SetScriptID : Allow user to set ScriptID -func (_options *InstallVersionOptions) SetScriptID(scriptID string) *InstallVersionOptions { - _options.ScriptID = core.StringPtr(scriptID) +// SetAllNamespaces : Allow user to set AllNamespaces +func (_options *DeployOperatorsOptions) SetAllNamespaces(allNamespaces bool) *DeployOperatorsOptions { + _options.AllNamespaces = core.BoolPtr(allNamespaces) return _options } // SetVersionLocatorID : Allow user to set VersionLocatorID -func (_options *InstallVersionOptions) SetVersionLocatorID(versionLocatorID string) *InstallVersionOptions { +func (_options *DeployOperatorsOptions) SetVersionLocatorID(versionLocatorID string) *DeployOperatorsOptions { _options.VersionLocatorID = core.StringPtr(versionLocatorID) return _options } -// SetVcenterID : Allow user to set VcenterID -func (_options *InstallVersionOptions) SetVcenterID(vcenterID string) *InstallVersionOptions { - _options.VcenterID = core.StringPtr(vcenterID) - return _options -} - -// SetVcenterUser : Allow user to set VcenterUser -func (_options *InstallVersionOptions) SetVcenterUser(vcenterUser string) *InstallVersionOptions { - _options.VcenterUser = core.StringPtr(vcenterUser) - return _options -} - -// SetVcenterPassword : Allow user to set VcenterPassword -func (_options *InstallVersionOptions) SetVcenterPassword(vcenterPassword string) *InstallVersionOptions { - _options.VcenterPassword = core.StringPtr(vcenterPassword) - return _options -} - -// SetVcenterLocation : Allow user to set VcenterLocation -func (_options *InstallVersionOptions) SetVcenterLocation(vcenterLocation string) *InstallVersionOptions { - _options.VcenterLocation = core.StringPtr(vcenterLocation) +// SetChannel : Allow user to set Channel +func (_options *DeployOperatorsOptions) SetChannel(channel string) *DeployOperatorsOptions { + _options.Channel = core.StringPtr(channel) return _options } -// SetVcenterDatastore : Allow user to set VcenterDatastore -func (_options *InstallVersionOptions) SetVcenterDatastore(vcenterDatastore string) *InstallVersionOptions { - _options.VcenterDatastore = core.StringPtr(vcenterDatastore) +// SetInstallPlan : Allow user to set InstallPlan +func (_options *DeployOperatorsOptions) SetInstallPlan(installPlan string) *DeployOperatorsOptions { + _options.InstallPlan = core.StringPtr(installPlan) return _options } // SetHeaders : Allow user to set Headers -func (options *InstallVersionOptions) SetHeaders(param map[string]string) *InstallVersionOptions { +func (options *DeployOperatorsOptions) SetHeaders(param map[string]string) *DeployOperatorsOptions { options.Headers = param return options } -// JSONPatchOperation : This model represents an individual patch operation to be performed on a JSON document, as defined by RFC 6902. -type JSONPatchOperation struct { - // The operation to be performed. - Op *string `json:"op" validate:"required"` - - // The JSON Pointer that identifies the field that is the target of the operation. - Path *string `json:"path" validate:"required"` - - // The JSON Pointer that identifies the field that is the source of the operation. - From *string `json:"from,omitempty"` +// DeployRequestBodyEnvironmentVariablesItem : DeployRequestBodyEnvironmentVariablesItem struct +type DeployRequestBodyEnvironmentVariablesItem struct { + // Variable name. + Name *string `json:"name,omitempty"` - // The value to be used within the operation. + // Variable value. Value interface{} `json:"value,omitempty"` -} - -// Constants associated with the JSONPatchOperation.Op property. -// The operation to be performed. -const ( - JSONPatchOperationOpAddConst = "add" - JSONPatchOperationOpCopyConst = "copy" - JSONPatchOperationOpMoveConst = "move" - JSONPatchOperationOpRemoveConst = "remove" - JSONPatchOperationOpReplaceConst = "replace" - JSONPatchOperationOpTestConst = "test" -) -// NewJSONPatchOperation : Instantiate JSONPatchOperation (Generic Model Constructor) -func (*CatalogManagementV1) NewJSONPatchOperation(op string, path string) (_model *JSONPatchOperation, err error) { - _model = &JSONPatchOperation{ - Op: core.StringPtr(op), - Path: core.StringPtr(path), - } - err = core.ValidateStruct(_model, "required parameters") - return + // Does this variable contain a secure value. + Secure *bool `json:"secure,omitempty"` } -// UnmarshalJSONPatchOperation unmarshals an instance of JSONPatchOperation from the specified map of raw messages. -func UnmarshalJSONPatchOperation(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(JSONPatchOperation) - err = core.UnmarshalPrimitive(m, "op", &obj.Op) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "path", &obj.Path) +// UnmarshalDeployRequestBodyEnvironmentVariablesItem unmarshals an instance of DeployRequestBodyEnvironmentVariablesItem from the specified map of raw messages. +func UnmarshalDeployRequestBodyEnvironmentVariablesItem(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DeployRequestBodyEnvironmentVariablesItem) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "from", &obj.From) + err = core.UnmarshalPrimitive(m, "value", &obj.Value) if err != nil { return } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) + err = core.UnmarshalPrimitive(m, "secure", &obj.Secure) if err != nil { return } @@ -9595,86 +10453,188 @@ func UnmarshalJSONPatchOperation(m map[string]json.RawMessage, result interface{ return } -// Kind : Offering kind. -type Kind struct { - // Unique ID. - ID *string `json:"id,omitempty"` +// DeployRequestBodyOverrideValues : Validation override values. Required for virtual server image for VPC. +type DeployRequestBodyOverrideValues struct { + // Name of virtual server image instance to create. Required for virtual server image for VPC. + VsiInstanceName *string `json:"vsi_instance_name,omitempty"` - // content kind, e.g., helm, vm image. - FormatKind *string `json:"format_kind,omitempty"` + // Profile to use when validating virtual server image. Required for virtual server image for VPC. + VPCProfile *string `json:"vpc_profile,omitempty"` - // target cloud to install, e.g., iks, open_shift_iks. - TargetKind *string `json:"target_kind,omitempty"` + // ID of subnet to use when validating virtual server image. Required for virtual server image for VPC. + SubnetID *string `json:"subnet_id,omitempty"` - // Open ended metadata information. - Metadata map[string]interface{} `json:"metadata,omitempty"` + // ID of VPC to use when validating virtual server image. Required for virtual server image for VPC. + VPCID *string `json:"vpc_id,omitempty"` - // Installation instruction. - InstallDescription *string `json:"install_description,omitempty"` + // Zone of subnet to use when validating virtual server image. Required for virtual server image for VPC. + SubnetZone *string `json:"subnet_zone,omitempty"` - // List of tags associated with this catalog. - Tags []string `json:"tags,omitempty"` + // ID off SSH key to use when validating virtual server image. Required for virtual server image for VPC. + SSHKeyID *string `json:"ssh_key_id,omitempty"` - // List of features associated with this offering. - AdditionalFeatures []Feature `json:"additional_features,omitempty"` + // Region virtual server image exists in. Required for virtual server image for VPC. + VPCRegion *string `json:"vpc_region,omitempty"` - // The date and time this catalog was created. - Created *strfmt.DateTime `json:"created,omitempty"` + // Allows users to set arbitrary properties + additionalProperties map[string]interface{} +} - // The date and time this catalog was last updated. - Updated *strfmt.DateTime `json:"updated,omitempty"` +// SetProperty allows the user to set an arbitrary property on an instance of DeployRequestBodyOverrideValues +func (o *DeployRequestBodyOverrideValues) SetProperty(key string, value interface{}) { + if o.additionalProperties == nil { + o.additionalProperties = make(map[string]interface{}) + } + o.additionalProperties[key] = value +} - // list of versions. - Versions []Version `json:"versions,omitempty"` +// SetProperties allows the user to set a map of arbitrary properties on an instance of DeployRequestBodyOverrideValues +func (o *DeployRequestBodyOverrideValues) SetProperties(m map[string]interface{}) { + o.additionalProperties = make(map[string]interface{}) + for k, v := range m { + o.additionalProperties[k] = v + } +} - // list of plans. - Plans []Plan `json:"plans,omitempty"` +// GetProperty allows the user to retrieve an arbitrary property from an instance of DeployRequestBodyOverrideValues +func (o *DeployRequestBodyOverrideValues) GetProperty(key string) interface{} { + return o.additionalProperties[key] } -// UnmarshalKind unmarshals an instance of Kind from the specified map of raw messages. -func UnmarshalKind(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(Kind) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) +// GetProperties allows the user to retrieve the map of arbitrary properties from an instance of DeployRequestBodyOverrideValues +func (o *DeployRequestBodyOverrideValues) GetProperties() map[string]interface{} { + return o.additionalProperties +} + +// MarshalJSON performs custom serialization for instances of DeployRequestBodyOverrideValues +func (o *DeployRequestBodyOverrideValues) MarshalJSON() (buffer []byte, err error) { + m := make(map[string]interface{}) + if len(o.additionalProperties) > 0 { + for k, v := range o.additionalProperties { + m[k] = v + } + } + if o.VsiInstanceName != nil { + m["vsi_instance_name"] = o.VsiInstanceName + } + if o.VPCProfile != nil { + m["vpc_profile"] = o.VPCProfile + } + if o.SubnetID != nil { + m["subnet_id"] = o.SubnetID + } + if o.VPCID != nil { + m["vpc_id"] = o.VPCID + } + if o.SubnetZone != nil { + m["subnet_zone"] = o.SubnetZone + } + if o.SSHKeyID != nil { + m["ssh_key_id"] = o.SSHKeyID + } + if o.VPCRegion != nil { + m["vpc_region"] = o.VPCRegion + } + buffer, err = json.Marshal(m) + return +} + +// UnmarshalDeployRequestBodyOverrideValues unmarshals an instance of DeployRequestBodyOverrideValues from the specified map of raw messages. +func UnmarshalDeployRequestBodyOverrideValues(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DeployRequestBodyOverrideValues) + err = core.UnmarshalPrimitive(m, "vsi_instance_name", &obj.VsiInstanceName) if err != nil { return } - err = core.UnmarshalPrimitive(m, "format_kind", &obj.FormatKind) + delete(m, "vsi_instance_name") + err = core.UnmarshalPrimitive(m, "vpc_profile", &obj.VPCProfile) if err != nil { return } - err = core.UnmarshalPrimitive(m, "target_kind", &obj.TargetKind) + delete(m, "vpc_profile") + err = core.UnmarshalPrimitive(m, "subnet_id", &obj.SubnetID) if err != nil { return } - err = core.UnmarshalPrimitive(m, "metadata", &obj.Metadata) + delete(m, "subnet_id") + err = core.UnmarshalPrimitive(m, "vpc_id", &obj.VPCID) if err != nil { return } - err = core.UnmarshalPrimitive(m, "install_description", &obj.InstallDescription) + delete(m, "vpc_id") + err = core.UnmarshalPrimitive(m, "subnet_zone", &obj.SubnetZone) if err != nil { return } - err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) + delete(m, "subnet_zone") + err = core.UnmarshalPrimitive(m, "ssh_key_id", &obj.SSHKeyID) if err != nil { return } - err = core.UnmarshalModel(m, "additional_features", &obj.AdditionalFeatures, UnmarshalFeature) + delete(m, "ssh_key_id") + err = core.UnmarshalPrimitive(m, "vpc_region", &obj.VPCRegion) if err != nil { return } - err = core.UnmarshalPrimitive(m, "created", &obj.Created) + delete(m, "vpc_region") + for k := range m { + var v interface{} + e := core.UnmarshalPrimitive(m, k, &v) + if e != nil { + err = e + return + } + obj.SetProperty(k, v) + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DeployRequestBodySchematics : Schematics workspace configuration. +type DeployRequestBodySchematics struct { + // Schematics workspace name. + Name *string `json:"name,omitempty"` + + // Schematics workspace description. + Description *string `json:"description,omitempty"` + + // Schematics workspace tags. + Tags []string `json:"tags,omitempty"` + + // Resource group to use when creating the schematics workspace. + ResourceGroupID *string `json:"resource_group_id,omitempty"` + + // Terraform version override. + TerraformVersion *string `json:"terraform_version,omitempty"` + + // Schematics workspace region. + Region *string `json:"region,omitempty"` +} + +// UnmarshalDeployRequestBodySchematics unmarshals an instance of DeployRequestBodySchematics from the specified map of raw messages. +func UnmarshalDeployRequestBodySchematics(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DeployRequestBodySchematics) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "updated", &obj.Updated) + err = core.UnmarshalPrimitive(m, "description", &obj.Description) if err != nil { return } - err = core.UnmarshalModel(m, "versions", &obj.Versions, UnmarshalVersion) + err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) if err != nil { return } - err = core.UnmarshalModel(m, "plans", &obj.Plans, UnmarshalPlan) + err = core.UnmarshalPrimitive(m, "resource_group_id", &obj.ResourceGroupID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "terraform_version", &obj.TerraformVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "region", &obj.Region) if err != nil { return } @@ -9682,44 +10642,72 @@ func UnmarshalKind(m map[string]json.RawMessage, result interface{}) (err error) return } -// License : BSS license. -type License struct { - // License ID. +// Deployment : Deployment for offering. +type Deployment struct { + // unique id. ID *string `json:"id,omitempty"` - // license name. + // Display Name in the requested language. + Label *string `json:"label,omitempty"` + + // The programmatic name of this offering. Name *string `json:"name,omitempty"` - // type of license e.g., Apache xxx. - Type *string `json:"type,omitempty"` + // Short description in the requested language. + ShortDescription *string `json:"short_description,omitempty"` - // URL for the license text. - URL *string `json:"url,omitempty"` + // Long description in the requested language. + LongDescription *string `json:"long_description,omitempty"` - // License description. - Description *string `json:"description,omitempty"` + // open ended metadata information. + Metadata map[string]interface{} `json:"metadata,omitempty"` + + // list of tags associated with this catalog. + Tags []string `json:"tags,omitempty"` + + // the date'time this catalog was created. + Created *strfmt.DateTime `json:"created,omitempty"` + + // the date'time this catalog was last updated. + Updated *strfmt.DateTime `json:"updated,omitempty"` } -// UnmarshalLicense unmarshals an instance of License from the specified map of raw messages. -func UnmarshalLicense(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(License) +// UnmarshalDeployment unmarshals an instance of Deployment from the specified map of raw messages. +func UnmarshalDeployment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Deployment) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } + err = core.UnmarshalPrimitive(m, "label", &obj.Label) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) + err = core.UnmarshalPrimitive(m, "short_description", &obj.ShortDescription) if err != nil { return } - err = core.UnmarshalPrimitive(m, "url", &obj.URL) + err = core.UnmarshalPrimitive(m, "long_description", &obj.LongDescription) if err != nil { return } - err = core.UnmarshalPrimitive(m, "description", &obj.Description) + err = core.UnmarshalPrimitive(m, "metadata", &obj.Metadata) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created", &obj.Created) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated", &obj.Updated) if err != nil { return } @@ -9727,255 +10715,168 @@ func UnmarshalLicense(m map[string]json.RawMessage, result interface{}) (err err return } -// ListCatalogsOptions : The ListCatalogs options. -type ListCatalogsOptions struct { - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListCatalogsOptions : Instantiate ListCatalogsOptions -func (*CatalogManagementV1) NewListCatalogsOptions() *ListCatalogsOptions { - return &ListCatalogsOptions{} -} - -// SetHeaders : Allow user to set Headers -func (options *ListCatalogsOptions) SetHeaders(param map[string]string) *ListCatalogsOptions { - options.Headers = param - return options -} - -// ListObjectsOptions : The ListObjects options. -type ListObjectsOptions struct { +// DeprecateOfferingOptions : The DeprecateOffering options. +type DeprecateOfferingOptions struct { // Catalog identifier. CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` - // The number of results to return. - Limit *int64 `json:"limit,omitempty"` + // Offering identification. + OfferingID *string `json:"offering_id" validate:"required,ne="` - // The number of results to skip before returning values. - Offset *int64 `json:"offset,omitempty"` + // Set deprecation (true) or cancel deprecation (false). + Setting *string `json:"setting" validate:"required,ne="` - // Only return results that contain the specified string. - Name *string `json:"name,omitempty"` + // Additional information that users can provide to be displayed in deprecation notification. + Description *string `json:"description,omitempty"` - // The field on which the output is sorted. Sorts by default by **label** property. Available fields are **name**, - // **label**, **created**, and **updated**. By adding **-** (i.e. **-label**) in front of the query string, you can - // specify descending order. Default is ascending order. - Sort *string `json:"sort,omitempty"` + // Specifies the amount of days until product is not available in catalog. + DaysUntilDeprecate *int64 `json:"days_until_deprecate,omitempty"` // Allows users to set headers on API requests Headers map[string]string } -// NewListObjectsOptions : Instantiate ListObjectsOptions -func (*CatalogManagementV1) NewListObjectsOptions(catalogIdentifier string) *ListObjectsOptions { - return &ListObjectsOptions{ +// Constants associated with the DeprecateOfferingOptions.Setting property. +// Set deprecation (true) or cancel deprecation (false). +const ( + DeprecateOfferingOptionsSettingFalseConst = "false" + DeprecateOfferingOptionsSettingTrueConst = "true" +) + +// NewDeprecateOfferingOptions : Instantiate DeprecateOfferingOptions +func (*CatalogManagementV1) NewDeprecateOfferingOptions(catalogIdentifier string, offeringID string, setting string) *DeprecateOfferingOptions { + return &DeprecateOfferingOptions{ CatalogIdentifier: core.StringPtr(catalogIdentifier), + OfferingID: core.StringPtr(offeringID), + Setting: core.StringPtr(setting), } } // SetCatalogIdentifier : Allow user to set CatalogIdentifier -func (_options *ListObjectsOptions) SetCatalogIdentifier(catalogIdentifier string) *ListObjectsOptions { +func (_options *DeprecateOfferingOptions) SetCatalogIdentifier(catalogIdentifier string) *DeprecateOfferingOptions { _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) return _options } -// SetLimit : Allow user to set Limit -func (_options *ListObjectsOptions) SetLimit(limit int64) *ListObjectsOptions { - _options.Limit = core.Int64Ptr(limit) +// SetOfferingID : Allow user to set OfferingID +func (_options *DeprecateOfferingOptions) SetOfferingID(offeringID string) *DeprecateOfferingOptions { + _options.OfferingID = core.StringPtr(offeringID) return _options } -// SetOffset : Allow user to set Offset -func (_options *ListObjectsOptions) SetOffset(offset int64) *ListObjectsOptions { - _options.Offset = core.Int64Ptr(offset) +// SetSetting : Allow user to set Setting +func (_options *DeprecateOfferingOptions) SetSetting(setting string) *DeprecateOfferingOptions { + _options.Setting = core.StringPtr(setting) return _options } -// SetName : Allow user to set Name -func (_options *ListObjectsOptions) SetName(name string) *ListObjectsOptions { - _options.Name = core.StringPtr(name) +// SetDescription : Allow user to set Description +func (_options *DeprecateOfferingOptions) SetDescription(description string) *DeprecateOfferingOptions { + _options.Description = core.StringPtr(description) return _options } -// SetSort : Allow user to set Sort -func (_options *ListObjectsOptions) SetSort(sort string) *ListObjectsOptions { - _options.Sort = core.StringPtr(sort) +// SetDaysUntilDeprecate : Allow user to set DaysUntilDeprecate +func (_options *DeprecateOfferingOptions) SetDaysUntilDeprecate(daysUntilDeprecate int64) *DeprecateOfferingOptions { + _options.DaysUntilDeprecate = core.Int64Ptr(daysUntilDeprecate) return _options } // SetHeaders : Allow user to set Headers -func (options *ListObjectsOptions) SetHeaders(param map[string]string) *ListObjectsOptions { +func (options *DeprecateOfferingOptions) SetHeaders(param map[string]string) *DeprecateOfferingOptions { options.Headers = param return options } -// ListOfferingsOptions : The ListOfferings options. -type ListOfferingsOptions struct { - // Catalog identifier. - CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` - - // true - Strip down the content of what is returned. For example don't return the readme. Makes the result much - // smaller. Defaults to false. - Digest *bool `json:"digest,omitempty"` - - // The maximum number of results to return. - Limit *int64 `json:"limit,omitempty"` - - // The number of results to skip before returning values. - Offset *int64 `json:"offset,omitempty"` - - // Only return results that contain the specified string. - Name *string `json:"name,omitempty"` +// DeprecatePending : Deprecation information for an Offering. +type DeprecatePending struct { + // Date of deprecation. + DeprecateDate *strfmt.DateTime `json:"deprecate_date,omitempty"` - // The field on which the output is sorted. Sorts by default by **label** property. Available fields are **name**, - // **label**, **created**, and **updated**. By adding **-** (i.e. **-label**) in front of the query string, you can - // specify descending order. Default is ascending order. - Sort *string `json:"sort,omitempty"` + // Deprecation state. + DeprecateState *string `json:"deprecate_state,omitempty"` - // Allows users to set headers on API requests - Headers map[string]string + Description *string `json:"description,omitempty"` } -// NewListOfferingsOptions : Instantiate ListOfferingsOptions -func (*CatalogManagementV1) NewListOfferingsOptions(catalogIdentifier string) *ListOfferingsOptions { - return &ListOfferingsOptions{ - CatalogIdentifier: core.StringPtr(catalogIdentifier), +// UnmarshalDeprecatePending unmarshals an instance of DeprecatePending from the specified map of raw messages. +func UnmarshalDeprecatePending(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DeprecatePending) + err = core.UnmarshalPrimitive(m, "deprecate_date", &obj.DeprecateDate) + if err != nil { + return } + err = core.UnmarshalPrimitive(m, "deprecate_state", &obj.DeprecateState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "description", &obj.Description) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// SetCatalogIdentifier : Allow user to set CatalogIdentifier -func (_options *ListOfferingsOptions) SetCatalogIdentifier(catalogIdentifier string) *ListOfferingsOptions { - _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) - return _options -} - -// SetDigest : Allow user to set Digest -func (_options *ListOfferingsOptions) SetDigest(digest bool) *ListOfferingsOptions { - _options.Digest = core.BoolPtr(digest) - return _options -} - -// SetLimit : Allow user to set Limit -func (_options *ListOfferingsOptions) SetLimit(limit int64) *ListOfferingsOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} - -// SetOffset : Allow user to set Offset -func (_options *ListOfferingsOptions) SetOffset(offset int64) *ListOfferingsOptions { - _options.Offset = core.Int64Ptr(offset) - return _options -} - -// SetName : Allow user to set Name -func (_options *ListOfferingsOptions) SetName(name string) *ListOfferingsOptions { - _options.Name = core.StringPtr(name) - return _options -} - -// SetSort : Allow user to set Sort -func (_options *ListOfferingsOptions) SetSort(sort string) *ListOfferingsOptions { - _options.Sort = core.StringPtr(sort) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListOfferingsOptions) SetHeaders(param map[string]string) *ListOfferingsOptions { - options.Headers = param - return options -} - -// ListOperatorsOptions : The ListOperators options. -type ListOperatorsOptions struct { - // IAM Refresh token. - XAuthRefreshToken *string `json:"X-Auth-Refresh-Token" validate:"required"` - - // Cluster identification. - ClusterID *string `json:"cluster_id" validate:"required"` - - // Cluster region. - Region *string `json:"region" validate:"required"` - +// DeprecateVersionOptions : The DeprecateVersion options. +type DeprecateVersionOptions struct { // A dotted value of `catalogID`.`versionID`. - VersionLocatorID *string `json:"version_locator_id" validate:"required"` + VersionLocID *string `json:"version_loc_id" validate:"required,ne="` // Allows users to set headers on API requests Headers map[string]string } -// NewListOperatorsOptions : Instantiate ListOperatorsOptions -func (*CatalogManagementV1) NewListOperatorsOptions(xAuthRefreshToken string, clusterID string, region string, versionLocatorID string) *ListOperatorsOptions { - return &ListOperatorsOptions{ - XAuthRefreshToken: core.StringPtr(xAuthRefreshToken), - ClusterID: core.StringPtr(clusterID), - Region: core.StringPtr(region), - VersionLocatorID: core.StringPtr(versionLocatorID), +// NewDeprecateVersionOptions : Instantiate DeprecateVersionOptions +func (*CatalogManagementV1) NewDeprecateVersionOptions(versionLocID string) *DeprecateVersionOptions { + return &DeprecateVersionOptions{ + VersionLocID: core.StringPtr(versionLocID), } } -// SetXAuthRefreshToken : Allow user to set XAuthRefreshToken -func (_options *ListOperatorsOptions) SetXAuthRefreshToken(xAuthRefreshToken string) *ListOperatorsOptions { - _options.XAuthRefreshToken = core.StringPtr(xAuthRefreshToken) - return _options -} - -// SetClusterID : Allow user to set ClusterID -func (_options *ListOperatorsOptions) SetClusterID(clusterID string) *ListOperatorsOptions { - _options.ClusterID = core.StringPtr(clusterID) - return _options -} - -// SetRegion : Allow user to set Region -func (_options *ListOperatorsOptions) SetRegion(region string) *ListOperatorsOptions { - _options.Region = core.StringPtr(region) - return _options -} - -// SetVersionLocatorID : Allow user to set VersionLocatorID -func (_options *ListOperatorsOptions) SetVersionLocatorID(versionLocatorID string) *ListOperatorsOptions { - _options.VersionLocatorID = core.StringPtr(versionLocatorID) +// SetVersionLocID : Allow user to set VersionLocID +func (_options *DeprecateVersionOptions) SetVersionLocID(versionLocID string) *DeprecateVersionOptions { + _options.VersionLocID = core.StringPtr(versionLocID) return _options } // SetHeaders : Allow user to set Headers -func (options *ListOperatorsOptions) SetHeaders(param map[string]string) *ListOperatorsOptions { +func (options *DeprecateVersionOptions) SetHeaders(param map[string]string) *DeprecateVersionOptions { options.Headers = param return options } -// MediaItem : Offering Media information. -type MediaItem struct { - // URL of the specified media item. - URL *string `json:"url,omitempty"` +// Feature : Feature information. +type Feature struct { + // Heading. + Title *string `json:"title,omitempty"` - // Caption for this media item. - Caption *string `json:"caption,omitempty"` + // A map of translated strings, by language code. + TitleI18n map[string]string `json:"title_i18n,omitempty"` - // Type of this media item. - Type *string `json:"type,omitempty"` + // Feature description. + Description *string `json:"description,omitempty"` - // Thumbnail URL for this media item. - ThumbnailURL *string `json:"thumbnail_url,omitempty"` + // A map of translated strings, by language code. + DescriptionI18n map[string]string `json:"description_i18n,omitempty"` } -// UnmarshalMediaItem unmarshals an instance of MediaItem from the specified map of raw messages. -func UnmarshalMediaItem(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(MediaItem) - err = core.UnmarshalPrimitive(m, "url", &obj.URL) +// UnmarshalFeature unmarshals an instance of Feature from the specified map of raw messages. +func UnmarshalFeature(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Feature) + err = core.UnmarshalPrimitive(m, "title", &obj.Title) if err != nil { return } - err = core.UnmarshalPrimitive(m, "caption", &obj.Caption) + err = core.UnmarshalPrimitive(m, "title_i18n", &obj.TitleI18n) if err != nil { return } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) + err = core.UnmarshalPrimitive(m, "description", &obj.Description) if err != nil { return } - err = core.UnmarshalPrimitive(m, "thumbnail_url", &obj.ThumbnailURL) + err = core.UnmarshalPrimitive(m, "description_i18n", &obj.DescriptionI18n) if err != nil { return } @@ -9983,72 +10884,50 @@ func UnmarshalMediaItem(m map[string]json.RawMessage, result interface{}) (err e return } -// NamespaceSearchResult : Paginated list of namespace search results. -type NamespaceSearchResult struct { - // The offset (origin 0) of the first resource in this page of search results. - Offset *int64 `json:"offset" validate:"required"` - - // The maximum number of resources returned in each page of search results. - Limit *int64 `json:"limit" validate:"required"` - - // The overall total number of resources in the search result set. - TotalCount *int64 `json:"total_count,omitempty"` +// FilterTerms : Offering filter terms. +type FilterTerms struct { + // List of values to match against. If include is true, then if the offering has one of the values then the offering is + // included. If include is false, then if the offering has one of the values then the offering is excluded. + FilterTerms []string `json:"filter_terms,omitempty"` +} - // The number of resources returned in this page of search results. - ResourceCount *int64 `json:"resource_count,omitempty"` - - // A URL for retrieving the first page of search results. - First *string `json:"first,omitempty"` - - // A URL for retrieving the last page of search results. - Last *string `json:"last,omitempty"` +// UnmarshalFilterTerms unmarshals an instance of FilterTerms from the specified map of raw messages. +func UnmarshalFilterTerms(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FilterTerms) + err = core.UnmarshalPrimitive(m, "filter_terms", &obj.FilterTerms) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} - // A URL for retrieving the previous page of search results. - Prev *string `json:"prev,omitempty"` +// Filters : Filters for account and catalog filters. +type Filters struct { + // -> true - Include all of the public catalog when filtering. Further settings will specifically exclude some + // offerings. false - Exclude all of the public catalog when filtering. Further settings will specifically include some + // offerings. + IncludeAll *bool `json:"include_all,omitempty"` - // A URL for retrieving the next page of search results. - Next *string `json:"next,omitempty"` + // Filter against offering properties. + CategoryFilters map[string]CategoryFilter `json:"category_filters,omitempty"` - // Resulting objects. - Resources []string `json:"resources,omitempty"` + // Filter on offering ID's. There is an include filter and an exclule filter. Both can be set. + IDFilters *IDFilter `json:"id_filters,omitempty"` } -// UnmarshalNamespaceSearchResult unmarshals an instance of NamespaceSearchResult from the specified map of raw messages. -func UnmarshalNamespaceSearchResult(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NamespaceSearchResult) - err = core.UnmarshalPrimitive(m, "offset", &obj.Offset) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_count", &obj.ResourceCount) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "first", &obj.First) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "last", &obj.Last) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "prev", &obj.Prev) +// UnmarshalFilters unmarshals an instance of Filters from the specified map of raw messages. +func UnmarshalFilters(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Filters) + err = core.UnmarshalPrimitive(m, "include_all", &obj.IncludeAll) if err != nil { return } - err = core.UnmarshalPrimitive(m, "next", &obj.Next) + err = core.UnmarshalModel(m, "category_filters", &obj.CategoryFilters, UnmarshalCategoryFilter) if err != nil { return } - err = core.UnmarshalPrimitive(m, "resources", &obj.Resources) + err = core.UnmarshalModel(m, "id_filters", &obj.IDFilters, UnmarshalIDFilter) if err != nil { return } @@ -10056,44 +10935,37 @@ func UnmarshalNamespaceSearchResult(m map[string]json.RawMessage, result interfa return } -// ObjectAccess : object access. -type ObjectAccess struct { - // unique id. - ID *string `json:"id,omitempty"` - - // account id. - Account *string `json:"account,omitempty"` +// Flavor : Version Flavor Information. Only supported for Product kind Solution. +type Flavor struct { + // Programmatic name for this flavor. + Name *string `json:"name,omitempty"` - // unique id. - CatalogID *string `json:"catalog_id,omitempty"` + // Label for this flavor. + Label *string `json:"label,omitempty"` - // object id. - TargetID *string `json:"target_id,omitempty"` + // A map of translated strings, by language code. + LabelI18n map[string]string `json:"label_i18n,omitempty"` - // date and time create. - Create *strfmt.DateTime `json:"create,omitempty"` + // Order that this flavor should appear when listed for a single version. + Index *int64 `json:"index,omitempty"` } -// UnmarshalObjectAccess unmarshals an instance of ObjectAccess from the specified map of raw messages. -func UnmarshalObjectAccess(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ObjectAccess) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "account", &obj.Account) +// UnmarshalFlavor unmarshals an instance of Flavor from the specified map of raw messages. +func UnmarshalFlavor(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Flavor) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "catalog_id", &obj.CatalogID) + err = core.UnmarshalPrimitive(m, "label", &obj.Label) if err != nil { return } - err = core.UnmarshalPrimitive(m, "target_id", &obj.TargetID) + err = core.UnmarshalPrimitive(m, "label_i18n", &obj.LabelI18n) if err != nil { return } - err = core.UnmarshalPrimitive(m, "create", &obj.Create) + err = core.UnmarshalPrimitive(m, "index", &obj.Index) if err != nil { return } @@ -10101,1374 +10973,855 @@ func UnmarshalObjectAccess(m map[string]json.RawMessage, result interface{}) (er return } -// ObjectAccessListResult : Paginated object search result. -type ObjectAccessListResult struct { - // The offset (origin 0) of the first resource in this page of search results. - Offset *int64 `json:"offset" validate:"required"` +// GetCatalogAccountAuditOptions : The GetCatalogAccountAudit options. +type GetCatalogAccountAuditOptions struct { + // Auditlog ID. + AuditlogIdentifier *string `json:"auditlog_identifier" validate:"required,ne="` - // The maximum number of resources returned in each page of search results. - Limit *int64 `json:"limit" validate:"required"` + // Auditlog Lookup Names - by default names are not returned in auditlog. + Lookupnames *bool `json:"lookupnames,omitempty"` - // The overall total number of resources in the search result set. - TotalCount *int64 `json:"total_count,omitempty"` + // Allows users to set headers on API requests + Headers map[string]string +} - // The number of resources returned in this page of search results. - ResourceCount *int64 `json:"resource_count,omitempty"` +// NewGetCatalogAccountAuditOptions : Instantiate GetCatalogAccountAuditOptions +func (*CatalogManagementV1) NewGetCatalogAccountAuditOptions(auditlogIdentifier string) *GetCatalogAccountAuditOptions { + return &GetCatalogAccountAuditOptions{ + AuditlogIdentifier: core.StringPtr(auditlogIdentifier), + } +} - // A URL for retrieving the first page of search results. - First *string `json:"first,omitempty"` +// SetAuditlogIdentifier : Allow user to set AuditlogIdentifier +func (_options *GetCatalogAccountAuditOptions) SetAuditlogIdentifier(auditlogIdentifier string) *GetCatalogAccountAuditOptions { + _options.AuditlogIdentifier = core.StringPtr(auditlogIdentifier) + return _options +} - // A URL for retrieving the last page of search results. - Last *string `json:"last,omitempty"` +// SetLookupnames : Allow user to set Lookupnames +func (_options *GetCatalogAccountAuditOptions) SetLookupnames(lookupnames bool) *GetCatalogAccountAuditOptions { + _options.Lookupnames = core.BoolPtr(lookupnames) + return _options +} - // A URL for retrieving the previous page of search results. - Prev *string `json:"prev,omitempty"` +// SetHeaders : Allow user to set Headers +func (options *GetCatalogAccountAuditOptions) SetHeaders(param map[string]string) *GetCatalogAccountAuditOptions { + options.Headers = param + return options +} - // A URL for retrieving the next page of search results. - Next *string `json:"next,omitempty"` +// GetCatalogAccountFiltersOptions : The GetCatalogAccountFilters options. +type GetCatalogAccountFiltersOptions struct { + // catalog id. Narrow down filters to the account and just the one catalog. + Catalog *string `json:"catalog,omitempty"` - // Resulting objects. - Resources []ObjectAccess `json:"resources,omitempty"` + // Allows users to set headers on API requests + Headers map[string]string } -// UnmarshalObjectAccessListResult unmarshals an instance of ObjectAccessListResult from the specified map of raw messages. -func UnmarshalObjectAccessListResult(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ObjectAccessListResult) - err = core.UnmarshalPrimitive(m, "offset", &obj.Offset) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_count", &obj.ResourceCount) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "first", &obj.First) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "last", &obj.Last) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "prev", &obj.Prev) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "next", &obj.Next) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resources", &obj.Resources, UnmarshalObjectAccess) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return +// NewGetCatalogAccountFiltersOptions : Instantiate GetCatalogAccountFiltersOptions +func (*CatalogManagementV1) NewGetCatalogAccountFiltersOptions() *GetCatalogAccountFiltersOptions { + return &GetCatalogAccountFiltersOptions{} } -// ObjectListResult : Paginated object search result. -type ObjectListResult struct { - // The offset (origin 0) of the first resource in this page of search results. - Offset *int64 `json:"offset" validate:"required"` +// SetCatalog : Allow user to set Catalog +func (_options *GetCatalogAccountFiltersOptions) SetCatalog(catalog string) *GetCatalogAccountFiltersOptions { + _options.Catalog = core.StringPtr(catalog) + return _options +} - // The maximum number of resources returned in each page of search results. - Limit *int64 `json:"limit" validate:"required"` +// SetHeaders : Allow user to set Headers +func (options *GetCatalogAccountFiltersOptions) SetHeaders(param map[string]string) *GetCatalogAccountFiltersOptions { + options.Headers = param + return options +} - // The overall total number of resources in the search result set. - TotalCount *int64 `json:"total_count,omitempty"` +// GetCatalogAccountOptions : The GetCatalogAccount options. +type GetCatalogAccountOptions struct { - // The number of resources returned in this page of search results. - ResourceCount *int64 `json:"resource_count,omitempty"` + // Allows users to set headers on API requests + Headers map[string]string +} - // A URL for retrieving the first page of search results. - First *string `json:"first,omitempty"` +// NewGetCatalogAccountOptions : Instantiate GetCatalogAccountOptions +func (*CatalogManagementV1) NewGetCatalogAccountOptions() *GetCatalogAccountOptions { + return &GetCatalogAccountOptions{} +} - // A URL for retrieving the last page of search results. - Last *string `json:"last,omitempty"` +// SetHeaders : Allow user to set Headers +func (options *GetCatalogAccountOptions) SetHeaders(param map[string]string) *GetCatalogAccountOptions { + options.Headers = param + return options +} - // A URL for retrieving the previous page of search results. - Prev *string `json:"prev,omitempty"` +// GetCatalogAuditOptions : The GetCatalogAudit options. +type GetCatalogAuditOptions struct { + // Catalog identifier. + CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` - // A URL for retrieving the next page of search results. - Next *string `json:"next,omitempty"` + // Auditlog ID. + AuditlogIdentifier *string `json:"auditlog_identifier" validate:"required,ne="` - // Resulting objects. - Resources []CatalogObject `json:"resources,omitempty"` + // Auditlog Lookup Names - by default names are not returned in auditlog. + Lookupnames *bool `json:"lookupnames,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string } -// UnmarshalObjectListResult unmarshals an instance of ObjectListResult from the specified map of raw messages. -func UnmarshalObjectListResult(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ObjectListResult) - err = core.UnmarshalPrimitive(m, "offset", &obj.Offset) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_count", &obj.ResourceCount) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "first", &obj.First) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "last", &obj.Last) - if err != nil { - return +// NewGetCatalogAuditOptions : Instantiate GetCatalogAuditOptions +func (*CatalogManagementV1) NewGetCatalogAuditOptions(catalogIdentifier string, auditlogIdentifier string) *GetCatalogAuditOptions { + return &GetCatalogAuditOptions{ + CatalogIdentifier: core.StringPtr(catalogIdentifier), + AuditlogIdentifier: core.StringPtr(auditlogIdentifier), } - err = core.UnmarshalPrimitive(m, "prev", &obj.Prev) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "next", &obj.Next) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resources", &obj.Resources, UnmarshalCatalogObject) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return } -// ObjectSearchResult : Paginated object search result. -type ObjectSearchResult struct { - // The offset (origin 0) of the first resource in this page of search results. - Offset *int64 `json:"offset" validate:"required"` - - // The maximum number of resources returned in each page of search results. - Limit *int64 `json:"limit" validate:"required"` - - // The overall total number of resources in the search result set. - TotalCount *int64 `json:"total_count,omitempty"` - - // The number of resources returned in this page of search results. - ResourceCount *int64 `json:"resource_count,omitempty"` +// SetCatalogIdentifier : Allow user to set CatalogIdentifier +func (_options *GetCatalogAuditOptions) SetCatalogIdentifier(catalogIdentifier string) *GetCatalogAuditOptions { + _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) + return _options +} - // A URL for retrieving the first page of search results. - First *string `json:"first,omitempty"` +// SetAuditlogIdentifier : Allow user to set AuditlogIdentifier +func (_options *GetCatalogAuditOptions) SetAuditlogIdentifier(auditlogIdentifier string) *GetCatalogAuditOptions { + _options.AuditlogIdentifier = core.StringPtr(auditlogIdentifier) + return _options +} - // A URL for retrieving the last page of search results. - Last *string `json:"last,omitempty"` +// SetLookupnames : Allow user to set Lookupnames +func (_options *GetCatalogAuditOptions) SetLookupnames(lookupnames bool) *GetCatalogAuditOptions { + _options.Lookupnames = core.BoolPtr(lookupnames) + return _options +} - // A URL for retrieving the previous page of search results. - Prev *string `json:"prev,omitempty"` +// SetHeaders : Allow user to set Headers +func (options *GetCatalogAuditOptions) SetHeaders(param map[string]string) *GetCatalogAuditOptions { + options.Headers = param + return options +} - // A URL for retrieving the next page of search results. - Next *string `json:"next,omitempty"` +// GetCatalogOptions : The GetCatalog options. +type GetCatalogOptions struct { + // Catalog identifier. + CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` - // Resulting objects. - Resources []CatalogObject `json:"resources,omitempty"` + // Allows users to set headers on API requests + Headers map[string]string } -// UnmarshalObjectSearchResult unmarshals an instance of ObjectSearchResult from the specified map of raw messages. -func UnmarshalObjectSearchResult(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ObjectSearchResult) - err = core.UnmarshalPrimitive(m, "offset", &obj.Offset) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_count", &obj.ResourceCount) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "first", &obj.First) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "last", &obj.Last) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "prev", &obj.Prev) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "next", &obj.Next) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resources", &obj.Resources, UnmarshalCatalogObject) - if err != nil { - return +// NewGetCatalogOptions : Instantiate GetCatalogOptions +func (*CatalogManagementV1) NewGetCatalogOptions(catalogIdentifier string) *GetCatalogOptions { + return &GetCatalogOptions{ + CatalogIdentifier: core.StringPtr(catalogIdentifier), } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return } -// Offering : Offering information. -type Offering struct { - // unique id. - ID *string `json:"id,omitempty"` - - // Cloudant revision. - Rev *string `json:"_rev,omitempty"` +// SetCatalogIdentifier : Allow user to set CatalogIdentifier +func (_options *GetCatalogOptions) SetCatalogIdentifier(catalogIdentifier string) *GetCatalogOptions { + _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) + return _options +} - // The url for this specific offering. - URL *string `json:"url,omitempty"` +// SetHeaders : Allow user to set Headers +func (options *GetCatalogOptions) SetHeaders(param map[string]string) *GetCatalogOptions { + options.Headers = param + return options +} - // The crn for this specific offering. - CRN *string `json:"crn,omitempty"` +// GetClusterOptions : The GetCluster options. +type GetClusterOptions struct { + // ID of the cluster. + ClusterID *string `json:"cluster_id" validate:"required,ne="` - // Display Name in the requested language. - Label *string `json:"label,omitempty"` + // Region of the cluster. + Region *string `json:"region" validate:"required"` - // The programmatic name of this offering. - Name *string `json:"name,omitempty"` + // IAM Refresh token. + XAuthRefreshToken *string `json:"X-Auth-Refresh-Token" validate:"required"` - // URL for an icon associated with this offering. - OfferingIconURL *string `json:"offering_icon_url,omitempty"` + // Allows users to set headers on API requests + Headers map[string]string +} - // URL for an additional docs with this offering. - OfferingDocsURL *string `json:"offering_docs_url,omitempty"` +// NewGetClusterOptions : Instantiate GetClusterOptions +func (*CatalogManagementV1) NewGetClusterOptions(clusterID string, region string, xAuthRefreshToken string) *GetClusterOptions { + return &GetClusterOptions{ + ClusterID: core.StringPtr(clusterID), + Region: core.StringPtr(region), + XAuthRefreshToken: core.StringPtr(xAuthRefreshToken), + } +} - // [deprecated] - Use offering.support instead. URL to be displayed in the Consumption UI for getting support on this - // offering. - OfferingSupportURL *string `json:"offering_support_url,omitempty"` +// SetClusterID : Allow user to set ClusterID +func (_options *GetClusterOptions) SetClusterID(clusterID string) *GetClusterOptions { + _options.ClusterID = core.StringPtr(clusterID) + return _options +} - // List of tags associated with this catalog. - Tags []string `json:"tags,omitempty"` +// SetRegion : Allow user to set Region +func (_options *GetClusterOptions) SetRegion(region string) *GetClusterOptions { + _options.Region = core.StringPtr(region) + return _options +} - // List of keywords associated with offering, typically used to search for it. - Keywords []string `json:"keywords,omitempty"` +// SetXAuthRefreshToken : Allow user to set XAuthRefreshToken +func (_options *GetClusterOptions) SetXAuthRefreshToken(xAuthRefreshToken string) *GetClusterOptions { + _options.XAuthRefreshToken = core.StringPtr(xAuthRefreshToken) + return _options +} - // Repository info for offerings. - Rating *Rating `json:"rating,omitempty"` +// SetHeaders : Allow user to set Headers +func (options *GetClusterOptions) SetHeaders(param map[string]string) *GetClusterOptions { + options.Headers = param + return options +} - // The date and time this catalog was created. - Created *strfmt.DateTime `json:"created,omitempty"` +// GetConsumptionOfferingsOptions : The GetConsumptionOfferings options. +type GetConsumptionOfferingsOptions struct { + // true - Strip down the content of what is returned. For example don't return the readme. Makes the result much + // smaller. Defaults to false. + Digest *bool `json:"digest,omitempty"` - // The date and time this catalog was last updated. - Updated *strfmt.DateTime `json:"updated,omitempty"` + // catalog id. Narrow search down to just a particular catalog. It will apply the catalog's public filters to the + // public catalog offerings on the result. + Catalog *string `json:"catalog,omitempty"` - // Short description in the requested language. - ShortDescription *string `json:"short_description,omitempty"` + // What should be selected. Default is 'all' which will return both public and private offerings. 'public' returns only + // the public offerings and 'private' returns only the private offerings. + Select *string `json:"select,omitempty"` - // Long description in the requested language. - LongDescription *string `json:"long_description,omitempty"` + // true - include offerings which have been marked as hidden. The default is false and hidden offerings are not + // returned. + IncludeHidden *bool `json:"includeHidden,omitempty"` - // list of features associated with this offering. - Features []Feature `json:"features,omitempty"` + // number or results to return. + Limit *int64 `json:"limit,omitempty"` - // Array of kind. - Kinds []Kind `json:"kinds,omitempty"` + // number of results to skip before returning values. + Offset *int64 `json:"offset,omitempty"` - // Is it permitted to request publishing to IBM or Public. - PermitRequestIBMPublicPublish *bool `json:"permit_request_ibm_public_publish,omitempty"` + // Allows users to set headers on API requests + Headers map[string]string +} - // Indicates if this offering has been approved for use by all IBMers. - IBMPublishApproved *bool `json:"ibm_publish_approved,omitempty"` +// Constants associated with the GetConsumptionOfferingsOptions.Select property. +// What should be selected. Default is 'all' which will return both public and private offerings. 'public' returns only +// the public offerings and 'private' returns only the private offerings. +const ( + GetConsumptionOfferingsOptionsSelectAllConst = "all" + GetConsumptionOfferingsOptionsSelectPrivateConst = "private" + GetConsumptionOfferingsOptionsSelectPublicConst = "public" +) - // Indicates if this offering has been approved for use by all IBM Cloud users. - PublicPublishApproved *bool `json:"public_publish_approved,omitempty"` +// NewGetConsumptionOfferingsOptions : Instantiate GetConsumptionOfferingsOptions +func (*CatalogManagementV1) NewGetConsumptionOfferingsOptions() *GetConsumptionOfferingsOptions { + return &GetConsumptionOfferingsOptions{} +} - // The original offering CRN that this publish entry came from. - PublicOriginalCRN *string `json:"public_original_crn,omitempty"` +// SetDigest : Allow user to set Digest +func (_options *GetConsumptionOfferingsOptions) SetDigest(digest bool) *GetConsumptionOfferingsOptions { + _options.Digest = core.BoolPtr(digest) + return _options +} - // The crn of the public catalog entry of this offering. - PublishPublicCRN *string `json:"publish_public_crn,omitempty"` +// SetCatalog : Allow user to set Catalog +func (_options *GetConsumptionOfferingsOptions) SetCatalog(catalog string) *GetConsumptionOfferingsOptions { + _options.Catalog = core.StringPtr(catalog) + return _options +} - // The portal's approval record ID. - PortalApprovalRecord *string `json:"portal_approval_record,omitempty"` +// SetSelect : Allow user to set Select +func (_options *GetConsumptionOfferingsOptions) SetSelect(selectVar string) *GetConsumptionOfferingsOptions { + _options.Select = core.StringPtr(selectVar) + return _options +} - // The portal UI URL. - PortalUIURL *string `json:"portal_ui_url,omitempty"` +// SetIncludeHidden : Allow user to set IncludeHidden +func (_options *GetConsumptionOfferingsOptions) SetIncludeHidden(includeHidden bool) *GetConsumptionOfferingsOptions { + _options.IncludeHidden = core.BoolPtr(includeHidden) + return _options +} - // The id of the catalog containing this offering. - CatalogID *string `json:"catalog_id,omitempty"` - - // The name of the catalog. - CatalogName *string `json:"catalog_name,omitempty"` - - // Map of metadata values for this offering. - Metadata map[string]interface{} `json:"metadata,omitempty"` - - // A disclaimer for this offering. - Disclaimer *string `json:"disclaimer,omitempty"` +// SetLimit : Allow user to set Limit +func (_options *GetConsumptionOfferingsOptions) SetLimit(limit int64) *GetConsumptionOfferingsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} - // Determine if this offering should be displayed in the Consumption UI. - Hidden *bool `json:"hidden,omitempty"` +// SetOffset : Allow user to set Offset +func (_options *GetConsumptionOfferingsOptions) SetOffset(offset int64) *GetConsumptionOfferingsOptions { + _options.Offset = core.Int64Ptr(offset) + return _options +} - // Deprecated - Provider of this offering. - Provider *string `json:"provider,omitempty"` +// SetHeaders : Allow user to set Headers +func (options *GetConsumptionOfferingsOptions) SetHeaders(param map[string]string) *GetConsumptionOfferingsOptions { + options.Headers = param + return options +} - // Information on the provider for this offering, or omitted if no provider information is given. - ProviderInfo *ProviderInfo `json:"provider_info,omitempty"` +// GetEnterpriseAuditOptions : The GetEnterpriseAudit options. +type GetEnterpriseAuditOptions struct { + // Enterprise ID. + EnterpriseIdentifier *string `json:"enterprise_identifier" validate:"required,ne="` - // Repository info for offerings. - RepoInfo *RepoInfo `json:"repo_info,omitempty"` + // Auditlog ID. + AuditlogIdentifier *string `json:"auditlog_identifier" validate:"required,ne="` - // Offering Support information. - Support *Support `json:"support,omitempty"` + // Auditlog Lookup Names - by default names are not returned in auditlog. + Lookupnames *bool `json:"lookupnames,omitempty"` - // A list of media items related to this offering. - Media []MediaItem `json:"media,omitempty"` + // Allows users to set headers on API requests + Headers map[string]string } -// UnmarshalOffering unmarshals an instance of Offering from the specified map of raw messages. -func UnmarshalOffering(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(Offering) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "_rev", &obj.Rev) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "url", &obj.URL) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "label", &obj.Label) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "offering_icon_url", &obj.OfferingIconURL) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "offering_docs_url", &obj.OfferingDocsURL) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "offering_support_url", &obj.OfferingSupportURL) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "keywords", &obj.Keywords) - if err != nil { - return - } - err = core.UnmarshalModel(m, "rating", &obj.Rating, UnmarshalRating) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created", &obj.Created) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "updated", &obj.Updated) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "short_description", &obj.ShortDescription) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "long_description", &obj.LongDescription) - if err != nil { - return - } - err = core.UnmarshalModel(m, "features", &obj.Features, UnmarshalFeature) - if err != nil { - return - } - err = core.UnmarshalModel(m, "kinds", &obj.Kinds, UnmarshalKind) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "permit_request_ibm_public_publish", &obj.PermitRequestIBMPublicPublish) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "ibm_publish_approved", &obj.IBMPublishApproved) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "public_publish_approved", &obj.PublicPublishApproved) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "public_original_crn", &obj.PublicOriginalCRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "publish_public_crn", &obj.PublishPublicCRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "portal_approval_record", &obj.PortalApprovalRecord) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "portal_ui_url", &obj.PortalUIURL) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "catalog_id", &obj.CatalogID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "catalog_name", &obj.CatalogName) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "metadata", &obj.Metadata) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "disclaimer", &obj.Disclaimer) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "hidden", &obj.Hidden) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "provider", &obj.Provider) - if err != nil { - return - } - err = core.UnmarshalModel(m, "provider_info", &obj.ProviderInfo, UnmarshalProviderInfo) - if err != nil { - return - } - err = core.UnmarshalModel(m, "repo_info", &obj.RepoInfo, UnmarshalRepoInfo) - if err != nil { - return - } - err = core.UnmarshalModel(m, "support", &obj.Support, UnmarshalSupport) - if err != nil { - return - } - err = core.UnmarshalModel(m, "media", &obj.Media, UnmarshalMediaItem) - if err != nil { - return +// NewGetEnterpriseAuditOptions : Instantiate GetEnterpriseAuditOptions +func (*CatalogManagementV1) NewGetEnterpriseAuditOptions(enterpriseIdentifier string, auditlogIdentifier string) *GetEnterpriseAuditOptions { + return &GetEnterpriseAuditOptions{ + EnterpriseIdentifier: core.StringPtr(enterpriseIdentifier), + AuditlogIdentifier: core.StringPtr(auditlogIdentifier), } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return } -func (*CatalogManagementV1) NewOfferingPatch(offering *Offering) (_patch []JSONPatchOperation) { - if (offering.ID != nil) { - _patch = append(_patch, JSONPatchOperation{ - Op: core.StringPtr(JSONPatchOperationOpAddConst), - Path: core.StringPtr("/id"), - Value: offering.ID, - }) - } - if (offering.Rev != nil) { - _patch = append(_patch, JSONPatchOperation{ - Op: core.StringPtr(JSONPatchOperationOpAddConst), - Path: core.StringPtr("/_rev"), - Value: offering.Rev, - }) - } - if (offering.URL != nil) { - _patch = append(_patch, JSONPatchOperation{ - Op: core.StringPtr(JSONPatchOperationOpAddConst), - Path: core.StringPtr("/url"), - Value: offering.URL, - }) - } - if (offering.CRN != nil) { - _patch = append(_patch, JSONPatchOperation{ - Op: core.StringPtr(JSONPatchOperationOpAddConst), - Path: core.StringPtr("/crn"), - Value: offering.CRN, - }) - } - if (offering.Label != nil) { - _patch = append(_patch, JSONPatchOperation{ - Op: core.StringPtr(JSONPatchOperationOpAddConst), - Path: core.StringPtr("/label"), - Value: offering.Label, - }) - } - if (offering.Name != nil) { - _patch = append(_patch, JSONPatchOperation{ - Op: core.StringPtr(JSONPatchOperationOpAddConst), - Path: core.StringPtr("/name"), - Value: offering.Name, - }) - } - if (offering.OfferingIconURL != nil) { - _patch = append(_patch, JSONPatchOperation{ - Op: core.StringPtr(JSONPatchOperationOpAddConst), - Path: core.StringPtr("/offering_icon_url"), - Value: offering.OfferingIconURL, - }) - } - if (offering.OfferingDocsURL != nil) { - _patch = append(_patch, JSONPatchOperation{ - Op: core.StringPtr(JSONPatchOperationOpAddConst), - Path: core.StringPtr("/offering_docs_url"), - Value: offering.OfferingDocsURL, - }) - } - if (offering.OfferingSupportURL != nil) { - _patch = append(_patch, JSONPatchOperation{ - Op: core.StringPtr(JSONPatchOperationOpAddConst), - Path: core.StringPtr("/offering_support_url"), - Value: offering.OfferingSupportURL, - }) - } - if (offering.Tags != nil) { - _patch = append(_patch, JSONPatchOperation{ - Op: core.StringPtr(JSONPatchOperationOpAddConst), - Path: core.StringPtr("/tags"), - Value: offering.Tags, - }) - } - if (offering.Keywords != nil) { - _patch = append(_patch, JSONPatchOperation{ - Op: core.StringPtr(JSONPatchOperationOpAddConst), - Path: core.StringPtr("/keywords"), - Value: offering.Keywords, - }) - } - if (offering.Rating != nil) { - _patch = append(_patch, JSONPatchOperation{ - Op: core.StringPtr(JSONPatchOperationOpAddConst), - Path: core.StringPtr("/rating"), - Value: offering.Rating, - }) - } - if (offering.Created != nil) { - _patch = append(_patch, JSONPatchOperation{ - Op: core.StringPtr(JSONPatchOperationOpAddConst), - Path: core.StringPtr("/created"), - Value: offering.Created, - }) - } - if (offering.Updated != nil) { - _patch = append(_patch, JSONPatchOperation{ - Op: core.StringPtr(JSONPatchOperationOpAddConst), - Path: core.StringPtr("/updated"), - Value: offering.Updated, - }) - } - if (offering.ShortDescription != nil) { - _patch = append(_patch, JSONPatchOperation{ - Op: core.StringPtr(JSONPatchOperationOpAddConst), - Path: core.StringPtr("/short_description"), - Value: offering.ShortDescription, - }) - } - if (offering.LongDescription != nil) { - _patch = append(_patch, JSONPatchOperation{ - Op: core.StringPtr(JSONPatchOperationOpAddConst), - Path: core.StringPtr("/long_description"), - Value: offering.LongDescription, - }) - } - if (offering.Features != nil) { - _patch = append(_patch, JSONPatchOperation{ - Op: core.StringPtr(JSONPatchOperationOpAddConst), - Path: core.StringPtr("/features"), - Value: offering.Features, - }) - } - if (offering.Kinds != nil) { - _patch = append(_patch, JSONPatchOperation{ - Op: core.StringPtr(JSONPatchOperationOpAddConst), - Path: core.StringPtr("/kinds"), - Value: offering.Kinds, - }) - } - if (offering.PermitRequestIBMPublicPublish != nil) { - _patch = append(_patch, JSONPatchOperation{ - Op: core.StringPtr(JSONPatchOperationOpAddConst), - Path: core.StringPtr("/permit_request_ibm_public_publish"), - Value: offering.PermitRequestIBMPublicPublish, - }) - } - if (offering.IBMPublishApproved != nil) { - _patch = append(_patch, JSONPatchOperation{ - Op: core.StringPtr(JSONPatchOperationOpAddConst), - Path: core.StringPtr("/ibm_publish_approved"), - Value: offering.IBMPublishApproved, - }) - } - if (offering.PublicPublishApproved != nil) { - _patch = append(_patch, JSONPatchOperation{ - Op: core.StringPtr(JSONPatchOperationOpAddConst), - Path: core.StringPtr("/public_publish_approved"), - Value: offering.PublicPublishApproved, - }) - } - if (offering.PublicOriginalCRN != nil) { - _patch = append(_patch, JSONPatchOperation{ - Op: core.StringPtr(JSONPatchOperationOpAddConst), - Path: core.StringPtr("/public_original_crn"), - Value: offering.PublicOriginalCRN, - }) - } - if (offering.PublishPublicCRN != nil) { - _patch = append(_patch, JSONPatchOperation{ - Op: core.StringPtr(JSONPatchOperationOpAddConst), - Path: core.StringPtr("/publish_public_crn"), - Value: offering.PublishPublicCRN, - }) - } - if (offering.PortalApprovalRecord != nil) { - _patch = append(_patch, JSONPatchOperation{ - Op: core.StringPtr(JSONPatchOperationOpAddConst), - Path: core.StringPtr("/portal_approval_record"), - Value: offering.PortalApprovalRecord, - }) - } - if (offering.PortalUIURL != nil) { - _patch = append(_patch, JSONPatchOperation{ - Op: core.StringPtr(JSONPatchOperationOpAddConst), - Path: core.StringPtr("/portal_ui_url"), - Value: offering.PortalUIURL, - }) - } - if (offering.CatalogID != nil) { - _patch = append(_patch, JSONPatchOperation{ - Op: core.StringPtr(JSONPatchOperationOpAddConst), - Path: core.StringPtr("/catalog_id"), - Value: offering.CatalogID, - }) - } - if (offering.CatalogName != nil) { - _patch = append(_patch, JSONPatchOperation{ - Op: core.StringPtr(JSONPatchOperationOpAddConst), - Path: core.StringPtr("/catalog_name"), - Value: offering.CatalogName, - }) - } - if (offering.Metadata != nil) { - _patch = append(_patch, JSONPatchOperation{ - Op: core.StringPtr(JSONPatchOperationOpAddConst), - Path: core.StringPtr("/metadata"), - Value: offering.Metadata, - }) - } - if (offering.Disclaimer != nil) { - _patch = append(_patch, JSONPatchOperation{ - Op: core.StringPtr(JSONPatchOperationOpAddConst), - Path: core.StringPtr("/disclaimer"), - Value: offering.Disclaimer, - }) - } - if (offering.Hidden != nil) { - _patch = append(_patch, JSONPatchOperation{ - Op: core.StringPtr(JSONPatchOperationOpAddConst), - Path: core.StringPtr("/hidden"), - Value: offering.Hidden, - }) - } - if (offering.Provider != nil) { - _patch = append(_patch, JSONPatchOperation{ - Op: core.StringPtr(JSONPatchOperationOpAddConst), - Path: core.StringPtr("/provider"), - Value: offering.Provider, - }) - } - if (offering.ProviderInfo != nil) { - _patch = append(_patch, JSONPatchOperation{ - Op: core.StringPtr(JSONPatchOperationOpAddConst), - Path: core.StringPtr("/provider_info"), - Value: offering.ProviderInfo, - }) - } - if (offering.RepoInfo != nil) { - _patch = append(_patch, JSONPatchOperation{ - Op: core.StringPtr(JSONPatchOperationOpAddConst), - Path: core.StringPtr("/repo_info"), - Value: offering.RepoInfo, - }) - } - if (offering.Support != nil) { - _patch = append(_patch, JSONPatchOperation{ - Op: core.StringPtr(JSONPatchOperationOpAddConst), - Path: core.StringPtr("/support"), - Value: offering.Support, - }) - } - if (offering.Media != nil) { - _patch = append(_patch, JSONPatchOperation{ - Op: core.StringPtr(JSONPatchOperationOpAddConst), - Path: core.StringPtr("/media"), - Value: offering.Media, - }) - } - return +// SetEnterpriseIdentifier : Allow user to set EnterpriseIdentifier +func (_options *GetEnterpriseAuditOptions) SetEnterpriseIdentifier(enterpriseIdentifier string) *GetEnterpriseAuditOptions { + _options.EnterpriseIdentifier = core.StringPtr(enterpriseIdentifier) + return _options } -// OfferingInstance : A offering instance resource (provision instance of a catalog offering). -type OfferingInstance struct { - // provisioned instance ID (part of the CRN). - ID *string `json:"id,omitempty"` - - // Cloudant revision. - Rev *string `json:"_rev,omitempty"` +// SetAuditlogIdentifier : Allow user to set AuditlogIdentifier +func (_options *GetEnterpriseAuditOptions) SetAuditlogIdentifier(auditlogIdentifier string) *GetEnterpriseAuditOptions { + _options.AuditlogIdentifier = core.StringPtr(auditlogIdentifier) + return _options +} - // url reference to this object. - URL *string `json:"url,omitempty"` +// SetLookupnames : Allow user to set Lookupnames +func (_options *GetEnterpriseAuditOptions) SetLookupnames(lookupnames bool) *GetEnterpriseAuditOptions { + _options.Lookupnames = core.BoolPtr(lookupnames) + return _options +} - // platform CRN for this instance. - CRN *string `json:"crn,omitempty"` +// SetHeaders : Allow user to set Headers +func (options *GetEnterpriseAuditOptions) SetHeaders(param map[string]string) *GetEnterpriseAuditOptions { + options.Headers = param + return options +} - // the label for this instance. - Label *string `json:"label,omitempty"` +// GetNamespacesOptions : The GetNamespaces options. +type GetNamespacesOptions struct { + // ID of the cluster. + ClusterID *string `json:"cluster_id" validate:"required,ne="` - // Catalog ID this instance was created from. - CatalogID *string `json:"catalog_id,omitempty"` + // Cluster region. + Region *string `json:"region" validate:"required"` - // Offering ID this instance was created from. - OfferingID *string `json:"offering_id,omitempty"` + // IAM Refresh token. + XAuthRefreshToken *string `json:"X-Auth-Refresh-Token" validate:"required"` - // the format this instance has (helm, operator, ova...). - KindFormat *string `json:"kind_format,omitempty"` + // The maximum number of results to return. + Limit *int64 `json:"limit,omitempty"` - // The version this instance was installed from (not version id). - Version *string `json:"version,omitempty"` + // The number of results to skip before returning values. + Offset *int64 `json:"offset,omitempty"` - // Cluster ID. - ClusterID *string `json:"cluster_id,omitempty"` + // Allows users to set headers on API requests + Headers map[string]string +} - // Cluster region (e.g., us-south). - ClusterRegion *string `json:"cluster_region,omitempty"` +// NewGetNamespacesOptions : Instantiate GetNamespacesOptions +func (*CatalogManagementV1) NewGetNamespacesOptions(clusterID string, region string, xAuthRefreshToken string) *GetNamespacesOptions { + return &GetNamespacesOptions{ + ClusterID: core.StringPtr(clusterID), + Region: core.StringPtr(region), + XAuthRefreshToken: core.StringPtr(xAuthRefreshToken), + } +} - // List of target namespaces to install into. - ClusterNamespaces []string `json:"cluster_namespaces,omitempty"` +// SetClusterID : Allow user to set ClusterID +func (_options *GetNamespacesOptions) SetClusterID(clusterID string) *GetNamespacesOptions { + _options.ClusterID = core.StringPtr(clusterID) + return _options +} - // designate to install into all namespaces. - ClusterAllNamespaces *bool `json:"cluster_all_namespaces,omitempty"` +// SetRegion : Allow user to set Region +func (_options *GetNamespacesOptions) SetRegion(region string) *GetNamespacesOptions { + _options.Region = core.StringPtr(region) + return _options +} - // Id of the schematics workspace, for offering instances provisioned through schematics. - SchematicsWorkspaceID *string `json:"schematics_workspace_id,omitempty"` +// SetXAuthRefreshToken : Allow user to set XAuthRefreshToken +func (_options *GetNamespacesOptions) SetXAuthRefreshToken(xAuthRefreshToken string) *GetNamespacesOptions { + _options.XAuthRefreshToken = core.StringPtr(xAuthRefreshToken) + return _options +} - // Id of the resource group to provision the offering instance into. - ResourceGroupID *string `json:"resource_group_id,omitempty"` +// SetLimit : Allow user to set Limit +func (_options *GetNamespacesOptions) SetLimit(limit int64) *GetNamespacesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} - // Type of install plan (also known as approval strategy) for operator subscriptions. Can be either automatic, which - // automatically upgrades operators to the latest in a channel, or manual, which requires approval on the cluster. - InstallPlan *string `json:"install_plan,omitempty"` +// SetOffset : Allow user to set Offset +func (_options *GetNamespacesOptions) SetOffset(offset int64) *GetNamespacesOptions { + _options.Offset = core.Int64Ptr(offset) + return _options +} - // Channel to pin the operator subscription to. - Channel *string `json:"channel,omitempty"` +// SetHeaders : Allow user to set Headers +func (options *GetNamespacesOptions) SetHeaders(param map[string]string) *GetNamespacesOptions { + options.Headers = param + return options +} - // Map of metadata values for this offering instance. - Metadata map[string]interface{} `json:"metadata,omitempty"` +// GetObjectAccessListDeprecatedOptions : The GetObjectAccessListDeprecated options. +type GetObjectAccessListDeprecatedOptions struct { + // Catalog identifier. + CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` - // the last operation performed and status. - LastOperation *OfferingInstanceLastOperation `json:"last_operation,omitempty"` + // Object identifier. + ObjectIdentifier *string `json:"object_identifier" validate:"required,ne="` + + // The maximum number of results to return. + Limit *int64 `json:"limit,omitempty"` + + // The number of results to skip before returning values. + Offset *int64 `json:"offset,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string } -// UnmarshalOfferingInstance unmarshals an instance of OfferingInstance from the specified map of raw messages. -func UnmarshalOfferingInstance(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(OfferingInstance) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "_rev", &obj.Rev) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "url", &obj.URL) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "label", &obj.Label) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "catalog_id", &obj.CatalogID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "offering_id", &obj.OfferingID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "kind_format", &obj.KindFormat) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "version", &obj.Version) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "cluster_id", &obj.ClusterID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "cluster_region", &obj.ClusterRegion) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "cluster_namespaces", &obj.ClusterNamespaces) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "cluster_all_namespaces", &obj.ClusterAllNamespaces) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "schematics_workspace_id", &obj.SchematicsWorkspaceID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_group_id", &obj.ResourceGroupID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "install_plan", &obj.InstallPlan) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "channel", &obj.Channel) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "metadata", &obj.Metadata) - if err != nil { - return - } - err = core.UnmarshalModel(m, "last_operation", &obj.LastOperation, UnmarshalOfferingInstanceLastOperation) - if err != nil { - return +// NewGetObjectAccessListDeprecatedOptions : Instantiate GetObjectAccessListDeprecatedOptions +func (*CatalogManagementV1) NewGetObjectAccessListDeprecatedOptions(catalogIdentifier string, objectIdentifier string) *GetObjectAccessListDeprecatedOptions { + return &GetObjectAccessListDeprecatedOptions{ + CatalogIdentifier: core.StringPtr(catalogIdentifier), + ObjectIdentifier: core.StringPtr(objectIdentifier), } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return } -// OfferingInstanceLastOperation : the last operation performed and status. -type OfferingInstanceLastOperation struct { - // last operation performed. - Operation *string `json:"operation,omitempty"` +// SetCatalogIdentifier : Allow user to set CatalogIdentifier +func (_options *GetObjectAccessListDeprecatedOptions) SetCatalogIdentifier(catalogIdentifier string) *GetObjectAccessListDeprecatedOptions { + _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) + return _options +} - // state after the last operation performed. - State *string `json:"state,omitempty"` +// SetObjectIdentifier : Allow user to set ObjectIdentifier +func (_options *GetObjectAccessListDeprecatedOptions) SetObjectIdentifier(objectIdentifier string) *GetObjectAccessListDeprecatedOptions { + _options.ObjectIdentifier = core.StringPtr(objectIdentifier) + return _options +} - // additional information about the last operation. - Message *string `json:"message,omitempty"` +// SetLimit : Allow user to set Limit +func (_options *GetObjectAccessListDeprecatedOptions) SetLimit(limit int64) *GetObjectAccessListDeprecatedOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} - // transaction id from the last operation. - TransactionID *string `json:"transaction_id,omitempty"` +// SetOffset : Allow user to set Offset +func (_options *GetObjectAccessListDeprecatedOptions) SetOffset(offset int64) *GetObjectAccessListDeprecatedOptions { + _options.Offset = core.Int64Ptr(offset) + return _options +} - // Date and time last updated. - Updated *string `json:"updated,omitempty"` +// SetHeaders : Allow user to set Headers +func (options *GetObjectAccessListDeprecatedOptions) SetHeaders(param map[string]string) *GetObjectAccessListDeprecatedOptions { + options.Headers = param + return options } -// UnmarshalOfferingInstanceLastOperation unmarshals an instance of OfferingInstanceLastOperation from the specified map of raw messages. -func UnmarshalOfferingInstanceLastOperation(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(OfferingInstanceLastOperation) - err = core.UnmarshalPrimitive(m, "operation", &obj.Operation) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "state", &obj.State) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "message", &obj.Message) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "transaction_id", &obj.TransactionID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "updated", &obj.Updated) - if err != nil { - return +// GetObjectAccessListOptions : The GetObjectAccessList options. +type GetObjectAccessListOptions struct { + // Catalog identifier. + CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` + + // Object identifier. + ObjectIdentifier *string `json:"object_identifier" validate:"required,ne="` + + // Start token for a query. + Start *string `json:"start,omitempty"` + + // number or results to return in the query. + Limit *int64 `json:"limit,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetObjectAccessListOptions : Instantiate GetObjectAccessListOptions +func (*CatalogManagementV1) NewGetObjectAccessListOptions(catalogIdentifier string, objectIdentifier string) *GetObjectAccessListOptions { + return &GetObjectAccessListOptions{ + CatalogIdentifier: core.StringPtr(catalogIdentifier), + ObjectIdentifier: core.StringPtr(objectIdentifier), } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return } -// OfferingSearchResult : Paginated offering search result. -type OfferingSearchResult struct { - // The offset (origin 0) of the first resource in this page of search results. - Offset *int64 `json:"offset" validate:"required"` +// SetCatalogIdentifier : Allow user to set CatalogIdentifier +func (_options *GetObjectAccessListOptions) SetCatalogIdentifier(catalogIdentifier string) *GetObjectAccessListOptions { + _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) + return _options +} - // The maximum number of resources returned in each page of search results. - Limit *int64 `json:"limit" validate:"required"` +// SetObjectIdentifier : Allow user to set ObjectIdentifier +func (_options *GetObjectAccessListOptions) SetObjectIdentifier(objectIdentifier string) *GetObjectAccessListOptions { + _options.ObjectIdentifier = core.StringPtr(objectIdentifier) + return _options +} - // The overall total number of resources in the search result set. - TotalCount *int64 `json:"total_count,omitempty"` +// SetStart : Allow user to set Start +func (_options *GetObjectAccessListOptions) SetStart(start string) *GetObjectAccessListOptions { + _options.Start = core.StringPtr(start) + return _options +} - // The number of resources returned in this page of search results. - ResourceCount *int64 `json:"resource_count,omitempty"` +// SetLimit : Allow user to set Limit +func (_options *GetObjectAccessListOptions) SetLimit(limit int64) *GetObjectAccessListOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} - // A URL for retrieving the first page of search results. - First *string `json:"first,omitempty"` +// SetHeaders : Allow user to set Headers +func (options *GetObjectAccessListOptions) SetHeaders(param map[string]string) *GetObjectAccessListOptions { + options.Headers = param + return options +} - // A URL for retrieving the last page of search results. - Last *string `json:"last,omitempty"` +// GetObjectAccessOptions : The GetObjectAccess options. +type GetObjectAccessOptions struct { + // Catalog identifier. + CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` - // A URL for retrieving the previous page of search results. - Prev *string `json:"prev,omitempty"` + // Object identifier. + ObjectIdentifier *string `json:"object_identifier" validate:"required,ne="` - // A URL for retrieving the next page of search results. - Next *string `json:"next,omitempty"` + // Identifier for access. Use 'accountId' for an account, '-ent-enterpriseid' for an enterprise, and + // '-entgroup-enterprisegroupid' for an enterprise group. + AccessIdentifier *string `json:"access_identifier" validate:"required,ne="` - // Resulting objects. - Resources []Offering `json:"resources,omitempty"` + // Allows users to set headers on API requests + Headers map[string]string } -// UnmarshalOfferingSearchResult unmarshals an instance of OfferingSearchResult from the specified map of raw messages. -func UnmarshalOfferingSearchResult(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(OfferingSearchResult) - err = core.UnmarshalPrimitive(m, "offset", &obj.Offset) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_count", &obj.ResourceCount) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "first", &obj.First) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "last", &obj.Last) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "prev", &obj.Prev) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "next", &obj.Next) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resources", &obj.Resources, UnmarshalOffering) - if err != nil { - return +// NewGetObjectAccessOptions : Instantiate GetObjectAccessOptions +func (*CatalogManagementV1) NewGetObjectAccessOptions(catalogIdentifier string, objectIdentifier string, accessIdentifier string) *GetObjectAccessOptions { + return &GetObjectAccessOptions{ + CatalogIdentifier: core.StringPtr(catalogIdentifier), + ObjectIdentifier: core.StringPtr(objectIdentifier), + AccessIdentifier: core.StringPtr(accessIdentifier), } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return } -// OperatorDeployResult : Operator deploy result. -type OperatorDeployResult struct { - // Status phase. - Phase *string `json:"phase,omitempty"` +// SetCatalogIdentifier : Allow user to set CatalogIdentifier +func (_options *GetObjectAccessOptions) SetCatalogIdentifier(catalogIdentifier string) *GetObjectAccessOptions { + _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) + return _options +} - // Status message. - Message *string `json:"message,omitempty"` +// SetObjectIdentifier : Allow user to set ObjectIdentifier +func (_options *GetObjectAccessOptions) SetObjectIdentifier(objectIdentifier string) *GetObjectAccessOptions { + _options.ObjectIdentifier = core.StringPtr(objectIdentifier) + return _options +} - // Operator API path. - Link *string `json:"link,omitempty"` +// SetAccessIdentifier : Allow user to set AccessIdentifier +func (_options *GetObjectAccessOptions) SetAccessIdentifier(accessIdentifier string) *GetObjectAccessOptions { + _options.AccessIdentifier = core.StringPtr(accessIdentifier) + return _options +} - // Name of Operator. - Name *string `json:"name,omitempty"` +// SetHeaders : Allow user to set Headers +func (options *GetObjectAccessOptions) SetHeaders(param map[string]string) *GetObjectAccessOptions { + options.Headers = param + return options +} - // Operator version. - Version *string `json:"version,omitempty"` +// GetObjectAuditOptions : The GetObjectAudit options. +type GetObjectAuditOptions struct { + // Catalog identifier. + CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` - // Kube namespace. - Namespace *string `json:"namespace,omitempty"` + // Object identifier. + ObjectIdentifier *string `json:"object_identifier" validate:"required,ne="` - // Package Operator exists in. - PackageName *string `json:"package_name,omitempty"` + // Auditlog ID. + AuditlogIdentifier *string `json:"auditlog_identifier" validate:"required,ne="` - // Catalog identification. - CatalogID *string `json:"catalog_id,omitempty"` + // Auditlog Lookup Names - by default names are not returned in auditlog. + Lookupnames *bool `json:"lookupnames,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string } -// UnmarshalOperatorDeployResult unmarshals an instance of OperatorDeployResult from the specified map of raw messages. -func UnmarshalOperatorDeployResult(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(OperatorDeployResult) - err = core.UnmarshalPrimitive(m, "phase", &obj.Phase) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "message", &obj.Message) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "link", &obj.Link) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "version", &obj.Version) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "namespace", &obj.Namespace) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "package_name", &obj.PackageName) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "catalog_id", &obj.CatalogID) - if err != nil { - return +// NewGetObjectAuditOptions : Instantiate GetObjectAuditOptions +func (*CatalogManagementV1) NewGetObjectAuditOptions(catalogIdentifier string, objectIdentifier string, auditlogIdentifier string) *GetObjectAuditOptions { + return &GetObjectAuditOptions{ + CatalogIdentifier: core.StringPtr(catalogIdentifier), + ObjectIdentifier: core.StringPtr(objectIdentifier), + AuditlogIdentifier: core.StringPtr(auditlogIdentifier), } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return } -// Plan : Offering plan. -type Plan struct { - // unique id. - ID *string `json:"id,omitempty"` +// SetCatalogIdentifier : Allow user to set CatalogIdentifier +func (_options *GetObjectAuditOptions) SetCatalogIdentifier(catalogIdentifier string) *GetObjectAuditOptions { + _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) + return _options +} - // Display Name in the requested language. - Label *string `json:"label,omitempty"` +// SetObjectIdentifier : Allow user to set ObjectIdentifier +func (_options *GetObjectAuditOptions) SetObjectIdentifier(objectIdentifier string) *GetObjectAuditOptions { + _options.ObjectIdentifier = core.StringPtr(objectIdentifier) + return _options +} - // The programmatic name of this offering. - Name *string `json:"name,omitempty"` +// SetAuditlogIdentifier : Allow user to set AuditlogIdentifier +func (_options *GetObjectAuditOptions) SetAuditlogIdentifier(auditlogIdentifier string) *GetObjectAuditOptions { + _options.AuditlogIdentifier = core.StringPtr(auditlogIdentifier) + return _options +} - // Short description in the requested language. - ShortDescription *string `json:"short_description,omitempty"` +// SetLookupnames : Allow user to set Lookupnames +func (_options *GetObjectAuditOptions) SetLookupnames(lookupnames bool) *GetObjectAuditOptions { + _options.Lookupnames = core.BoolPtr(lookupnames) + return _options +} - // Long description in the requested language. - LongDescription *string `json:"long_description,omitempty"` +// SetHeaders : Allow user to set Headers +func (options *GetObjectAuditOptions) SetHeaders(param map[string]string) *GetObjectAuditOptions { + options.Headers = param + return options +} - // open ended metadata information. - Metadata map[string]interface{} `json:"metadata,omitempty"` +// GetObjectOptions : The GetObject options. +type GetObjectOptions struct { + // Catalog identifier. + CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` - // list of tags associated with this catalog. - Tags []string `json:"tags,omitempty"` + // Object identifier. + ObjectIdentifier *string `json:"object_identifier" validate:"required,ne="` - // list of features associated with this offering. - AdditionalFeatures []Feature `json:"additional_features,omitempty"` + // Allows users to set headers on API requests + Headers map[string]string +} - // the date'time this catalog was created. - Created *strfmt.DateTime `json:"created,omitempty"` +// NewGetObjectOptions : Instantiate GetObjectOptions +func (*CatalogManagementV1) NewGetObjectOptions(catalogIdentifier string, objectIdentifier string) *GetObjectOptions { + return &GetObjectOptions{ + CatalogIdentifier: core.StringPtr(catalogIdentifier), + ObjectIdentifier: core.StringPtr(objectIdentifier), + } +} - // the date'time this catalog was last updated. - Updated *strfmt.DateTime `json:"updated,omitempty"` +// SetCatalogIdentifier : Allow user to set CatalogIdentifier +func (_options *GetObjectOptions) SetCatalogIdentifier(catalogIdentifier string) *GetObjectOptions { + _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) + return _options +} - // list of deployments. - Deployments []Deployment `json:"deployments,omitempty"` +// SetObjectIdentifier : Allow user to set ObjectIdentifier +func (_options *GetObjectOptions) SetObjectIdentifier(objectIdentifier string) *GetObjectOptions { + _options.ObjectIdentifier = core.StringPtr(objectIdentifier) + return _options } -// UnmarshalPlan unmarshals an instance of Plan from the specified map of raw messages. -func UnmarshalPlan(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(Plan) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "label", &obj.Label) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "short_description", &obj.ShortDescription) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "long_description", &obj.LongDescription) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "metadata", &obj.Metadata) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) - if err != nil { - return - } - err = core.UnmarshalModel(m, "additional_features", &obj.AdditionalFeatures, UnmarshalFeature) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created", &obj.Created) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "updated", &obj.Updated) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deployments", &obj.Deployments, UnmarshalDeployment) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return +// SetHeaders : Allow user to set Headers +func (options *GetObjectOptions) SetHeaders(param map[string]string) *GetObjectOptions { + options.Headers = param + return options } -// PreinstallVersionOptions : The PreinstallVersion options. -type PreinstallVersionOptions struct { +// GetOfferingAboutOptions : The GetOfferingAbout options. +type GetOfferingAboutOptions struct { // A dotted value of `catalogID`.`versionID`. VersionLocID *string `json:"version_loc_id" validate:"required,ne="` - // IAM Refresh token. - XAuthRefreshToken *string `json:"X-Auth-Refresh-Token" validate:"required"` + // Allows users to set headers on API requests + Headers map[string]string +} - // Cluster ID. - ClusterID *string `json:"cluster_id,omitempty"` - - // Cluster region. - Region *string `json:"region,omitempty"` - - // Kube namespace. - Namespace *string `json:"namespace,omitempty"` - - // Object containing Helm chart override values. To use a secret for items of type password, specify a JSON encoded - // value of $ref:#/components/schemas/SecretInstance, prefixed with `cmsm_v1:`. - OverrideValues map[string]interface{} `json:"override_values,omitempty"` - - // Entitlement API Key for this offering. - EntitlementApikey *string `json:"entitlement_apikey,omitempty"` - - // Schematics workspace configuration. - Schematics *DeployRequestBodySchematics `json:"schematics,omitempty"` - - // Script. - Script *string `json:"script,omitempty"` - - // Script ID. - ScriptID *string `json:"script_id,omitempty"` - - // A dotted value of `catalogID`.`versionID`. - VersionLocatorID *string `json:"version_locator_id,omitempty"` - - // VCenter ID. - VcenterID *string `json:"vcenter_id,omitempty"` - - // VCenter User. - VcenterUser *string `json:"vcenter_user,omitempty"` - - // VCenter Password. - VcenterPassword *string `json:"vcenter_password,omitempty"` - - // VCenter Location. - VcenterLocation *string `json:"vcenter_location,omitempty"` - - // VCenter Datastore. - VcenterDatastore *string `json:"vcenter_datastore,omitempty"` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewPreinstallVersionOptions : Instantiate PreinstallVersionOptions -func (*CatalogManagementV1) NewPreinstallVersionOptions(versionLocID string, xAuthRefreshToken string) *PreinstallVersionOptions { - return &PreinstallVersionOptions{ +// NewGetOfferingAboutOptions : Instantiate GetOfferingAboutOptions +func (*CatalogManagementV1) NewGetOfferingAboutOptions(versionLocID string) *GetOfferingAboutOptions { + return &GetOfferingAboutOptions{ VersionLocID: core.StringPtr(versionLocID), - XAuthRefreshToken: core.StringPtr(xAuthRefreshToken), } } // SetVersionLocID : Allow user to set VersionLocID -func (_options *PreinstallVersionOptions) SetVersionLocID(versionLocID string) *PreinstallVersionOptions { +func (_options *GetOfferingAboutOptions) SetVersionLocID(versionLocID string) *GetOfferingAboutOptions { _options.VersionLocID = core.StringPtr(versionLocID) return _options } -// SetXAuthRefreshToken : Allow user to set XAuthRefreshToken -func (_options *PreinstallVersionOptions) SetXAuthRefreshToken(xAuthRefreshToken string) *PreinstallVersionOptions { - _options.XAuthRefreshToken = core.StringPtr(xAuthRefreshToken) - return _options +// SetHeaders : Allow user to set Headers +func (options *GetOfferingAboutOptions) SetHeaders(param map[string]string) *GetOfferingAboutOptions { + options.Headers = param + return options } -// SetClusterID : Allow user to set ClusterID -func (_options *PreinstallVersionOptions) SetClusterID(clusterID string) *PreinstallVersionOptions { - _options.ClusterID = core.StringPtr(clusterID) - return _options -} +// GetOfferingAccessListOptions : The GetOfferingAccessList options. +type GetOfferingAccessListOptions struct { + // Catalog identifier. + CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` -// SetRegion : Allow user to set Region -func (_options *PreinstallVersionOptions) SetRegion(region string) *PreinstallVersionOptions { - _options.Region = core.StringPtr(region) - return _options -} + // Offering identification. + OfferingID *string `json:"offering_id" validate:"required,ne="` -// SetNamespace : Allow user to set Namespace -func (_options *PreinstallVersionOptions) SetNamespace(namespace string) *PreinstallVersionOptions { - _options.Namespace = core.StringPtr(namespace) - return _options + // Start token for a query. + Start *string `json:"start,omitempty"` + + // number or results to return in the query. + Limit *int64 `json:"limit,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string } -// SetOverrideValues : Allow user to set OverrideValues -func (_options *PreinstallVersionOptions) SetOverrideValues(overrideValues map[string]interface{}) *PreinstallVersionOptions { - _options.OverrideValues = overrideValues - return _options +// NewGetOfferingAccessListOptions : Instantiate GetOfferingAccessListOptions +func (*CatalogManagementV1) NewGetOfferingAccessListOptions(catalogIdentifier string, offeringID string) *GetOfferingAccessListOptions { + return &GetOfferingAccessListOptions{ + CatalogIdentifier: core.StringPtr(catalogIdentifier), + OfferingID: core.StringPtr(offeringID), + } } -// SetEntitlementApikey : Allow user to set EntitlementApikey -func (_options *PreinstallVersionOptions) SetEntitlementApikey(entitlementApikey string) *PreinstallVersionOptions { - _options.EntitlementApikey = core.StringPtr(entitlementApikey) +// SetCatalogIdentifier : Allow user to set CatalogIdentifier +func (_options *GetOfferingAccessListOptions) SetCatalogIdentifier(catalogIdentifier string) *GetOfferingAccessListOptions { + _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) return _options } -// SetSchematics : Allow user to set Schematics -func (_options *PreinstallVersionOptions) SetSchematics(schematics *DeployRequestBodySchematics) *PreinstallVersionOptions { - _options.Schematics = schematics +// SetOfferingID : Allow user to set OfferingID +func (_options *GetOfferingAccessListOptions) SetOfferingID(offeringID string) *GetOfferingAccessListOptions { + _options.OfferingID = core.StringPtr(offeringID) return _options } -// SetScript : Allow user to set Script -func (_options *PreinstallVersionOptions) SetScript(script string) *PreinstallVersionOptions { - _options.Script = core.StringPtr(script) +// SetStart : Allow user to set Start +func (_options *GetOfferingAccessListOptions) SetStart(start string) *GetOfferingAccessListOptions { + _options.Start = core.StringPtr(start) return _options } -// SetScriptID : Allow user to set ScriptID -func (_options *PreinstallVersionOptions) SetScriptID(scriptID string) *PreinstallVersionOptions { - _options.ScriptID = core.StringPtr(scriptID) +// SetLimit : Allow user to set Limit +func (_options *GetOfferingAccessListOptions) SetLimit(limit int64) *GetOfferingAccessListOptions { + _options.Limit = core.Int64Ptr(limit) return _options } -// SetVersionLocatorID : Allow user to set VersionLocatorID -func (_options *PreinstallVersionOptions) SetVersionLocatorID(versionLocatorID string) *PreinstallVersionOptions { - _options.VersionLocatorID = core.StringPtr(versionLocatorID) - return _options +// SetHeaders : Allow user to set Headers +func (options *GetOfferingAccessListOptions) SetHeaders(param map[string]string) *GetOfferingAccessListOptions { + options.Headers = param + return options } -// SetVcenterID : Allow user to set VcenterID -func (_options *PreinstallVersionOptions) SetVcenterID(vcenterID string) *PreinstallVersionOptions { - _options.VcenterID = core.StringPtr(vcenterID) - return _options +// GetOfferingAccessOptions : The GetOfferingAccess options. +type GetOfferingAccessOptions struct { + // Catalog identifier. + CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` + + // Offering identification. + OfferingID *string `json:"offering_id" validate:"required,ne="` + + // Identifier for access. Use 'accountId' for an account, '-ent-enterpriseid' for an enterprise, and + // '-entgroup-enterprisegroupid' for an enterprise group. + AccessIdentifier *string `json:"access_identifier" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string } -// SetVcenterUser : Allow user to set VcenterUser -func (_options *PreinstallVersionOptions) SetVcenterUser(vcenterUser string) *PreinstallVersionOptions { - _options.VcenterUser = core.StringPtr(vcenterUser) - return _options +// NewGetOfferingAccessOptions : Instantiate GetOfferingAccessOptions +func (*CatalogManagementV1) NewGetOfferingAccessOptions(catalogIdentifier string, offeringID string, accessIdentifier string) *GetOfferingAccessOptions { + return &GetOfferingAccessOptions{ + CatalogIdentifier: core.StringPtr(catalogIdentifier), + OfferingID: core.StringPtr(offeringID), + AccessIdentifier: core.StringPtr(accessIdentifier), + } } -// SetVcenterPassword : Allow user to set VcenterPassword -func (_options *PreinstallVersionOptions) SetVcenterPassword(vcenterPassword string) *PreinstallVersionOptions { - _options.VcenterPassword = core.StringPtr(vcenterPassword) +// SetCatalogIdentifier : Allow user to set CatalogIdentifier +func (_options *GetOfferingAccessOptions) SetCatalogIdentifier(catalogIdentifier string) *GetOfferingAccessOptions { + _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) return _options } -// SetVcenterLocation : Allow user to set VcenterLocation -func (_options *PreinstallVersionOptions) SetVcenterLocation(vcenterLocation string) *PreinstallVersionOptions { - _options.VcenterLocation = core.StringPtr(vcenterLocation) +// SetOfferingID : Allow user to set OfferingID +func (_options *GetOfferingAccessOptions) SetOfferingID(offeringID string) *GetOfferingAccessOptions { + _options.OfferingID = core.StringPtr(offeringID) return _options } -// SetVcenterDatastore : Allow user to set VcenterDatastore -func (_options *PreinstallVersionOptions) SetVcenterDatastore(vcenterDatastore string) *PreinstallVersionOptions { - _options.VcenterDatastore = core.StringPtr(vcenterDatastore) +// SetAccessIdentifier : Allow user to set AccessIdentifier +func (_options *GetOfferingAccessOptions) SetAccessIdentifier(accessIdentifier string) *GetOfferingAccessOptions { + _options.AccessIdentifier = core.StringPtr(accessIdentifier) return _options } // SetHeaders : Allow user to set Headers -func (options *PreinstallVersionOptions) SetHeaders(param map[string]string) *PreinstallVersionOptions { +func (options *GetOfferingAccessOptions) SetHeaders(param map[string]string) *GetOfferingAccessOptions { options.Headers = param return options } -// ProviderInfo : Information on the provider for this offering, or omitted if no provider information is given. -type ProviderInfo struct { - // The id of this provider. - ID *string `json:"id,omitempty"` - - // The name of this provider. - Name *string `json:"name,omitempty"` -} - -// UnmarshalProviderInfo unmarshals an instance of ProviderInfo from the specified map of raw messages. -func UnmarshalProviderInfo(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ProviderInfo) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// PublicPublishObjectOptions : The PublicPublishObject options. -type PublicPublishObjectOptions struct { +// GetOfferingAuditOptions : The GetOfferingAudit options. +type GetOfferingAuditOptions struct { // Catalog identifier. CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` - // Object identifier. - ObjectIdentifier *string `json:"object_identifier" validate:"required,ne="` + // Offering identification. + OfferingID *string `json:"offering_id" validate:"required,ne="` + + // Auditlog ID. + AuditlogIdentifier *string `json:"auditlog_identifier" validate:"required,ne="` + + // Auditlog Lookup Names - by default names are not returned in auditlog. + Lookupnames *bool `json:"lookupnames,omitempty"` // Allows users to set headers on API requests Headers map[string]string } -// NewPublicPublishObjectOptions : Instantiate PublicPublishObjectOptions -func (*CatalogManagementV1) NewPublicPublishObjectOptions(catalogIdentifier string, objectIdentifier string) *PublicPublishObjectOptions { - return &PublicPublishObjectOptions{ +// NewGetOfferingAuditOptions : Instantiate GetOfferingAuditOptions +func (*CatalogManagementV1) NewGetOfferingAuditOptions(catalogIdentifier string, offeringID string, auditlogIdentifier string) *GetOfferingAuditOptions { + return &GetOfferingAuditOptions{ CatalogIdentifier: core.StringPtr(catalogIdentifier), - ObjectIdentifier: core.StringPtr(objectIdentifier), + OfferingID: core.StringPtr(offeringID), + AuditlogIdentifier: core.StringPtr(auditlogIdentifier), } } // SetCatalogIdentifier : Allow user to set CatalogIdentifier -func (_options *PublicPublishObjectOptions) SetCatalogIdentifier(catalogIdentifier string) *PublicPublishObjectOptions { +func (_options *GetOfferingAuditOptions) SetCatalogIdentifier(catalogIdentifier string) *GetOfferingAuditOptions { _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) return _options } -// SetObjectIdentifier : Allow user to set ObjectIdentifier -func (_options *PublicPublishObjectOptions) SetObjectIdentifier(objectIdentifier string) *PublicPublishObjectOptions { - _options.ObjectIdentifier = core.StringPtr(objectIdentifier) +// SetOfferingID : Allow user to set OfferingID +func (_options *GetOfferingAuditOptions) SetOfferingID(offeringID string) *GetOfferingAuditOptions { + _options.OfferingID = core.StringPtr(offeringID) + return _options +} + +// SetAuditlogIdentifier : Allow user to set AuditlogIdentifier +func (_options *GetOfferingAuditOptions) SetAuditlogIdentifier(auditlogIdentifier string) *GetOfferingAuditOptions { + _options.AuditlogIdentifier = core.StringPtr(auditlogIdentifier) + return _options +} + +// SetLookupnames : Allow user to set Lookupnames +func (_options *GetOfferingAuditOptions) SetLookupnames(lookupnames bool) *GetOfferingAuditOptions { + _options.Lookupnames = core.BoolPtr(lookupnames) return _options } // SetHeaders : Allow user to set Headers -func (options *PublicPublishObjectOptions) SetHeaders(param map[string]string) *PublicPublishObjectOptions { +func (options *GetOfferingAuditOptions) SetHeaders(param map[string]string) *GetOfferingAuditOptions { options.Headers = param return options } -// PublicPublishVersionOptions : The PublicPublishVersion options. -type PublicPublishVersionOptions struct { +// GetOfferingContainerImagesOptions : The GetOfferingContainerImages options. +type GetOfferingContainerImagesOptions struct { // A dotted value of `catalogID`.`versionID`. VersionLocID *string `json:"version_loc_id" validate:"required,ne="` @@ -11476,1257 +11829,1498 @@ type PublicPublishVersionOptions struct { Headers map[string]string } -// NewPublicPublishVersionOptions : Instantiate PublicPublishVersionOptions -func (*CatalogManagementV1) NewPublicPublishVersionOptions(versionLocID string) *PublicPublishVersionOptions { - return &PublicPublishVersionOptions{ +// NewGetOfferingContainerImagesOptions : Instantiate GetOfferingContainerImagesOptions +func (*CatalogManagementV1) NewGetOfferingContainerImagesOptions(versionLocID string) *GetOfferingContainerImagesOptions { + return &GetOfferingContainerImagesOptions{ VersionLocID: core.StringPtr(versionLocID), } } // SetVersionLocID : Allow user to set VersionLocID -func (_options *PublicPublishVersionOptions) SetVersionLocID(versionLocID string) *PublicPublishVersionOptions { +func (_options *GetOfferingContainerImagesOptions) SetVersionLocID(versionLocID string) *GetOfferingContainerImagesOptions { _options.VersionLocID = core.StringPtr(versionLocID) return _options } // SetHeaders : Allow user to set Headers -func (options *PublicPublishVersionOptions) SetHeaders(param map[string]string) *PublicPublishVersionOptions { +func (options *GetOfferingContainerImagesOptions) SetHeaders(param map[string]string) *GetOfferingContainerImagesOptions { options.Headers = param return options } -// PublishObject : Publish information. -type PublishObject struct { - // Is it permitted to request publishing to IBM or Public. - PermitIBMPublicPublish *bool `json:"permit_ibm_public_publish,omitempty"` - - // Indicates if this offering has been approved for use by all IBMers. - IBMApproved *bool `json:"ibm_approved,omitempty"` +// GetOfferingInstanceAuditOptions : The GetOfferingInstanceAudit options. +type GetOfferingInstanceAuditOptions struct { + // Version Instance identifier. + InstanceIdentifier *string `json:"instance_identifier" validate:"required,ne="` - // Indicates if this offering has been approved for use by all IBM Cloud users. - PublicApproved *bool `json:"public_approved,omitempty"` + // Auditlog ID. + AuditlogIdentifier *string `json:"auditlog_identifier" validate:"required,ne="` - // The portal's approval record ID. - PortalApprovalRecord *string `json:"portal_approval_record,omitempty"` + // Auditlog Lookup Names - by default names are not returned in auditlog. + Lookupnames *bool `json:"lookupnames,omitempty"` - // The portal UI URL. - PortalURL *string `json:"portal_url,omitempty"` + // Allows users to set headers on API requests + Headers map[string]string } -// UnmarshalPublishObject unmarshals an instance of PublishObject from the specified map of raw messages. -func UnmarshalPublishObject(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PublishObject) - err = core.UnmarshalPrimitive(m, "permit_ibm_public_publish", &obj.PermitIBMPublicPublish) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "ibm_approved", &obj.IBMApproved) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "public_approved", &obj.PublicApproved) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "portal_approval_record", &obj.PortalApprovalRecord) - if err != nil { - return +// NewGetOfferingInstanceAuditOptions : Instantiate GetOfferingInstanceAuditOptions +func (*CatalogManagementV1) NewGetOfferingInstanceAuditOptions(instanceIdentifier string, auditlogIdentifier string) *GetOfferingInstanceAuditOptions { + return &GetOfferingInstanceAuditOptions{ + InstanceIdentifier: core.StringPtr(instanceIdentifier), + AuditlogIdentifier: core.StringPtr(auditlogIdentifier), } - err = core.UnmarshalPrimitive(m, "portal_url", &obj.PortalURL) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return } -// PutOfferingInstanceOptions : The PutOfferingInstance options. -type PutOfferingInstanceOptions struct { - // Version Instance identifier. - InstanceIdentifier *string `json:"instance_identifier" validate:"required,ne="` - - // IAM Refresh token. - XAuthRefreshToken *string `json:"X-Auth-Refresh-Token" validate:"required"` +// SetInstanceIdentifier : Allow user to set InstanceIdentifier +func (_options *GetOfferingInstanceAuditOptions) SetInstanceIdentifier(instanceIdentifier string) *GetOfferingInstanceAuditOptions { + _options.InstanceIdentifier = core.StringPtr(instanceIdentifier) + return _options +} - // provisioned instance ID (part of the CRN). - ID *string `json:"id,omitempty"` +// SetAuditlogIdentifier : Allow user to set AuditlogIdentifier +func (_options *GetOfferingInstanceAuditOptions) SetAuditlogIdentifier(auditlogIdentifier string) *GetOfferingInstanceAuditOptions { + _options.AuditlogIdentifier = core.StringPtr(auditlogIdentifier) + return _options +} - // Cloudant revision. - Rev *string `json:"_rev,omitempty"` +// SetLookupnames : Allow user to set Lookupnames +func (_options *GetOfferingInstanceAuditOptions) SetLookupnames(lookupnames bool) *GetOfferingInstanceAuditOptions { + _options.Lookupnames = core.BoolPtr(lookupnames) + return _options +} - // url reference to this object. - URL *string `json:"url,omitempty"` +// SetHeaders : Allow user to set Headers +func (options *GetOfferingInstanceAuditOptions) SetHeaders(param map[string]string) *GetOfferingInstanceAuditOptions { + options.Headers = param + return options +} - // platform CRN for this instance. - CRN *string `json:"crn,omitempty"` +// GetOfferingInstanceOptions : The GetOfferingInstance options. +type GetOfferingInstanceOptions struct { + // Version Instance identifier. + InstanceIdentifier *string `json:"instance_identifier" validate:"required,ne="` - // the label for this instance. - Label *string `json:"label,omitempty"` + // Allows users to set headers on API requests + Headers map[string]string +} - // Catalog ID this instance was created from. - CatalogID *string `json:"catalog_id,omitempty"` +// NewGetOfferingInstanceOptions : Instantiate GetOfferingInstanceOptions +func (*CatalogManagementV1) NewGetOfferingInstanceOptions(instanceIdentifier string) *GetOfferingInstanceOptions { + return &GetOfferingInstanceOptions{ + InstanceIdentifier: core.StringPtr(instanceIdentifier), + } +} - // Offering ID this instance was created from. - OfferingID *string `json:"offering_id,omitempty"` +// SetInstanceIdentifier : Allow user to set InstanceIdentifier +func (_options *GetOfferingInstanceOptions) SetInstanceIdentifier(instanceIdentifier string) *GetOfferingInstanceOptions { + _options.InstanceIdentifier = core.StringPtr(instanceIdentifier) + return _options +} - // the format this instance has (helm, operator, ova...). - KindFormat *string `json:"kind_format,omitempty"` +// SetHeaders : Allow user to set Headers +func (options *GetOfferingInstanceOptions) SetHeaders(param map[string]string) *GetOfferingInstanceOptions { + options.Headers = param + return options +} - // The version this instance was installed from (not version id). - Version *string `json:"version,omitempty"` +// GetOfferingLicenseOptions : The GetOfferingLicense options. +type GetOfferingLicenseOptions struct { + // A dotted value of `catalogID`.`versionID`. + VersionLocID *string `json:"version_loc_id" validate:"required,ne="` - // Cluster ID. - ClusterID *string `json:"cluster_id,omitempty"` + // The ID of the license, which maps to the file name in the 'licenses' directory of this verions tgz file. + LicenseID *string `json:"license_id" validate:"required,ne="` - // Cluster region (e.g., us-south). - ClusterRegion *string `json:"cluster_region,omitempty"` + // Allows users to set headers on API requests + Headers map[string]string +} - // List of target namespaces to install into. - ClusterNamespaces []string `json:"cluster_namespaces,omitempty"` +// NewGetOfferingLicenseOptions : Instantiate GetOfferingLicenseOptions +func (*CatalogManagementV1) NewGetOfferingLicenseOptions(versionLocID string, licenseID string) *GetOfferingLicenseOptions { + return &GetOfferingLicenseOptions{ + VersionLocID: core.StringPtr(versionLocID), + LicenseID: core.StringPtr(licenseID), + } +} - // designate to install into all namespaces. - ClusterAllNamespaces *bool `json:"cluster_all_namespaces,omitempty"` +// SetVersionLocID : Allow user to set VersionLocID +func (_options *GetOfferingLicenseOptions) SetVersionLocID(versionLocID string) *GetOfferingLicenseOptions { + _options.VersionLocID = core.StringPtr(versionLocID) + return _options +} - // Id of the schematics workspace, for offering instances provisioned through schematics. - SchematicsWorkspaceID *string `json:"schematics_workspace_id,omitempty"` +// SetLicenseID : Allow user to set LicenseID +func (_options *GetOfferingLicenseOptions) SetLicenseID(licenseID string) *GetOfferingLicenseOptions { + _options.LicenseID = core.StringPtr(licenseID) + return _options +} - // Id of the resource group to provision the offering instance into. - ResourceGroupID *string `json:"resource_group_id,omitempty"` +// SetHeaders : Allow user to set Headers +func (options *GetOfferingLicenseOptions) SetHeaders(param map[string]string) *GetOfferingLicenseOptions { + options.Headers = param + return options +} - // Type of install plan (also known as approval strategy) for operator subscriptions. Can be either automatic, which - // automatically upgrades operators to the latest in a channel, or manual, which requires approval on the cluster. - InstallPlan *string `json:"install_plan,omitempty"` +// GetOfferingOptions : The GetOffering options. +type GetOfferingOptions struct { + // Catalog identifier. + CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` - // Channel to pin the operator subscription to. - Channel *string `json:"channel,omitempty"` + // Offering identification. + OfferingID *string `json:"offering_id" validate:"required,ne="` - // Map of metadata values for this offering instance. - Metadata map[string]interface{} `json:"metadata,omitempty"` + // Offering Parameter Type. Valid values are 'name' or 'id'. Default is 'id'. + Type *string `json:"type,omitempty"` - // the last operation performed and status. - LastOperation *OfferingInstanceLastOperation `json:"last_operation,omitempty"` + // Return the digest format of the specified offering. Default is false. + Digest *bool `json:"digest,omitempty"` // Allows users to set headers on API requests Headers map[string]string } -// NewPutOfferingInstanceOptions : Instantiate PutOfferingInstanceOptions -func (*CatalogManagementV1) NewPutOfferingInstanceOptions(instanceIdentifier string, xAuthRefreshToken string) *PutOfferingInstanceOptions { - return &PutOfferingInstanceOptions{ - InstanceIdentifier: core.StringPtr(instanceIdentifier), - XAuthRefreshToken: core.StringPtr(xAuthRefreshToken), +// NewGetOfferingOptions : Instantiate GetOfferingOptions +func (*CatalogManagementV1) NewGetOfferingOptions(catalogIdentifier string, offeringID string) *GetOfferingOptions { + return &GetOfferingOptions{ + CatalogIdentifier: core.StringPtr(catalogIdentifier), + OfferingID: core.StringPtr(offeringID), } } -// SetInstanceIdentifier : Allow user to set InstanceIdentifier -func (_options *PutOfferingInstanceOptions) SetInstanceIdentifier(instanceIdentifier string) *PutOfferingInstanceOptions { - _options.InstanceIdentifier = core.StringPtr(instanceIdentifier) +// SetCatalogIdentifier : Allow user to set CatalogIdentifier +func (_options *GetOfferingOptions) SetCatalogIdentifier(catalogIdentifier string) *GetOfferingOptions { + _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) return _options } -// SetXAuthRefreshToken : Allow user to set XAuthRefreshToken -func (_options *PutOfferingInstanceOptions) SetXAuthRefreshToken(xAuthRefreshToken string) *PutOfferingInstanceOptions { - _options.XAuthRefreshToken = core.StringPtr(xAuthRefreshToken) +// SetOfferingID : Allow user to set OfferingID +func (_options *GetOfferingOptions) SetOfferingID(offeringID string) *GetOfferingOptions { + _options.OfferingID = core.StringPtr(offeringID) return _options } -// SetID : Allow user to set ID -func (_options *PutOfferingInstanceOptions) SetID(id string) *PutOfferingInstanceOptions { - _options.ID = core.StringPtr(id) +// SetType : Allow user to set Type +func (_options *GetOfferingOptions) SetType(typeVar string) *GetOfferingOptions { + _options.Type = core.StringPtr(typeVar) return _options } -// SetRev : Allow user to set Rev -func (_options *PutOfferingInstanceOptions) SetRev(rev string) *PutOfferingInstanceOptions { - _options.Rev = core.StringPtr(rev) +// SetDigest : Allow user to set Digest +func (_options *GetOfferingOptions) SetDigest(digest bool) *GetOfferingOptions { + _options.Digest = core.BoolPtr(digest) return _options } -// SetURL : Allow user to set URL -func (_options *PutOfferingInstanceOptions) SetURL(url string) *PutOfferingInstanceOptions { - _options.URL = core.StringPtr(url) - return _options +// SetHeaders : Allow user to set Headers +func (options *GetOfferingOptions) SetHeaders(param map[string]string) *GetOfferingOptions { + options.Headers = param + return options } -// SetCRN : Allow user to set CRN -func (_options *PutOfferingInstanceOptions) SetCRN(crn string) *PutOfferingInstanceOptions { - _options.CRN = core.StringPtr(crn) - return _options -} +// GetOfferingSourceOptions : The GetOfferingSource options. +type GetOfferingSourceOptions struct { + // The version being requested. + Version *string `json:"version" validate:"required"` -// SetLabel : Allow user to set Label -func (_options *PutOfferingInstanceOptions) SetLabel(label string) *PutOfferingInstanceOptions { - _options.Label = core.StringPtr(label) - return _options -} + // The type of the response: application/yaml, application/json, or application/x-gzip. + Accept *string `json:"Accept,omitempty"` -// SetCatalogID : Allow user to set CatalogID -func (_options *PutOfferingInstanceOptions) SetCatalogID(catalogID string) *PutOfferingInstanceOptions { - _options.CatalogID = core.StringPtr(catalogID) - return _options -} + // Catalog ID. If not specified, this value will default to the public catalog. + CatalogID *string `json:"catalogID,omitempty"` -// SetOfferingID : Allow user to set OfferingID -func (_options *PutOfferingInstanceOptions) SetOfferingID(offeringID string) *PutOfferingInstanceOptions { - _options.OfferingID = core.StringPtr(offeringID) - return _options + // Offering name. An offering name or ID must be specified. + Name *string `json:"name,omitempty"` + + // Offering id. An offering name or ID must be specified. + ID *string `json:"id,omitempty"` + + // The kind of offering (e.g. helm, ova, terraform...). + Kind *string `json:"kind,omitempty"` + + // The channel value of the specified version. + Channel *string `json:"channel,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string } -// SetKindFormat : Allow user to set KindFormat -func (_options *PutOfferingInstanceOptions) SetKindFormat(kindFormat string) *PutOfferingInstanceOptions { - _options.KindFormat = core.StringPtr(kindFormat) - return _options +// NewGetOfferingSourceOptions : Instantiate GetOfferingSourceOptions +func (*CatalogManagementV1) NewGetOfferingSourceOptions(version string) *GetOfferingSourceOptions { + return &GetOfferingSourceOptions{ + Version: core.StringPtr(version), + } } // SetVersion : Allow user to set Version -func (_options *PutOfferingInstanceOptions) SetVersion(version string) *PutOfferingInstanceOptions { +func (_options *GetOfferingSourceOptions) SetVersion(version string) *GetOfferingSourceOptions { _options.Version = core.StringPtr(version) return _options } -// SetClusterID : Allow user to set ClusterID -func (_options *PutOfferingInstanceOptions) SetClusterID(clusterID string) *PutOfferingInstanceOptions { - _options.ClusterID = core.StringPtr(clusterID) +// SetAccept : Allow user to set Accept +func (_options *GetOfferingSourceOptions) SetAccept(accept string) *GetOfferingSourceOptions { + _options.Accept = core.StringPtr(accept) return _options } -// SetClusterRegion : Allow user to set ClusterRegion -func (_options *PutOfferingInstanceOptions) SetClusterRegion(clusterRegion string) *PutOfferingInstanceOptions { - _options.ClusterRegion = core.StringPtr(clusterRegion) +// SetCatalogID : Allow user to set CatalogID +func (_options *GetOfferingSourceOptions) SetCatalogID(catalogID string) *GetOfferingSourceOptions { + _options.CatalogID = core.StringPtr(catalogID) return _options } -// SetClusterNamespaces : Allow user to set ClusterNamespaces -func (_options *PutOfferingInstanceOptions) SetClusterNamespaces(clusterNamespaces []string) *PutOfferingInstanceOptions { - _options.ClusterNamespaces = clusterNamespaces +// SetName : Allow user to set Name +func (_options *GetOfferingSourceOptions) SetName(name string) *GetOfferingSourceOptions { + _options.Name = core.StringPtr(name) return _options } -// SetClusterAllNamespaces : Allow user to set ClusterAllNamespaces -func (_options *PutOfferingInstanceOptions) SetClusterAllNamespaces(clusterAllNamespaces bool) *PutOfferingInstanceOptions { - _options.ClusterAllNamespaces = core.BoolPtr(clusterAllNamespaces) +// SetID : Allow user to set ID +func (_options *GetOfferingSourceOptions) SetID(id string) *GetOfferingSourceOptions { + _options.ID = core.StringPtr(id) return _options } -// SetSchematicsWorkspaceID : Allow user to set SchematicsWorkspaceID -func (_options *PutOfferingInstanceOptions) SetSchematicsWorkspaceID(schematicsWorkspaceID string) *PutOfferingInstanceOptions { - _options.SchematicsWorkspaceID = core.StringPtr(schematicsWorkspaceID) +// SetKind : Allow user to set Kind +func (_options *GetOfferingSourceOptions) SetKind(kind string) *GetOfferingSourceOptions { + _options.Kind = core.StringPtr(kind) return _options } -// SetResourceGroupID : Allow user to set ResourceGroupID -func (_options *PutOfferingInstanceOptions) SetResourceGroupID(resourceGroupID string) *PutOfferingInstanceOptions { - _options.ResourceGroupID = core.StringPtr(resourceGroupID) - return _options -} - -// SetInstallPlan : Allow user to set InstallPlan -func (_options *PutOfferingInstanceOptions) SetInstallPlan(installPlan string) *PutOfferingInstanceOptions { - _options.InstallPlan = core.StringPtr(installPlan) - return _options -} - -// SetChannel : Allow user to set Channel -func (_options *PutOfferingInstanceOptions) SetChannel(channel string) *PutOfferingInstanceOptions { - _options.Channel = core.StringPtr(channel) - return _options -} - -// SetMetadata : Allow user to set Metadata -func (_options *PutOfferingInstanceOptions) SetMetadata(metadata map[string]interface{}) *PutOfferingInstanceOptions { - _options.Metadata = metadata - return _options -} - -// SetLastOperation : Allow user to set LastOperation -func (_options *PutOfferingInstanceOptions) SetLastOperation(lastOperation *OfferingInstanceLastOperation) *PutOfferingInstanceOptions { - _options.LastOperation = lastOperation +// SetChannel : Allow user to set Channel +func (_options *GetOfferingSourceOptions) SetChannel(channel string) *GetOfferingSourceOptions { + _options.Channel = core.StringPtr(channel) return _options } // SetHeaders : Allow user to set Headers -func (options *PutOfferingInstanceOptions) SetHeaders(param map[string]string) *PutOfferingInstanceOptions { +func (options *GetOfferingSourceOptions) SetHeaders(param map[string]string) *GetOfferingSourceOptions { options.Headers = param return options } -// Rating : Repository info for offerings. -type Rating struct { - // One start rating. - OneStarCount *int64 `json:"one_star_count,omitempty"` - - // Two start rating. - TwoStarCount *int64 `json:"two_star_count,omitempty"` - - // Three start rating. - ThreeStarCount *int64 `json:"three_star_count,omitempty"` - - // Four start rating. - FourStarCount *int64 `json:"four_star_count,omitempty"` -} - -// UnmarshalRating unmarshals an instance of Rating from the specified map of raw messages. -func UnmarshalRating(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(Rating) - err = core.UnmarshalPrimitive(m, "one_star_count", &obj.OneStarCount) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "two_star_count", &obj.TwoStarCount) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "three_star_count", &obj.ThreeStarCount) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "four_star_count", &obj.FourStarCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ReloadOfferingOptions : The ReloadOffering options. -type ReloadOfferingOptions struct { - // Catalog identifier. - CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` - - // Offering identification. - OfferingID *string `json:"offering_id" validate:"required,ne="` - - // The semver value for this new version. - TargetVersion *string `json:"targetVersion" validate:"required"` - - // Tags array. - Tags []string `json:"tags,omitempty"` +// GetOfferingSourceURLOptions : The GetOfferingSourceURL options. +type GetOfferingSourceURLOptions struct { + // Unique key identifying an image. + KeyIdentifier *string `json:"key_identifier" validate:"required,ne="` - // Target kinds. Current valid values are 'iks', 'roks', 'vcenter', and 'terraform'. - TargetKinds []string `json:"target_kinds,omitempty"` + // The type of the response: application/yaml, application/json, or application/x-gzip. + Accept *string `json:"Accept,omitempty"` - // byte array representing the content to be imported. Only supported for OVA images at this time. - Content *[]byte `json:"content,omitempty"` + // Catalog ID. If not specified, this value will default to the public catalog. + CatalogID *string `json:"catalogID,omitempty"` - // URL path to zip location. If not specified, must provide content in this post body. - Zipurl *string `json:"zipurl,omitempty"` + // Offering name. An offering name or ID must be specified. + Name *string `json:"name,omitempty"` - // The type of repository containing this version. Valid values are 'public_git' or 'enterprise_git'. - RepoType *string `json:"repoType,omitempty"` + // Offering id. An offering name or ID must be specified. + ID *string `json:"id,omitempty"` // Allows users to set headers on API requests Headers map[string]string } -// NewReloadOfferingOptions : Instantiate ReloadOfferingOptions -func (*CatalogManagementV1) NewReloadOfferingOptions(catalogIdentifier string, offeringID string, targetVersion string) *ReloadOfferingOptions { - return &ReloadOfferingOptions{ - CatalogIdentifier: core.StringPtr(catalogIdentifier), - OfferingID: core.StringPtr(offeringID), - TargetVersion: core.StringPtr(targetVersion), +// NewGetOfferingSourceURLOptions : Instantiate GetOfferingSourceURLOptions +func (*CatalogManagementV1) NewGetOfferingSourceURLOptions(keyIdentifier string) *GetOfferingSourceURLOptions { + return &GetOfferingSourceURLOptions{ + KeyIdentifier: core.StringPtr(keyIdentifier), } } -// SetCatalogIdentifier : Allow user to set CatalogIdentifier -func (_options *ReloadOfferingOptions) SetCatalogIdentifier(catalogIdentifier string) *ReloadOfferingOptions { - _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) - return _options -} - -// SetOfferingID : Allow user to set OfferingID -func (_options *ReloadOfferingOptions) SetOfferingID(offeringID string) *ReloadOfferingOptions { - _options.OfferingID = core.StringPtr(offeringID) - return _options -} - -// SetTargetVersion : Allow user to set TargetVersion -func (_options *ReloadOfferingOptions) SetTargetVersion(targetVersion string) *ReloadOfferingOptions { - _options.TargetVersion = core.StringPtr(targetVersion) - return _options -} - -// SetTags : Allow user to set Tags -func (_options *ReloadOfferingOptions) SetTags(tags []string) *ReloadOfferingOptions { - _options.Tags = tags +// SetKeyIdentifier : Allow user to set KeyIdentifier +func (_options *GetOfferingSourceURLOptions) SetKeyIdentifier(keyIdentifier string) *GetOfferingSourceURLOptions { + _options.KeyIdentifier = core.StringPtr(keyIdentifier) return _options } -// SetTargetKinds : Allow user to set TargetKinds -func (_options *ReloadOfferingOptions) SetTargetKinds(targetKinds []string) *ReloadOfferingOptions { - _options.TargetKinds = targetKinds +// SetAccept : Allow user to set Accept +func (_options *GetOfferingSourceURLOptions) SetAccept(accept string) *GetOfferingSourceURLOptions { + _options.Accept = core.StringPtr(accept) return _options } -// SetContent : Allow user to set Content -func (_options *ReloadOfferingOptions) SetContent(content []byte) *ReloadOfferingOptions { - _options.Content = &content +// SetCatalogID : Allow user to set CatalogID +func (_options *GetOfferingSourceURLOptions) SetCatalogID(catalogID string) *GetOfferingSourceURLOptions { + _options.CatalogID = core.StringPtr(catalogID) return _options } -// SetZipurl : Allow user to set Zipurl -func (_options *ReloadOfferingOptions) SetZipurl(zipurl string) *ReloadOfferingOptions { - _options.Zipurl = core.StringPtr(zipurl) +// SetName : Allow user to set Name +func (_options *GetOfferingSourceURLOptions) SetName(name string) *GetOfferingSourceURLOptions { + _options.Name = core.StringPtr(name) return _options } -// SetRepoType : Allow user to set RepoType -func (_options *ReloadOfferingOptions) SetRepoType(repoType string) *ReloadOfferingOptions { - _options.RepoType = core.StringPtr(repoType) +// SetID : Allow user to set ID +func (_options *GetOfferingSourceURLOptions) SetID(id string) *GetOfferingSourceURLOptions { + _options.ID = core.StringPtr(id) return _options } // SetHeaders : Allow user to set Headers -func (options *ReloadOfferingOptions) SetHeaders(param map[string]string) *ReloadOfferingOptions { +func (options *GetOfferingSourceURLOptions) SetHeaders(param map[string]string) *GetOfferingSourceURLOptions { options.Headers = param return options } -// ReplaceCatalogOptions : The ReplaceCatalog options. -type ReplaceCatalogOptions struct { +// GetOfferingUpdatesOptions : The GetOfferingUpdates options. +type GetOfferingUpdatesOptions struct { // Catalog identifier. CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` - // Unique ID. - ID *string `json:"id,omitempty"` - - // Cloudant revision. - Rev *string `json:"_rev,omitempty"` + // Offering identification. + OfferingID *string `json:"offering_id" validate:"required,ne="` - // Display Name in the requested language. - Label *string `json:"label,omitempty"` + // The kind of offering (e.g, helm, ova, terraform ...). + Kind *string `json:"kind" validate:"required"` - // Description in the requested language. - ShortDescription *string `json:"short_description,omitempty"` + // IAM Refresh token. + XAuthRefreshToken *string `json:"X-Auth-Refresh-Token" validate:"required"` - // URL for an icon associated with this catalog. - CatalogIconURL *string `json:"catalog_icon_url,omitempty"` + // The target kind of the currently installed version (e.g. iks, roks, etc). + Target *string `json:"target,omitempty"` - // List of tags associated with this catalog. - Tags []string `json:"tags,omitempty"` + // optionaly provide an existing version to check updates for if one is not given, all version will be returned. + Version *string `json:"version,omitempty"` - // List of features associated with this catalog. - Features []Feature `json:"features,omitempty"` + // The id of the cluster where this version was installed. + ClusterID *string `json:"cluster_id,omitempty"` - // Denotes whether a catalog is disabled. - Disabled *bool `json:"disabled,omitempty"` + // The region of the cluster where this version was installed. + Region *string `json:"region,omitempty"` - // Resource group id the catalog is owned by. + // The resource group id of the cluster where this version was installed. ResourceGroupID *string `json:"resource_group_id,omitempty"` - // Account that owns catalog. - OwningAccount *string `json:"owning_account,omitempty"` + // The namespace of the cluster where this version was installed. + Namespace *string `json:"namespace,omitempty"` - // Filters for account and catalog filters. - CatalogFilters *Filters `json:"catalog_filters,omitempty"` + // The sha value of the currently installed version. + Sha *string `json:"sha,omitempty"` - // Feature information. - SyndicationSettings *SyndicationResource `json:"syndication_settings,omitempty"` + // Optionally provide the channel value of the currently installed version. + Channel *string `json:"channel,omitempty"` - // Kind of catalog. Supported kinds are offering and vpe. - Kind *string `json:"kind,omitempty"` + // Optionally provide a list of namespaces used for the currently installed version. + Namespaces []string `json:"namespaces,omitempty"` + + // Optionally indicate that the current version was installed in all namespaces. + AllNamespaces *bool `json:"all_namespaces,omitempty"` // Allows users to set headers on API requests Headers map[string]string } -// NewReplaceCatalogOptions : Instantiate ReplaceCatalogOptions -func (*CatalogManagementV1) NewReplaceCatalogOptions(catalogIdentifier string) *ReplaceCatalogOptions { - return &ReplaceCatalogOptions{ +// NewGetOfferingUpdatesOptions : Instantiate GetOfferingUpdatesOptions +func (*CatalogManagementV1) NewGetOfferingUpdatesOptions(catalogIdentifier string, offeringID string, kind string, xAuthRefreshToken string) *GetOfferingUpdatesOptions { + return &GetOfferingUpdatesOptions{ CatalogIdentifier: core.StringPtr(catalogIdentifier), + OfferingID: core.StringPtr(offeringID), + Kind: core.StringPtr(kind), + XAuthRefreshToken: core.StringPtr(xAuthRefreshToken), } } // SetCatalogIdentifier : Allow user to set CatalogIdentifier -func (_options *ReplaceCatalogOptions) SetCatalogIdentifier(catalogIdentifier string) *ReplaceCatalogOptions { +func (_options *GetOfferingUpdatesOptions) SetCatalogIdentifier(catalogIdentifier string) *GetOfferingUpdatesOptions { _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) return _options } -// SetID : Allow user to set ID -func (_options *ReplaceCatalogOptions) SetID(id string) *ReplaceCatalogOptions { - _options.ID = core.StringPtr(id) +// SetOfferingID : Allow user to set OfferingID +func (_options *GetOfferingUpdatesOptions) SetOfferingID(offeringID string) *GetOfferingUpdatesOptions { + _options.OfferingID = core.StringPtr(offeringID) return _options } -// SetRev : Allow user to set Rev -func (_options *ReplaceCatalogOptions) SetRev(rev string) *ReplaceCatalogOptions { - _options.Rev = core.StringPtr(rev) +// SetKind : Allow user to set Kind +func (_options *GetOfferingUpdatesOptions) SetKind(kind string) *GetOfferingUpdatesOptions { + _options.Kind = core.StringPtr(kind) return _options } -// SetLabel : Allow user to set Label -func (_options *ReplaceCatalogOptions) SetLabel(label string) *ReplaceCatalogOptions { - _options.Label = core.StringPtr(label) +// SetXAuthRefreshToken : Allow user to set XAuthRefreshToken +func (_options *GetOfferingUpdatesOptions) SetXAuthRefreshToken(xAuthRefreshToken string) *GetOfferingUpdatesOptions { + _options.XAuthRefreshToken = core.StringPtr(xAuthRefreshToken) return _options } -// SetShortDescription : Allow user to set ShortDescription -func (_options *ReplaceCatalogOptions) SetShortDescription(shortDescription string) *ReplaceCatalogOptions { - _options.ShortDescription = core.StringPtr(shortDescription) +// SetTarget : Allow user to set Target +func (_options *GetOfferingUpdatesOptions) SetTarget(target string) *GetOfferingUpdatesOptions { + _options.Target = core.StringPtr(target) return _options } -// SetCatalogIconURL : Allow user to set CatalogIconURL -func (_options *ReplaceCatalogOptions) SetCatalogIconURL(catalogIconURL string) *ReplaceCatalogOptions { - _options.CatalogIconURL = core.StringPtr(catalogIconURL) +// SetVersion : Allow user to set Version +func (_options *GetOfferingUpdatesOptions) SetVersion(version string) *GetOfferingUpdatesOptions { + _options.Version = core.StringPtr(version) return _options } -// SetTags : Allow user to set Tags -func (_options *ReplaceCatalogOptions) SetTags(tags []string) *ReplaceCatalogOptions { - _options.Tags = tags +// SetClusterID : Allow user to set ClusterID +func (_options *GetOfferingUpdatesOptions) SetClusterID(clusterID string) *GetOfferingUpdatesOptions { + _options.ClusterID = core.StringPtr(clusterID) return _options } -// SetFeatures : Allow user to set Features -func (_options *ReplaceCatalogOptions) SetFeatures(features []Feature) *ReplaceCatalogOptions { - _options.Features = features +// SetRegion : Allow user to set Region +func (_options *GetOfferingUpdatesOptions) SetRegion(region string) *GetOfferingUpdatesOptions { + _options.Region = core.StringPtr(region) return _options } -// SetDisabled : Allow user to set Disabled -func (_options *ReplaceCatalogOptions) SetDisabled(disabled bool) *ReplaceCatalogOptions { - _options.Disabled = core.BoolPtr(disabled) +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *GetOfferingUpdatesOptions) SetResourceGroupID(resourceGroupID string) *GetOfferingUpdatesOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) return _options } -// SetResourceGroupID : Allow user to set ResourceGroupID -func (_options *ReplaceCatalogOptions) SetResourceGroupID(resourceGroupID string) *ReplaceCatalogOptions { - _options.ResourceGroupID = core.StringPtr(resourceGroupID) +// SetNamespace : Allow user to set Namespace +func (_options *GetOfferingUpdatesOptions) SetNamespace(namespace string) *GetOfferingUpdatesOptions { + _options.Namespace = core.StringPtr(namespace) return _options } -// SetOwningAccount : Allow user to set OwningAccount -func (_options *ReplaceCatalogOptions) SetOwningAccount(owningAccount string) *ReplaceCatalogOptions { - _options.OwningAccount = core.StringPtr(owningAccount) +// SetSha : Allow user to set Sha +func (_options *GetOfferingUpdatesOptions) SetSha(sha string) *GetOfferingUpdatesOptions { + _options.Sha = core.StringPtr(sha) return _options } -// SetCatalogFilters : Allow user to set CatalogFilters -func (_options *ReplaceCatalogOptions) SetCatalogFilters(catalogFilters *Filters) *ReplaceCatalogOptions { - _options.CatalogFilters = catalogFilters +// SetChannel : Allow user to set Channel +func (_options *GetOfferingUpdatesOptions) SetChannel(channel string) *GetOfferingUpdatesOptions { + _options.Channel = core.StringPtr(channel) return _options } -// SetSyndicationSettings : Allow user to set SyndicationSettings -func (_options *ReplaceCatalogOptions) SetSyndicationSettings(syndicationSettings *SyndicationResource) *ReplaceCatalogOptions { - _options.SyndicationSettings = syndicationSettings +// SetNamespaces : Allow user to set Namespaces +func (_options *GetOfferingUpdatesOptions) SetNamespaces(namespaces []string) *GetOfferingUpdatesOptions { + _options.Namespaces = namespaces return _options } -// SetKind : Allow user to set Kind -func (_options *ReplaceCatalogOptions) SetKind(kind string) *ReplaceCatalogOptions { - _options.Kind = core.StringPtr(kind) +// SetAllNamespaces : Allow user to set AllNamespaces +func (_options *GetOfferingUpdatesOptions) SetAllNamespaces(allNamespaces bool) *GetOfferingUpdatesOptions { + _options.AllNamespaces = core.BoolPtr(allNamespaces) return _options } // SetHeaders : Allow user to set Headers -func (options *ReplaceCatalogOptions) SetHeaders(param map[string]string) *ReplaceCatalogOptions { +func (options *GetOfferingUpdatesOptions) SetHeaders(param map[string]string) *GetOfferingUpdatesOptions { options.Headers = param return options } -// ReplaceObjectOptions : The ReplaceObject options. -type ReplaceObjectOptions struct { - // Catalog identifier. - CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` - - // Object identifier. - ObjectIdentifier *string `json:"object_identifier" validate:"required,ne="` - - // unique id. - ID *string `json:"id,omitempty"` - - // The programmatic name of this offering. - Name *string `json:"name,omitempty"` - - // Cloudant revision. - Rev *string `json:"_rev,omitempty"` - - // The crn for this specific object. - CRN *string `json:"crn,omitempty"` - - // The url for this specific object. - URL *string `json:"url,omitempty"` +// GetOfferingWorkingCopyOptions : The GetOfferingWorkingCopy options. +type GetOfferingWorkingCopyOptions struct { + // A dotted value of `catalogID`.`versionID`. + VersionLocID *string `json:"version_loc_id" validate:"required,ne="` - // The parent for this specific object. - ParentID *string `json:"parent_id,omitempty"` + // Allows users to set headers on API requests + Headers map[string]string +} - // Translated display name in the requested language. - LabelI18n *string `json:"label_i18n,omitempty"` +// NewGetOfferingWorkingCopyOptions : Instantiate GetOfferingWorkingCopyOptions +func (*CatalogManagementV1) NewGetOfferingWorkingCopyOptions(versionLocID string) *GetOfferingWorkingCopyOptions { + return &GetOfferingWorkingCopyOptions{ + VersionLocID: core.StringPtr(versionLocID), + } +} - // Display name in the requested language. - Label *string `json:"label,omitempty"` +// SetVersionLocID : Allow user to set VersionLocID +func (_options *GetOfferingWorkingCopyOptions) SetVersionLocID(versionLocID string) *GetOfferingWorkingCopyOptions { + _options.VersionLocID = core.StringPtr(versionLocID) + return _options +} - // List of tags associated with this catalog. - Tags []string `json:"tags,omitempty"` +// SetHeaders : Allow user to set Headers +func (options *GetOfferingWorkingCopyOptions) SetHeaders(param map[string]string) *GetOfferingWorkingCopyOptions { + options.Headers = param + return options +} - // The date and time this catalog was created. - Created *strfmt.DateTime `json:"created,omitempty"` +// GetOverrideValuesOptions : The GetOverrideValues options. +type GetOverrideValuesOptions struct { + // A dotted value of `catalogID`.`versionID`. + VersionLocID *string `json:"version_loc_id" validate:"required,ne="` - // The date and time this catalog was last updated. - Updated *strfmt.DateTime `json:"updated,omitempty"` + // Allows users to set headers on API requests + Headers map[string]string +} - // Short description in the requested language. - ShortDescription *string `json:"short_description,omitempty"` +// NewGetOverrideValuesOptions : Instantiate GetOverrideValuesOptions +func (*CatalogManagementV1) NewGetOverrideValuesOptions(versionLocID string) *GetOverrideValuesOptions { + return &GetOverrideValuesOptions{ + VersionLocID: core.StringPtr(versionLocID), + } +} - // Short description translation. - ShortDescriptionI18n *string `json:"short_description_i18n,omitempty"` +// SetVersionLocID : Allow user to set VersionLocID +func (_options *GetOverrideValuesOptions) SetVersionLocID(versionLocID string) *GetOverrideValuesOptions { + _options.VersionLocID = core.StringPtr(versionLocID) + return _options +} - // Kind of object. - Kind *string `json:"kind,omitempty"` +// SetHeaders : Allow user to set Headers +func (options *GetOverrideValuesOptions) SetHeaders(param map[string]string) *GetOverrideValuesOptions { + options.Headers = param + return options +} - // Publish information. - Publish *PublishObject `json:"publish,omitempty"` +// GetPreinstallOptions : The GetPreinstall options. +type GetPreinstallOptions struct { + // A dotted value of `catalogID`.`versionID`. + VersionLocID *string `json:"version_loc_id" validate:"required,ne="` - // Offering state. - State *State `json:"state,omitempty"` + // IAM Refresh token. + XAuthRefreshToken *string `json:"X-Auth-Refresh-Token" validate:"required"` - // The id of the catalog containing this offering. - CatalogID *string `json:"catalog_id,omitempty"` + // ID of the cluster. + ClusterID *string `json:"cluster_id,omitempty"` - // The name of the catalog. - CatalogName *string `json:"catalog_name,omitempty"` + // Cluster region. + Region *string `json:"region,omitempty"` - // Map of data values for this object. - Data map[string]interface{} `json:"data,omitempty"` + // Required if the version's pre-install scope is `namespace`. + Namespace *string `json:"namespace,omitempty"` // Allows users to set headers on API requests Headers map[string]string } -// NewReplaceObjectOptions : Instantiate ReplaceObjectOptions -func (*CatalogManagementV1) NewReplaceObjectOptions(catalogIdentifier string, objectIdentifier string) *ReplaceObjectOptions { - return &ReplaceObjectOptions{ - CatalogIdentifier: core.StringPtr(catalogIdentifier), - ObjectIdentifier: core.StringPtr(objectIdentifier), +// NewGetPreinstallOptions : Instantiate GetPreinstallOptions +func (*CatalogManagementV1) NewGetPreinstallOptions(versionLocID string, xAuthRefreshToken string) *GetPreinstallOptions { + return &GetPreinstallOptions{ + VersionLocID: core.StringPtr(versionLocID), + XAuthRefreshToken: core.StringPtr(xAuthRefreshToken), } } -// SetCatalogIdentifier : Allow user to set CatalogIdentifier -func (_options *ReplaceObjectOptions) SetCatalogIdentifier(catalogIdentifier string) *ReplaceObjectOptions { - _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) +// SetVersionLocID : Allow user to set VersionLocID +func (_options *GetPreinstallOptions) SetVersionLocID(versionLocID string) *GetPreinstallOptions { + _options.VersionLocID = core.StringPtr(versionLocID) return _options } -// SetObjectIdentifier : Allow user to set ObjectIdentifier -func (_options *ReplaceObjectOptions) SetObjectIdentifier(objectIdentifier string) *ReplaceObjectOptions { - _options.ObjectIdentifier = core.StringPtr(objectIdentifier) +// SetXAuthRefreshToken : Allow user to set XAuthRefreshToken +func (_options *GetPreinstallOptions) SetXAuthRefreshToken(xAuthRefreshToken string) *GetPreinstallOptions { + _options.XAuthRefreshToken = core.StringPtr(xAuthRefreshToken) return _options } -// SetID : Allow user to set ID -func (_options *ReplaceObjectOptions) SetID(id string) *ReplaceObjectOptions { - _options.ID = core.StringPtr(id) +// SetClusterID : Allow user to set ClusterID +func (_options *GetPreinstallOptions) SetClusterID(clusterID string) *GetPreinstallOptions { + _options.ClusterID = core.StringPtr(clusterID) return _options } -// SetName : Allow user to set Name -func (_options *ReplaceObjectOptions) SetName(name string) *ReplaceObjectOptions { - _options.Name = core.StringPtr(name) +// SetRegion : Allow user to set Region +func (_options *GetPreinstallOptions) SetRegion(region string) *GetPreinstallOptions { + _options.Region = core.StringPtr(region) return _options } -// SetRev : Allow user to set Rev -func (_options *ReplaceObjectOptions) SetRev(rev string) *ReplaceObjectOptions { - _options.Rev = core.StringPtr(rev) +// SetNamespace : Allow user to set Namespace +func (_options *GetPreinstallOptions) SetNamespace(namespace string) *GetPreinstallOptions { + _options.Namespace = core.StringPtr(namespace) return _options } -// SetCRN : Allow user to set CRN -func (_options *ReplaceObjectOptions) SetCRN(crn string) *ReplaceObjectOptions { - _options.CRN = core.StringPtr(crn) - return _options +// SetHeaders : Allow user to set Headers +func (options *GetPreinstallOptions) SetHeaders(param map[string]string) *GetPreinstallOptions { + options.Headers = param + return options } -// SetURL : Allow user to set URL -func (_options *ReplaceObjectOptions) SetURL(url string) *ReplaceObjectOptions { - _options.URL = core.StringPtr(url) - return _options -} +// GetValidationStatusOptions : The GetValidationStatus options. +type GetValidationStatusOptions struct { + // A dotted value of `catalogID`.`versionID`. + VersionLocID *string `json:"version_loc_id" validate:"required,ne="` -// SetParentID : Allow user to set ParentID -func (_options *ReplaceObjectOptions) SetParentID(parentID string) *ReplaceObjectOptions { - _options.ParentID = core.StringPtr(parentID) - return _options -} + // IAM Refresh token. + XAuthRefreshToken *string `json:"X-Auth-Refresh-Token" validate:"required"` -// SetLabelI18n : Allow user to set LabelI18n -func (_options *ReplaceObjectOptions) SetLabelI18n(labelI18n string) *ReplaceObjectOptions { - _options.LabelI18n = core.StringPtr(labelI18n) - return _options + // Allows users to set headers on API requests + Headers map[string]string } -// SetLabel : Allow user to set Label -func (_options *ReplaceObjectOptions) SetLabel(label string) *ReplaceObjectOptions { - _options.Label = core.StringPtr(label) - return _options +// NewGetValidationStatusOptions : Instantiate GetValidationStatusOptions +func (*CatalogManagementV1) NewGetValidationStatusOptions(versionLocID string, xAuthRefreshToken string) *GetValidationStatusOptions { + return &GetValidationStatusOptions{ + VersionLocID: core.StringPtr(versionLocID), + XAuthRefreshToken: core.StringPtr(xAuthRefreshToken), + } } -// SetTags : Allow user to set Tags -func (_options *ReplaceObjectOptions) SetTags(tags []string) *ReplaceObjectOptions { - _options.Tags = tags +// SetVersionLocID : Allow user to set VersionLocID +func (_options *GetValidationStatusOptions) SetVersionLocID(versionLocID string) *GetValidationStatusOptions { + _options.VersionLocID = core.StringPtr(versionLocID) return _options } -// SetCreated : Allow user to set Created -func (_options *ReplaceObjectOptions) SetCreated(created *strfmt.DateTime) *ReplaceObjectOptions { - _options.Created = created +// SetXAuthRefreshToken : Allow user to set XAuthRefreshToken +func (_options *GetValidationStatusOptions) SetXAuthRefreshToken(xAuthRefreshToken string) *GetValidationStatusOptions { + _options.XAuthRefreshToken = core.StringPtr(xAuthRefreshToken) return _options } -// SetUpdated : Allow user to set Updated -func (_options *ReplaceObjectOptions) SetUpdated(updated *strfmt.DateTime) *ReplaceObjectOptions { - _options.Updated = updated - return _options +// SetHeaders : Allow user to set Headers +func (options *GetValidationStatusOptions) SetHeaders(param map[string]string) *GetValidationStatusOptions { + options.Headers = param + return options } -// SetShortDescription : Allow user to set ShortDescription -func (_options *ReplaceObjectOptions) SetShortDescription(shortDescription string) *ReplaceObjectOptions { - _options.ShortDescription = core.StringPtr(shortDescription) - return _options -} +// GetVersionOptions : The GetVersion options. +type GetVersionOptions struct { + // A dotted value of `catalogID`.`versionID`. + VersionLocID *string `json:"version_loc_id" validate:"required,ne="` -// SetShortDescriptionI18n : Allow user to set ShortDescriptionI18n -func (_options *ReplaceObjectOptions) SetShortDescriptionI18n(shortDescriptionI18n string) *ReplaceObjectOptions { - _options.ShortDescriptionI18n = core.StringPtr(shortDescriptionI18n) - return _options + // Allows users to set headers on API requests + Headers map[string]string } -// SetKind : Allow user to set Kind -func (_options *ReplaceObjectOptions) SetKind(kind string) *ReplaceObjectOptions { - _options.Kind = core.StringPtr(kind) - return _options +// NewGetVersionOptions : Instantiate GetVersionOptions +func (*CatalogManagementV1) NewGetVersionOptions(versionLocID string) *GetVersionOptions { + return &GetVersionOptions{ + VersionLocID: core.StringPtr(versionLocID), + } } -// SetPublish : Allow user to set Publish -func (_options *ReplaceObjectOptions) SetPublish(publish *PublishObject) *ReplaceObjectOptions { - _options.Publish = publish +// SetVersionLocID : Allow user to set VersionLocID +func (_options *GetVersionOptions) SetVersionLocID(versionLocID string) *GetVersionOptions { + _options.VersionLocID = core.StringPtr(versionLocID) return _options } -// SetState : Allow user to set State -func (_options *ReplaceObjectOptions) SetState(state *State) *ReplaceObjectOptions { - _options.State = state - return _options +// SetHeaders : Allow user to set Headers +func (options *GetVersionOptions) SetHeaders(param map[string]string) *GetVersionOptions { + options.Headers = param + return options } -// SetCatalogID : Allow user to set CatalogID -func (_options *ReplaceObjectOptions) SetCatalogID(catalogID string) *ReplaceObjectOptions { - _options.CatalogID = core.StringPtr(catalogID) - return _options +// IamPermission : IAM Permission definition. +type IamPermission struct { + // Service name. + ServiceName *string `json:"service_name,omitempty"` + + // Role CRNs for this permission. + RoleCrns []string `json:"role_crns,omitempty"` + + // Resources for this permission. + Resources []IamResource `json:"resources,omitempty"` } -// SetCatalogName : Allow user to set CatalogName -func (_options *ReplaceObjectOptions) SetCatalogName(catalogName string) *ReplaceObjectOptions { - _options.CatalogName = core.StringPtr(catalogName) - return _options +// UnmarshalIamPermission unmarshals an instance of IamPermission from the specified map of raw messages. +func UnmarshalIamPermission(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(IamPermission) + err = core.UnmarshalPrimitive(m, "service_name", &obj.ServiceName) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "role_crns", &obj.RoleCrns) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resources", &obj.Resources, UnmarshalIamResource) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// SetData : Allow user to set Data -func (_options *ReplaceObjectOptions) SetData(data map[string]interface{}) *ReplaceObjectOptions { - _options.Data = data - return _options +// IamResource : IAM Resource definition. +type IamResource struct { + // Resource name. + Name *string `json:"name,omitempty"` + + // Resource description. + Description *string `json:"description,omitempty"` + + // Role CRNs for this permission. + RoleCrns []string `json:"role_crns,omitempty"` } -// SetHeaders : Allow user to set Headers -func (options *ReplaceObjectOptions) SetHeaders(param map[string]string) *ReplaceObjectOptions { - options.Headers = param - return options +// UnmarshalIamResource unmarshals an instance of IamResource from the specified map of raw messages. +func UnmarshalIamResource(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(IamResource) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "description", &obj.Description) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "role_crns", &obj.RoleCrns) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// IDFilter : Filter on offering ID's. There is an include filter and an exclule filter. Both can be set. +type IDFilter struct { + // Offering filter terms. + Include *FilterTerms `json:"include,omitempty"` + + // Offering filter terms. + Exclude *FilterTerms `json:"exclude,omitempty"` +} + +// UnmarshalIDFilter unmarshals an instance of IDFilter from the specified map of raw messages. +func UnmarshalIDFilter(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(IDFilter) + err = core.UnmarshalModel(m, "include", &obj.Include, UnmarshalFilterTerms) + if err != nil { + return + } + err = core.UnmarshalModel(m, "exclude", &obj.Exclude, UnmarshalFilterTerms) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// ReplaceOfferingIconOptions : The ReplaceOfferingIcon options. -type ReplaceOfferingIconOptions struct { +// IBMPublishObjectOptions : The IBMPublishObject options. +type IBMPublishObjectOptions struct { // Catalog identifier. CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` - // Offering identification. - OfferingID *string `json:"offering_id" validate:"required,ne="` - - // Name of the file name that is being uploaded. - FileName *string `json:"file_name" validate:"required,ne="` + // Object identifier. + ObjectIdentifier *string `json:"object_identifier" validate:"required,ne="` // Allows users to set headers on API requests Headers map[string]string } -// NewReplaceOfferingIconOptions : Instantiate ReplaceOfferingIconOptions -func (*CatalogManagementV1) NewReplaceOfferingIconOptions(catalogIdentifier string, offeringID string, fileName string) *ReplaceOfferingIconOptions { - return &ReplaceOfferingIconOptions{ +// NewIBMPublishObjectOptions : Instantiate IBMPublishObjectOptions +func (*CatalogManagementV1) NewIBMPublishObjectOptions(catalogIdentifier string, objectIdentifier string) *IBMPublishObjectOptions { + return &IBMPublishObjectOptions{ CatalogIdentifier: core.StringPtr(catalogIdentifier), - OfferingID: core.StringPtr(offeringID), - FileName: core.StringPtr(fileName), + ObjectIdentifier: core.StringPtr(objectIdentifier), } } // SetCatalogIdentifier : Allow user to set CatalogIdentifier -func (_options *ReplaceOfferingIconOptions) SetCatalogIdentifier(catalogIdentifier string) *ReplaceOfferingIconOptions { +func (_options *IBMPublishObjectOptions) SetCatalogIdentifier(catalogIdentifier string) *IBMPublishObjectOptions { _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) return _options } -// SetOfferingID : Allow user to set OfferingID -func (_options *ReplaceOfferingIconOptions) SetOfferingID(offeringID string) *ReplaceOfferingIconOptions { - _options.OfferingID = core.StringPtr(offeringID) - return _options -} - -// SetFileName : Allow user to set FileName -func (_options *ReplaceOfferingIconOptions) SetFileName(fileName string) *ReplaceOfferingIconOptions { - _options.FileName = core.StringPtr(fileName) +// SetObjectIdentifier : Allow user to set ObjectIdentifier +func (_options *IBMPublishObjectOptions) SetObjectIdentifier(objectIdentifier string) *IBMPublishObjectOptions { + _options.ObjectIdentifier = core.StringPtr(objectIdentifier) return _options } // SetHeaders : Allow user to set Headers -func (options *ReplaceOfferingIconOptions) SetHeaders(param map[string]string) *ReplaceOfferingIconOptions { +func (options *IBMPublishObjectOptions) SetHeaders(param map[string]string) *IBMPublishObjectOptions { options.Headers = param return options } -// ReplaceOfferingOptions : The ReplaceOffering options. -type ReplaceOfferingOptions struct { - // Catalog identifier. - CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` +// IBMPublishVersionOptions : The IBMPublishVersion options. +type IBMPublishVersionOptions struct { + // A dotted value of `catalogID`.`versionID`. + VersionLocID *string `json:"version_loc_id" validate:"required,ne="` - // Offering identification. - OfferingID *string `json:"offering_id" validate:"required,ne="` + // Allows users to set headers on API requests + Headers map[string]string +} - // unique id. - ID *string `json:"id,omitempty"` +// NewIBMPublishVersionOptions : Instantiate IBMPublishVersionOptions +func (*CatalogManagementV1) NewIBMPublishVersionOptions(versionLocID string) *IBMPublishVersionOptions { + return &IBMPublishVersionOptions{ + VersionLocID: core.StringPtr(versionLocID), + } +} - // Cloudant revision. - Rev *string `json:"_rev,omitempty"` +// SetVersionLocID : Allow user to set VersionLocID +func (_options *IBMPublishVersionOptions) SetVersionLocID(versionLocID string) *IBMPublishVersionOptions { + _options.VersionLocID = core.StringPtr(versionLocID) + return _options +} - // The url for this specific offering. - URL *string `json:"url,omitempty"` +// SetHeaders : Allow user to set Headers +func (options *IBMPublishVersionOptions) SetHeaders(param map[string]string) *IBMPublishVersionOptions { + options.Headers = param + return options +} - // The crn for this specific offering. - CRN *string `json:"crn,omitempty"` +// Image : Image. +type Image struct { + // Image. + Image *string `json:"image,omitempty"` +} - // Display Name in the requested language. - Label *string `json:"label,omitempty"` +// UnmarshalImage unmarshals an instance of Image from the specified map of raw messages. +func UnmarshalImage(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Image) + err = core.UnmarshalPrimitive(m, "image", &obj.Image) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} - // The programmatic name of this offering. - Name *string `json:"name,omitempty"` +// ImageManifest : Image Manifest. +type ImageManifest struct { + // Image manifest description. + Description *string `json:"description,omitempty"` - // URL for an icon associated with this offering. - OfferingIconURL *string `json:"offering_icon_url,omitempty"` + // List of images. + Images []Image `json:"images,omitempty"` +} - // URL for an additional docs with this offering. - OfferingDocsURL *string `json:"offering_docs_url,omitempty"` +// UnmarshalImageManifest unmarshals an instance of ImageManifest from the specified map of raw messages. +func UnmarshalImageManifest(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageManifest) + err = core.UnmarshalPrimitive(m, "description", &obj.Description) + if err != nil { + return + } + err = core.UnmarshalModel(m, "images", &obj.Images, UnmarshalImage) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} - // [deprecated] - Use offering.support instead. URL to be displayed in the Consumption UI for getting support on this - // offering. - OfferingSupportURL *string `json:"offering_support_url,omitempty"` +// ImagePullKey : Image pull keys for an offering. +type ImagePullKey struct { + // Key name. + Name *string `json:"name,omitempty"` - // List of tags associated with this catalog. - Tags []string `json:"tags,omitempty"` + // Key value. + Value *string `json:"value,omitempty"` - // List of keywords associated with offering, typically used to search for it. - Keywords []string `json:"keywords,omitempty"` + // Key description. + Description *string `json:"description,omitempty"` +} - // Repository info for offerings. - Rating *Rating `json:"rating,omitempty"` +// UnmarshalImagePullKey unmarshals an instance of ImagePullKey from the specified map of raw messages. +func UnmarshalImagePullKey(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImagePullKey) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "description", &obj.Description) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} - // The date and time this catalog was created. - Created *strfmt.DateTime `json:"created,omitempty"` +// ImportOfferingBodyMetadata : Generic data to be included with content being onboarded. Required for virtual server image for VPC. +type ImportOfferingBodyMetadata struct { + // Operating system included in this image. Required for virtual server image for VPC. + OperatingSystem *ImportOfferingBodyMetadataOperatingSystem `json:"operating_system,omitempty"` - // The date and time this catalog was last updated. - Updated *strfmt.DateTime `json:"updated,omitempty"` + // Details for the stored image file. Required for virtual server image for VPC. + File *ImportOfferingBodyMetadataFile `json:"file,omitempty"` - // Short description in the requested language. - ShortDescription *string `json:"short_description,omitempty"` + // Minimum size (in gigabytes) of a volume onto which this image may be provisioned. Required for virtual server image + // for VPC. + MinimumProvisionedSize *int64 `json:"minimum_provisioned_size,omitempty"` - // Long description in the requested language. - LongDescription *string `json:"long_description,omitempty"` + // Image operating system. Required for virtual server image for VPC. + Images []ImportOfferingBodyMetadataImagesItem `json:"images,omitempty"` +} - // list of features associated with this offering. - Features []Feature `json:"features,omitempty"` +// UnmarshalImportOfferingBodyMetadata unmarshals an instance of ImportOfferingBodyMetadata from the specified map of raw messages. +func UnmarshalImportOfferingBodyMetadata(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImportOfferingBodyMetadata) + err = core.UnmarshalModel(m, "operating_system", &obj.OperatingSystem, UnmarshalImportOfferingBodyMetadataOperatingSystem) + if err != nil { + return + } + err = core.UnmarshalModel(m, "file", &obj.File, UnmarshalImportOfferingBodyMetadataFile) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "minimum_provisioned_size", &obj.MinimumProvisionedSize) + if err != nil { + return + } + err = core.UnmarshalModel(m, "images", &obj.Images, UnmarshalImportOfferingBodyMetadataImagesItem) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} - // Array of kind. - Kinds []Kind `json:"kinds,omitempty"` +// ImportOfferingBodyMetadataFile : Details for the stored image file. Required for virtual server image for VPC. +type ImportOfferingBodyMetadataFile struct { + // Size of the stored image file rounded up to the next gigabyte. Required for virtual server image for VPC. + Size *int64 `json:"size,omitempty"` +} - // Is it permitted to request publishing to IBM or Public. - PermitRequestIBMPublicPublish *bool `json:"permit_request_ibm_public_publish,omitempty"` +// UnmarshalImportOfferingBodyMetadataFile unmarshals an instance of ImportOfferingBodyMetadataFile from the specified map of raw messages. +func UnmarshalImportOfferingBodyMetadataFile(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImportOfferingBodyMetadataFile) + err = core.UnmarshalPrimitive(m, "size", &obj.Size) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} - // Indicates if this offering has been approved for use by all IBMers. - IBMPublishApproved *bool `json:"ibm_publish_approved,omitempty"` +// ImportOfferingBodyMetadataImagesItem : A list of details that identify a virtual server image. Required for virtual server image for VPC. +type ImportOfferingBodyMetadataImagesItem struct { + // Programmatic ID of virtual server image. Required for virtual server image for VPC. + ID *string `json:"id,omitempty"` - // Indicates if this offering has been approved for use by all IBM Cloud users. - PublicPublishApproved *bool `json:"public_publish_approved,omitempty"` + // Programmatic name of virtual server image. Required for virtual server image for VPC. + Name *string `json:"name,omitempty"` - // The original offering CRN that this publish entry came from. - PublicOriginalCRN *string `json:"public_original_crn,omitempty"` + // Region the virtual server image is available in. Required for virtual server image for VPC. + Region *string `json:"region,omitempty"` +} - // The crn of the public catalog entry of this offering. - PublishPublicCRN *string `json:"publish_public_crn,omitempty"` +// UnmarshalImportOfferingBodyMetadataImagesItem unmarshals an instance of ImportOfferingBodyMetadataImagesItem from the specified map of raw messages. +func UnmarshalImportOfferingBodyMetadataImagesItem(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImportOfferingBodyMetadataImagesItem) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "region", &obj.Region) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} - // The portal's approval record ID. - PortalApprovalRecord *string `json:"portal_approval_record,omitempty"` +// ImportOfferingBodyMetadataOperatingSystem : Operating system included in this image. Required for virtual server image for VPC. +type ImportOfferingBodyMetadataOperatingSystem struct { + // Images with this operating system can only be used on dedicated hosts or dedicated host groups. Required for virtual + // server image for VPC. + DedicatedHostOnly *bool `json:"dedicated_host_only,omitempty"` - // The portal UI URL. - PortalUIURL *string `json:"portal_ui_url,omitempty"` + // Vendor of the operating system. Required for virtual server image for VPC. + Vendor *string `json:"vendor,omitempty"` - // The id of the catalog containing this offering. - CatalogID *string `json:"catalog_id,omitempty"` + // Globally unique name for this operating system Required for virtual server image for VPC. + Name *string `json:"name,omitempty"` - // The name of the catalog. - CatalogName *string `json:"catalog_name,omitempty"` + // URL for this operating system. Required for virtual server image for VPC. + Href *string `json:"href,omitempty"` - // Map of metadata values for this offering. - Metadata map[string]interface{} `json:"metadata,omitempty"` + // Unique, display-friendly name for the operating system. Required for virtual server image for VPC. + DisplayName *string `json:"display_name,omitempty"` - // A disclaimer for this offering. - Disclaimer *string `json:"disclaimer,omitempty"` + // Software family for this operating system. Required for virtual server image for VPC. + Family *string `json:"family,omitempty"` - // Determine if this offering should be displayed in the Consumption UI. - Hidden *bool `json:"hidden,omitempty"` + // Major release version of this operating system. Required for virtual server image for VPC. + Version *string `json:"version,omitempty"` - // Deprecated - Provider of this offering. - Provider *string `json:"provider,omitempty"` + // Operating system architecture. Required for virtual server image for VPC. + Architecture *string `json:"architecture,omitempty"` +} - // Information on the provider for this offering, or omitted if no provider information is given. - ProviderInfo *ProviderInfo `json:"provider_info,omitempty"` +// UnmarshalImportOfferingBodyMetadataOperatingSystem unmarshals an instance of ImportOfferingBodyMetadataOperatingSystem from the specified map of raw messages. +func UnmarshalImportOfferingBodyMetadataOperatingSystem(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImportOfferingBodyMetadataOperatingSystem) + err = core.UnmarshalPrimitive(m, "dedicated_host_only", &obj.DedicatedHostOnly) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "vendor", &obj.Vendor) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "display_name", &obj.DisplayName) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "family", &obj.Family) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "version", &obj.Version) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "architecture", &obj.Architecture) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} - // Repository info for offerings. - RepoInfo *RepoInfo `json:"repo_info,omitempty"` +// ImportOfferingOptions : The ImportOffering options. +type ImportOfferingOptions struct { + // Catalog identifier. + CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` - // Offering Support information. - Support *Support `json:"support,omitempty"` + // Tags array. + Tags []string `json:"tags,omitempty"` - // A list of media items related to this offering. - Media []MediaItem `json:"media,omitempty"` + // Byte array representing the content to be imported. Only supported for OVA images at this time. + Content *[]byte `json:"content,omitempty"` + + // Name of version. Required for virtual server image for VPC. + Name *string `json:"name,omitempty"` + + // Display name of version. Required for virtual server image for VPC. + Label *string `json:"label,omitempty"` + + // Install type. Example: instance. Required for virtual server image for VPC. + InstallKind *string `json:"install_kind,omitempty"` + + // Deployment target of the content being onboarded. Current valid values are iks, roks, vcenter, power-iaas, + // terraform, and vpc-x86. Required for virtual server image for VPC. + TargetKinds []string `json:"target_kinds,omitempty"` + + // Format of content being onboarded. Example: vsi-image. Required for virtual server image for VPC. + FormatKind *string `json:"format_kind,omitempty"` + + // Optional product kind for the software being onboarded. Valid values are software, module, or solution. Default + // value is software. + ProductKind *string `json:"product_kind,omitempty"` + + // SHA256 fingerprint of the image file. Required for virtual server image for VPC. + Sha *string `json:"sha,omitempty"` + + // Semantic version of the software being onboarded. Required for virtual server image for VPC. + Version *string `json:"version,omitempty"` + + // Version Flavor Information. Only supported for Product kind Solution. + Flavor *Flavor `json:"flavor,omitempty"` + + // Generic data to be included with content being onboarded. Required for virtual server image for VPC. + Metadata *ImportOfferingBodyMetadata `json:"metadata,omitempty"` + + // Optional - The sub-folder within the specified tgz file that contains the software being onboarded. + WorkingDirectory *string `json:"working_directory,omitempty"` + + // URL path to zip location. If not specified, must provide content in this post body. + Zipurl *string `json:"zipurl,omitempty"` + + // Re-use the specified offeringID during import. + OfferingID *string `json:"offeringID,omitempty"` + + // The semver value for this new version. + TargetVersion *string `json:"targetVersion,omitempty"` + + // Add all possible configuration items when creating this version. + IncludeConfig *bool `json:"includeConfig,omitempty"` + + // Indicates that the current terraform template is used to install a virtual server image. + IsVsi *bool `json:"isVSI,omitempty"` + + // The type of repository containing this version. Valid values are 'public_git' or 'enterprise_git'. + Repotype *string `json:"repotype,omitempty"` + + // Authentication token used to access the specified zip file. + XAuthToken *string `json:"X-Auth-Token,omitempty"` // Allows users to set headers on API requests Headers map[string]string } -// NewReplaceOfferingOptions : Instantiate ReplaceOfferingOptions -func (*CatalogManagementV1) NewReplaceOfferingOptions(catalogIdentifier string, offeringID string) *ReplaceOfferingOptions { - return &ReplaceOfferingOptions{ +// NewImportOfferingOptions : Instantiate ImportOfferingOptions +func (*CatalogManagementV1) NewImportOfferingOptions(catalogIdentifier string) *ImportOfferingOptions { + return &ImportOfferingOptions{ CatalogIdentifier: core.StringPtr(catalogIdentifier), - OfferingID: core.StringPtr(offeringID), } } // SetCatalogIdentifier : Allow user to set CatalogIdentifier -func (_options *ReplaceOfferingOptions) SetCatalogIdentifier(catalogIdentifier string) *ReplaceOfferingOptions { +func (_options *ImportOfferingOptions) SetCatalogIdentifier(catalogIdentifier string) *ImportOfferingOptions { _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) return _options } -// SetOfferingID : Allow user to set OfferingID -func (_options *ReplaceOfferingOptions) SetOfferingID(offeringID string) *ReplaceOfferingOptions { - _options.OfferingID = core.StringPtr(offeringID) - return _options -} - -// SetID : Allow user to set ID -func (_options *ReplaceOfferingOptions) SetID(id string) *ReplaceOfferingOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetRev : Allow user to set Rev -func (_options *ReplaceOfferingOptions) SetRev(rev string) *ReplaceOfferingOptions { - _options.Rev = core.StringPtr(rev) +// SetTags : Allow user to set Tags +func (_options *ImportOfferingOptions) SetTags(tags []string) *ImportOfferingOptions { + _options.Tags = tags return _options } -// SetURL : Allow user to set URL -func (_options *ReplaceOfferingOptions) SetURL(url string) *ReplaceOfferingOptions { - _options.URL = core.StringPtr(url) +// SetContent : Allow user to set Content +func (_options *ImportOfferingOptions) SetContent(content []byte) *ImportOfferingOptions { + _options.Content = &content return _options } -// SetCRN : Allow user to set CRN -func (_options *ReplaceOfferingOptions) SetCRN(crn string) *ReplaceOfferingOptions { - _options.CRN = core.StringPtr(crn) +// SetName : Allow user to set Name +func (_options *ImportOfferingOptions) SetName(name string) *ImportOfferingOptions { + _options.Name = core.StringPtr(name) return _options } // SetLabel : Allow user to set Label -func (_options *ReplaceOfferingOptions) SetLabel(label string) *ReplaceOfferingOptions { +func (_options *ImportOfferingOptions) SetLabel(label string) *ImportOfferingOptions { _options.Label = core.StringPtr(label) return _options } -// SetName : Allow user to set Name -func (_options *ReplaceOfferingOptions) SetName(name string) *ReplaceOfferingOptions { - _options.Name = core.StringPtr(name) +// SetInstallKind : Allow user to set InstallKind +func (_options *ImportOfferingOptions) SetInstallKind(installKind string) *ImportOfferingOptions { + _options.InstallKind = core.StringPtr(installKind) return _options } -// SetOfferingIconURL : Allow user to set OfferingIconURL -func (_options *ReplaceOfferingOptions) SetOfferingIconURL(offeringIconURL string) *ReplaceOfferingOptions { - _options.OfferingIconURL = core.StringPtr(offeringIconURL) +// SetTargetKinds : Allow user to set TargetKinds +func (_options *ImportOfferingOptions) SetTargetKinds(targetKinds []string) *ImportOfferingOptions { + _options.TargetKinds = targetKinds return _options } -// SetOfferingDocsURL : Allow user to set OfferingDocsURL -func (_options *ReplaceOfferingOptions) SetOfferingDocsURL(offeringDocsURL string) *ReplaceOfferingOptions { - _options.OfferingDocsURL = core.StringPtr(offeringDocsURL) +// SetFormatKind : Allow user to set FormatKind +func (_options *ImportOfferingOptions) SetFormatKind(formatKind string) *ImportOfferingOptions { + _options.FormatKind = core.StringPtr(formatKind) return _options } -// SetOfferingSupportURL : Allow user to set OfferingSupportURL -func (_options *ReplaceOfferingOptions) SetOfferingSupportURL(offeringSupportURL string) *ReplaceOfferingOptions { - _options.OfferingSupportURL = core.StringPtr(offeringSupportURL) +// SetProductKind : Allow user to set ProductKind +func (_options *ImportOfferingOptions) SetProductKind(productKind string) *ImportOfferingOptions { + _options.ProductKind = core.StringPtr(productKind) return _options } -// SetTags : Allow user to set Tags -func (_options *ReplaceOfferingOptions) SetTags(tags []string) *ReplaceOfferingOptions { - _options.Tags = tags +// SetSha : Allow user to set Sha +func (_options *ImportOfferingOptions) SetSha(sha string) *ImportOfferingOptions { + _options.Sha = core.StringPtr(sha) return _options } -// SetKeywords : Allow user to set Keywords -func (_options *ReplaceOfferingOptions) SetKeywords(keywords []string) *ReplaceOfferingOptions { - _options.Keywords = keywords +// SetVersion : Allow user to set Version +func (_options *ImportOfferingOptions) SetVersion(version string) *ImportOfferingOptions { + _options.Version = core.StringPtr(version) return _options } -// SetRating : Allow user to set Rating -func (_options *ReplaceOfferingOptions) SetRating(rating *Rating) *ReplaceOfferingOptions { - _options.Rating = rating +// SetFlavor : Allow user to set Flavor +func (_options *ImportOfferingOptions) SetFlavor(flavor *Flavor) *ImportOfferingOptions { + _options.Flavor = flavor return _options } -// SetCreated : Allow user to set Created -func (_options *ReplaceOfferingOptions) SetCreated(created *strfmt.DateTime) *ReplaceOfferingOptions { - _options.Created = created +// SetMetadata : Allow user to set Metadata +func (_options *ImportOfferingOptions) SetMetadata(metadata *ImportOfferingBodyMetadata) *ImportOfferingOptions { + _options.Metadata = metadata return _options } -// SetUpdated : Allow user to set Updated -func (_options *ReplaceOfferingOptions) SetUpdated(updated *strfmt.DateTime) *ReplaceOfferingOptions { - _options.Updated = updated +// SetWorkingDirectory : Allow user to set WorkingDirectory +func (_options *ImportOfferingOptions) SetWorkingDirectory(workingDirectory string) *ImportOfferingOptions { + _options.WorkingDirectory = core.StringPtr(workingDirectory) return _options } -// SetShortDescription : Allow user to set ShortDescription -func (_options *ReplaceOfferingOptions) SetShortDescription(shortDescription string) *ReplaceOfferingOptions { - _options.ShortDescription = core.StringPtr(shortDescription) +// SetZipurl : Allow user to set Zipurl +func (_options *ImportOfferingOptions) SetZipurl(zipurl string) *ImportOfferingOptions { + _options.Zipurl = core.StringPtr(zipurl) return _options } -// SetLongDescription : Allow user to set LongDescription -func (_options *ReplaceOfferingOptions) SetLongDescription(longDescription string) *ReplaceOfferingOptions { - _options.LongDescription = core.StringPtr(longDescription) +// SetOfferingID : Allow user to set OfferingID +func (_options *ImportOfferingOptions) SetOfferingID(offeringID string) *ImportOfferingOptions { + _options.OfferingID = core.StringPtr(offeringID) return _options } -// SetFeatures : Allow user to set Features -func (_options *ReplaceOfferingOptions) SetFeatures(features []Feature) *ReplaceOfferingOptions { - _options.Features = features +// SetTargetVersion : Allow user to set TargetVersion +func (_options *ImportOfferingOptions) SetTargetVersion(targetVersion string) *ImportOfferingOptions { + _options.TargetVersion = core.StringPtr(targetVersion) return _options } -// SetKinds : Allow user to set Kinds -func (_options *ReplaceOfferingOptions) SetKinds(kinds []Kind) *ReplaceOfferingOptions { - _options.Kinds = kinds +// SetIncludeConfig : Allow user to set IncludeConfig +func (_options *ImportOfferingOptions) SetIncludeConfig(includeConfig bool) *ImportOfferingOptions { + _options.IncludeConfig = core.BoolPtr(includeConfig) return _options } -// SetPermitRequestIBMPublicPublish : Allow user to set PermitRequestIBMPublicPublish -func (_options *ReplaceOfferingOptions) SetPermitRequestIBMPublicPublish(permitRequestIBMPublicPublish bool) *ReplaceOfferingOptions { - _options.PermitRequestIBMPublicPublish = core.BoolPtr(permitRequestIBMPublicPublish) +// SetIsVsi : Allow user to set IsVsi +func (_options *ImportOfferingOptions) SetIsVsi(isVsi bool) *ImportOfferingOptions { + _options.IsVsi = core.BoolPtr(isVsi) return _options } -// SetIBMPublishApproved : Allow user to set IBMPublishApproved -func (_options *ReplaceOfferingOptions) SetIBMPublishApproved(ibmPublishApproved bool) *ReplaceOfferingOptions { - _options.IBMPublishApproved = core.BoolPtr(ibmPublishApproved) +// SetRepotype : Allow user to set Repotype +func (_options *ImportOfferingOptions) SetRepotype(repotype string) *ImportOfferingOptions { + _options.Repotype = core.StringPtr(repotype) return _options } -// SetPublicPublishApproved : Allow user to set PublicPublishApproved -func (_options *ReplaceOfferingOptions) SetPublicPublishApproved(publicPublishApproved bool) *ReplaceOfferingOptions { - _options.PublicPublishApproved = core.BoolPtr(publicPublishApproved) +// SetXAuthToken : Allow user to set XAuthToken +func (_options *ImportOfferingOptions) SetXAuthToken(xAuthToken string) *ImportOfferingOptions { + _options.XAuthToken = core.StringPtr(xAuthToken) return _options } -// SetPublicOriginalCRN : Allow user to set PublicOriginalCRN -func (_options *ReplaceOfferingOptions) SetPublicOriginalCRN(publicOriginalCRN string) *ReplaceOfferingOptions { - _options.PublicOriginalCRN = core.StringPtr(publicOriginalCRN) - return _options +// SetHeaders : Allow user to set Headers +func (options *ImportOfferingOptions) SetHeaders(param map[string]string) *ImportOfferingOptions { + options.Headers = param + return options } -// SetPublishPublicCRN : Allow user to set PublishPublicCRN -func (_options *ReplaceOfferingOptions) SetPublishPublicCRN(publishPublicCRN string) *ReplaceOfferingOptions { - _options.PublishPublicCRN = core.StringPtr(publishPublicCRN) - return _options -} +// ImportOfferingVersionOptions : The ImportOfferingVersion options. +type ImportOfferingVersionOptions struct { + // Catalog identifier. + CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` -// SetPortalApprovalRecord : Allow user to set PortalApprovalRecord -func (_options *ReplaceOfferingOptions) SetPortalApprovalRecord(portalApprovalRecord string) *ReplaceOfferingOptions { - _options.PortalApprovalRecord = core.StringPtr(portalApprovalRecord) - return _options -} + // Offering identification. + OfferingID *string `json:"offering_id" validate:"required,ne="` -// SetPortalUIURL : Allow user to set PortalUIURL -func (_options *ReplaceOfferingOptions) SetPortalUIURL(portalUIURL string) *ReplaceOfferingOptions { - _options.PortalUIURL = core.StringPtr(portalUIURL) - return _options + // Tags array. + Tags []string `json:"tags,omitempty"` + + // Byte array representing the content to be imported. Only supported for OVA images at this time. + Content *[]byte `json:"content,omitempty"` + + // Name of version. Required for virtual server image for VPC. + Name *string `json:"name,omitempty"` + + // Display name of version. Required for virtual server image for VPC. + Label *string `json:"label,omitempty"` + + // Install type. Example: instance. Required for virtual server image for VPC. + InstallKind *string `json:"install_kind,omitempty"` + + // Deployment target of the content being onboarded. Current valid values are iks, roks, vcenter, power-iaas, + // terraform, and vpc-x86. Required for virtual server image for VPC. + TargetKinds []string `json:"target_kinds,omitempty"` + + // Format of content being onboarded. Example: vsi-image. Required for virtual server image for VPC. + FormatKind *string `json:"format_kind,omitempty"` + + // Optional product kind for the software being onboarded. Valid values are software, module, or solution. Default + // value is software. + ProductKind *string `json:"product_kind,omitempty"` + + // SHA256 fingerprint of the image file. Required for virtual server image for VPC. + Sha *string `json:"sha,omitempty"` + + // Semantic version of the software being onboarded. Required for virtual server image for VPC. + Version *string `json:"version,omitempty"` + + // Version Flavor Information. Only supported for Product kind Solution. + Flavor *Flavor `json:"flavor,omitempty"` + + // Generic data to be included with content being onboarded. Required for virtual server image for VPC. + Metadata *ImportOfferingBodyMetadata `json:"metadata,omitempty"` + + // Optional - The sub-folder within the specified tgz file that contains the software being onboarded. + WorkingDirectory *string `json:"working_directory,omitempty"` + + // URL path to zip location. If not specified, must provide content in the body of this call. + Zipurl *string `json:"zipurl,omitempty"` + + // The semver value for this new version, if not found in the zip url package content. + TargetVersion *string `json:"targetVersion,omitempty"` + + // Add all possible configuration values to this version when importing. + IncludeConfig *bool `json:"includeConfig,omitempty"` + + // Indicates that the current terraform template is used to install a virtual server image. + IsVsi *bool `json:"isVSI,omitempty"` + + // The type of repository containing this version. Valid values are 'public_git' or 'enterprise_git'. + Repotype *string `json:"repotype,omitempty"` + + // Authentication token used to access the specified zip file. + XAuthToken *string `json:"X-Auth-Token,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string } -// SetCatalogID : Allow user to set CatalogID -func (_options *ReplaceOfferingOptions) SetCatalogID(catalogID string) *ReplaceOfferingOptions { - _options.CatalogID = core.StringPtr(catalogID) - return _options +// NewImportOfferingVersionOptions : Instantiate ImportOfferingVersionOptions +func (*CatalogManagementV1) NewImportOfferingVersionOptions(catalogIdentifier string, offeringID string) *ImportOfferingVersionOptions { + return &ImportOfferingVersionOptions{ + CatalogIdentifier: core.StringPtr(catalogIdentifier), + OfferingID: core.StringPtr(offeringID), + } } -// SetCatalogName : Allow user to set CatalogName -func (_options *ReplaceOfferingOptions) SetCatalogName(catalogName string) *ReplaceOfferingOptions { - _options.CatalogName = core.StringPtr(catalogName) +// SetCatalogIdentifier : Allow user to set CatalogIdentifier +func (_options *ImportOfferingVersionOptions) SetCatalogIdentifier(catalogIdentifier string) *ImportOfferingVersionOptions { + _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) return _options } -// SetMetadata : Allow user to set Metadata -func (_options *ReplaceOfferingOptions) SetMetadata(metadata map[string]interface{}) *ReplaceOfferingOptions { - _options.Metadata = metadata +// SetOfferingID : Allow user to set OfferingID +func (_options *ImportOfferingVersionOptions) SetOfferingID(offeringID string) *ImportOfferingVersionOptions { + _options.OfferingID = core.StringPtr(offeringID) return _options } -// SetDisclaimer : Allow user to set Disclaimer -func (_options *ReplaceOfferingOptions) SetDisclaimer(disclaimer string) *ReplaceOfferingOptions { - _options.Disclaimer = core.StringPtr(disclaimer) +// SetTags : Allow user to set Tags +func (_options *ImportOfferingVersionOptions) SetTags(tags []string) *ImportOfferingVersionOptions { + _options.Tags = tags return _options } -// SetHidden : Allow user to set Hidden -func (_options *ReplaceOfferingOptions) SetHidden(hidden bool) *ReplaceOfferingOptions { - _options.Hidden = core.BoolPtr(hidden) +// SetContent : Allow user to set Content +func (_options *ImportOfferingVersionOptions) SetContent(content []byte) *ImportOfferingVersionOptions { + _options.Content = &content return _options } -// SetProvider : Allow user to set Provider -func (_options *ReplaceOfferingOptions) SetProvider(provider string) *ReplaceOfferingOptions { - _options.Provider = core.StringPtr(provider) +// SetName : Allow user to set Name +func (_options *ImportOfferingVersionOptions) SetName(name string) *ImportOfferingVersionOptions { + _options.Name = core.StringPtr(name) return _options } -// SetProviderInfo : Allow user to set ProviderInfo -func (_options *ReplaceOfferingOptions) SetProviderInfo(providerInfo *ProviderInfo) *ReplaceOfferingOptions { - _options.ProviderInfo = providerInfo +// SetLabel : Allow user to set Label +func (_options *ImportOfferingVersionOptions) SetLabel(label string) *ImportOfferingVersionOptions { + _options.Label = core.StringPtr(label) return _options } -// SetRepoInfo : Allow user to set RepoInfo -func (_options *ReplaceOfferingOptions) SetRepoInfo(repoInfo *RepoInfo) *ReplaceOfferingOptions { - _options.RepoInfo = repoInfo +// SetInstallKind : Allow user to set InstallKind +func (_options *ImportOfferingVersionOptions) SetInstallKind(installKind string) *ImportOfferingVersionOptions { + _options.InstallKind = core.StringPtr(installKind) return _options } -// SetSupport : Allow user to set Support -func (_options *ReplaceOfferingOptions) SetSupport(support *Support) *ReplaceOfferingOptions { - _options.Support = support +// SetTargetKinds : Allow user to set TargetKinds +func (_options *ImportOfferingVersionOptions) SetTargetKinds(targetKinds []string) *ImportOfferingVersionOptions { + _options.TargetKinds = targetKinds return _options } -// SetMedia : Allow user to set Media -func (_options *ReplaceOfferingOptions) SetMedia(media []MediaItem) *ReplaceOfferingOptions { - _options.Media = media +// SetFormatKind : Allow user to set FormatKind +func (_options *ImportOfferingVersionOptions) SetFormatKind(formatKind string) *ImportOfferingVersionOptions { + _options.FormatKind = core.StringPtr(formatKind) return _options } -// SetHeaders : Allow user to set Headers -func (options *ReplaceOfferingOptions) SetHeaders(param map[string]string) *ReplaceOfferingOptions { - options.Headers = param - return options +// SetProductKind : Allow user to set ProductKind +func (_options *ImportOfferingVersionOptions) SetProductKind(productKind string) *ImportOfferingVersionOptions { + _options.ProductKind = core.StringPtr(productKind) + return _options } -// ReplaceOperatorsOptions : The ReplaceOperators options. -type ReplaceOperatorsOptions struct { - // IAM Refresh token. - XAuthRefreshToken *string `json:"X-Auth-Refresh-Token" validate:"required"` - - // Cluster ID. - ClusterID *string `json:"cluster_id,omitempty"` - - // Cluster region. - Region *string `json:"region,omitempty"` - - // Kube namespaces to deploy Operator(s) to. - Namespaces []string `json:"namespaces,omitempty"` +// SetSha : Allow user to set Sha +func (_options *ImportOfferingVersionOptions) SetSha(sha string) *ImportOfferingVersionOptions { + _options.Sha = core.StringPtr(sha) + return _options +} - // Denotes whether to install Operator(s) globally. - AllNamespaces *bool `json:"all_namespaces,omitempty"` +// SetVersion : Allow user to set Version +func (_options *ImportOfferingVersionOptions) SetVersion(version string) *ImportOfferingVersionOptions { + _options.Version = core.StringPtr(version) + return _options +} - // A dotted value of `catalogID`.`versionID`. - VersionLocatorID *string `json:"version_locator_id,omitempty"` +// SetFlavor : Allow user to set Flavor +func (_options *ImportOfferingVersionOptions) SetFlavor(flavor *Flavor) *ImportOfferingVersionOptions { + _options.Flavor = flavor + return _options +} - // Allows users to set headers on API requests - Headers map[string]string +// SetMetadata : Allow user to set Metadata +func (_options *ImportOfferingVersionOptions) SetMetadata(metadata *ImportOfferingBodyMetadata) *ImportOfferingVersionOptions { + _options.Metadata = metadata + return _options } -// NewReplaceOperatorsOptions : Instantiate ReplaceOperatorsOptions -func (*CatalogManagementV1) NewReplaceOperatorsOptions(xAuthRefreshToken string) *ReplaceOperatorsOptions { - return &ReplaceOperatorsOptions{ - XAuthRefreshToken: core.StringPtr(xAuthRefreshToken), - } +// SetWorkingDirectory : Allow user to set WorkingDirectory +func (_options *ImportOfferingVersionOptions) SetWorkingDirectory(workingDirectory string) *ImportOfferingVersionOptions { + _options.WorkingDirectory = core.StringPtr(workingDirectory) + return _options } -// SetXAuthRefreshToken : Allow user to set XAuthRefreshToken -func (_options *ReplaceOperatorsOptions) SetXAuthRefreshToken(xAuthRefreshToken string) *ReplaceOperatorsOptions { - _options.XAuthRefreshToken = core.StringPtr(xAuthRefreshToken) +// SetZipurl : Allow user to set Zipurl +func (_options *ImportOfferingVersionOptions) SetZipurl(zipurl string) *ImportOfferingVersionOptions { + _options.Zipurl = core.StringPtr(zipurl) return _options } -// SetClusterID : Allow user to set ClusterID -func (_options *ReplaceOperatorsOptions) SetClusterID(clusterID string) *ReplaceOperatorsOptions { - _options.ClusterID = core.StringPtr(clusterID) +// SetTargetVersion : Allow user to set TargetVersion +func (_options *ImportOfferingVersionOptions) SetTargetVersion(targetVersion string) *ImportOfferingVersionOptions { + _options.TargetVersion = core.StringPtr(targetVersion) return _options } -// SetRegion : Allow user to set Region -func (_options *ReplaceOperatorsOptions) SetRegion(region string) *ReplaceOperatorsOptions { - _options.Region = core.StringPtr(region) +// SetIncludeConfig : Allow user to set IncludeConfig +func (_options *ImportOfferingVersionOptions) SetIncludeConfig(includeConfig bool) *ImportOfferingVersionOptions { + _options.IncludeConfig = core.BoolPtr(includeConfig) return _options } -// SetNamespaces : Allow user to set Namespaces -func (_options *ReplaceOperatorsOptions) SetNamespaces(namespaces []string) *ReplaceOperatorsOptions { - _options.Namespaces = namespaces +// SetIsVsi : Allow user to set IsVsi +func (_options *ImportOfferingVersionOptions) SetIsVsi(isVsi bool) *ImportOfferingVersionOptions { + _options.IsVsi = core.BoolPtr(isVsi) return _options } -// SetAllNamespaces : Allow user to set AllNamespaces -func (_options *ReplaceOperatorsOptions) SetAllNamespaces(allNamespaces bool) *ReplaceOperatorsOptions { - _options.AllNamespaces = core.BoolPtr(allNamespaces) +// SetRepotype : Allow user to set Repotype +func (_options *ImportOfferingVersionOptions) SetRepotype(repotype string) *ImportOfferingVersionOptions { + _options.Repotype = core.StringPtr(repotype) return _options } -// SetVersionLocatorID : Allow user to set VersionLocatorID -func (_options *ReplaceOperatorsOptions) SetVersionLocatorID(versionLocatorID string) *ReplaceOperatorsOptions { - _options.VersionLocatorID = core.StringPtr(versionLocatorID) +// SetXAuthToken : Allow user to set XAuthToken +func (_options *ImportOfferingVersionOptions) SetXAuthToken(xAuthToken string) *ImportOfferingVersionOptions { + _options.XAuthToken = core.StringPtr(xAuthToken) return _options } // SetHeaders : Allow user to set Headers -func (options *ReplaceOperatorsOptions) SetHeaders(param map[string]string) *ReplaceOperatorsOptions { +func (options *ImportOfferingVersionOptions) SetHeaders(param map[string]string) *ImportOfferingVersionOptions { options.Headers = param return options } -// RepoInfo : Repository info for offerings. -type RepoInfo struct { - // Token for private repos. - Token *string `json:"token,omitempty"` +// InstallStatus : Installation status. +type InstallStatus struct { + // Installation status metadata. + Metadata *InstallStatusMetadata `json:"metadata,omitempty"` - // Public or enterprise GitHub. - Type *string `json:"type,omitempty"` + // Release information. + Release *InstallStatusRelease `json:"release,omitempty"` + + // Content management information. + ContentMgmt *InstallStatusContentMgmt `json:"content_mgmt,omitempty"` } -// UnmarshalRepoInfo unmarshals an instance of RepoInfo from the specified map of raw messages. -func UnmarshalRepoInfo(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RepoInfo) - err = core.UnmarshalPrimitive(m, "token", &obj.Token) +// UnmarshalInstallStatus unmarshals an instance of InstallStatus from the specified map of raw messages. +func UnmarshalInstallStatus(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstallStatus) + err = core.UnmarshalModel(m, "metadata", &obj.Metadata, UnmarshalInstallStatusMetadata) if err != nil { return } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) + err = core.UnmarshalModel(m, "release", &obj.Release, UnmarshalInstallStatusRelease) + if err != nil { + return + } + err = core.UnmarshalModel(m, "content_mgmt", &obj.ContentMgmt, UnmarshalInstallStatusContentMgmt) if err != nil { return } @@ -12734,33 +13328,23 @@ func UnmarshalRepoInfo(m map[string]json.RawMessage, result interface{}) (err er return } -// Resource : Resource requirements. -type Resource struct { - // Type of requirement. - Type *string `json:"type,omitempty"` +// InstallStatusContentMgmt : Content management information. +type InstallStatusContentMgmt struct { + // Pods. + Pods []map[string]string `json:"pods,omitempty"` - // mem, disk, cores, and nodes can be parsed as an int. targetVersion will be a semver range value. - Value interface{} `json:"value,omitempty"` + // Errors. + Errors []map[string]string `json:"errors,omitempty"` } -// Constants associated with the Resource.Type property. -// Type of requirement. -const ( - ResourceTypeCoresConst = "cores" - ResourceTypeDiskConst = "disk" - ResourceTypeMemConst = "mem" - ResourceTypeNodesConst = "nodes" - ResourceTypeTargetversionConst = "targetVersion" -) - -// UnmarshalResource unmarshals an instance of Resource from the specified map of raw messages. -func UnmarshalResource(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(Resource) - err = core.UnmarshalPrimitive(m, "type", &obj.Type) +// UnmarshalInstallStatusContentMgmt unmarshals an instance of InstallStatusContentMgmt from the specified map of raw messages. +func UnmarshalInstallStatusContentMgmt(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstallStatusContentMgmt) + err = core.UnmarshalPrimitive(m, "pods", &obj.Pods) if err != nil { return } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) + err = core.UnmarshalPrimitive(m, "errors", &obj.Errors) if err != nil { return } @@ -12768,45 +13352,44 @@ func UnmarshalResource(m map[string]json.RawMessage, result interface{}) (err er return } -// Script : Script information. -type Script struct { - // Instruction on step and by whom (role) that are needed to take place to prepare the target for installing this - // version. - Instructions *string `json:"instructions,omitempty"` - - // Optional script that needs to be run post any pre-condition script. - Script *string `json:"script,omitempty"` +// InstallStatusMetadata : Installation status metadata. +type InstallStatusMetadata struct { + // Cluster ID. + ClusterID *string `json:"cluster_id,omitempty"` - // Optional iam permissions that are required on the target cluster to run this script. - ScriptPermission *string `json:"script_permission,omitempty"` + // Cluster region. + Region *string `json:"region,omitempty"` - // Optional script that if run will remove the installed version. - DeleteScript *string `json:"delete_script,omitempty"` + // Cluster namespace. + Namespace *string `json:"namespace,omitempty"` - // Optional value indicating if this script is scoped to a namespace or the entire cluster. - Scope *string `json:"scope,omitempty"` + // Workspace ID. + WorkspaceID *string `json:"workspace_id,omitempty"` + + // Workspace name. + WorkspaceName *string `json:"workspace_name,omitempty"` } -// UnmarshalScript unmarshals an instance of Script from the specified map of raw messages. -func UnmarshalScript(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(Script) - err = core.UnmarshalPrimitive(m, "instructions", &obj.Instructions) +// UnmarshalInstallStatusMetadata unmarshals an instance of InstallStatusMetadata from the specified map of raw messages. +func UnmarshalInstallStatusMetadata(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstallStatusMetadata) + err = core.UnmarshalPrimitive(m, "cluster_id", &obj.ClusterID) if err != nil { return } - err = core.UnmarshalPrimitive(m, "script", &obj.Script) + err = core.UnmarshalPrimitive(m, "region", &obj.Region) if err != nil { return } - err = core.UnmarshalPrimitive(m, "script_permission", &obj.ScriptPermission) + err = core.UnmarshalPrimitive(m, "namespace", &obj.Namespace) if err != nil { return } - err = core.UnmarshalPrimitive(m, "delete_script", &obj.DeleteScript) + err = core.UnmarshalPrimitive(m, "workspace_id", &obj.WorkspaceID) if err != nil { return } - err = core.UnmarshalPrimitive(m, "scope", &obj.Scope) + err = core.UnmarshalPrimitive(m, "workspace_name", &obj.WorkspaceName) if err != nil { return } @@ -12814,209 +13397,276 @@ func UnmarshalScript(m map[string]json.RawMessage, result interface{}) (err erro return } -// SearchObjectsOptions : The SearchObjects options. -type SearchObjectsOptions struct { - // Lucene query string. - Query *string `json:"query" validate:"required"` - - // The maximum number of results to return. - Limit *int64 `json:"limit,omitempty"` +// InstallStatusRelease : Release information. +type InstallStatusRelease struct { + // Kube deployments. + Deployments []map[string]interface{} `json:"deployments,omitempty"` - // The number of results to skip before returning values. - Offset *int64 `json:"offset,omitempty"` + // Kube replica sets. + Replicasets []map[string]interface{} `json:"replicasets,omitempty"` - // When true, hide private objects that correspond to public or IBM published objects. - Collapse *bool `json:"collapse,omitempty"` + // Kube stateful sets. + Statefulsets []map[string]interface{} `json:"statefulsets,omitempty"` - // Display a digests of search results, has default value of true. - Digest *bool `json:"digest,omitempty"` + // Kube pods. + Pods []map[string]interface{} `json:"pods,omitempty"` - // Allows users to set headers on API requests - Headers map[string]string + // Kube errors. + Errors []map[string]string `json:"errors,omitempty"` } -// NewSearchObjectsOptions : Instantiate SearchObjectsOptions -func (*CatalogManagementV1) NewSearchObjectsOptions(query string) *SearchObjectsOptions { - return &SearchObjectsOptions{ - Query: core.StringPtr(query), +// UnmarshalInstallStatusRelease unmarshals an instance of InstallStatusRelease from the specified map of raw messages. +func UnmarshalInstallStatusRelease(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstallStatusRelease) + err = core.UnmarshalPrimitive(m, "deployments", &obj.Deployments) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "replicasets", &obj.Replicasets) + if err != nil { + return } + err = core.UnmarshalPrimitive(m, "statefulsets", &obj.Statefulsets) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "pods", &obj.Pods) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "errors", &obj.Errors) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// SetQuery : Allow user to set Query -func (_options *SearchObjectsOptions) SetQuery(query string) *SearchObjectsOptions { - _options.Query = core.StringPtr(query) - return _options -} +// InstallVersionOptions : The InstallVersion options. +type InstallVersionOptions struct { + // A dotted value of `catalogID`.`versionID`. + VersionLocID *string `json:"version_loc_id" validate:"required,ne="` -// SetLimit : Allow user to set Limit -func (_options *SearchObjectsOptions) SetLimit(limit int64) *SearchObjectsOptions { - _options.Limit = core.Int64Ptr(limit) - return _options -} + // IAM Refresh token. + XAuthRefreshToken *string `json:"X-Auth-Refresh-Token" validate:"required"` -// SetOffset : Allow user to set Offset -func (_options *SearchObjectsOptions) SetOffset(offset int64) *SearchObjectsOptions { - _options.Offset = core.Int64Ptr(offset) - return _options -} + // Cluster ID. + ClusterID *string `json:"cluster_id,omitempty"` -// SetCollapse : Allow user to set Collapse -func (_options *SearchObjectsOptions) SetCollapse(collapse bool) *SearchObjectsOptions { - _options.Collapse = core.BoolPtr(collapse) - return _options -} + // Cluster region. + Region *string `json:"region,omitempty"` -// SetDigest : Allow user to set Digest -func (_options *SearchObjectsOptions) SetDigest(digest bool) *SearchObjectsOptions { - _options.Digest = core.BoolPtr(digest) - return _options -} + // Kube namespace. + Namespace *string `json:"namespace,omitempty"` -// SetHeaders : Allow user to set Headers -func (options *SearchObjectsOptions) SetHeaders(param map[string]string) *SearchObjectsOptions { - options.Headers = param - return options -} + // Validation override values. Required for virtual server image for VPC. + OverrideValues *DeployRequestBodyOverrideValues `json:"override_values,omitempty"` + + // Schematics environment variables to use with this workspace. + EnvironmentVariables []DeployRequestBodyEnvironmentVariablesItem `json:"environment_variables,omitempty"` + + // Entitlement API Key for this offering. + EntitlementApikey *string `json:"entitlement_apikey,omitempty"` + + // Schematics workspace configuration. + Schematics *DeployRequestBodySchematics `json:"schematics,omitempty"` + + // Script. + Script *string `json:"script,omitempty"` + + // Script ID. + ScriptID *string `json:"script_id,omitempty"` -// SetDeprecateVersionOptions : The SetDeprecateVersion options. -type SetDeprecateVersionOptions struct { // A dotted value of `catalogID`.`versionID`. - VersionLocID *string `json:"version_loc_id" validate:"required,ne="` + VersionLocatorID *string `json:"version_locator_id,omitempty"` - // Set deprecation (true) or cancel deprecation (false). - Setting *string `json:"setting" validate:"required,ne="` + // VCenter ID. + VcenterID *string `json:"vcenter_id,omitempty"` - // Additional information that users can provide to be displayed in deprecation notification. - Description *string `json:"description,omitempty"` + // VCenter Location. + VcenterLocation *string `json:"vcenter_location,omitempty"` - // Specifies the amount of days until product is not available in catalog. - DaysUntilDeprecate *int64 `json:"days_until_deprecate,omitempty"` + // VCenter User. + VcenterUser *string `json:"vcenter_user,omitempty"` + + // VCenter Password. + VcenterPassword *string `json:"vcenter_password,omitempty"` + + // VCenter Datastore. + VcenterDatastore *string `json:"vcenter_datastore,omitempty"` // Allows users to set headers on API requests Headers map[string]string } -// Constants associated with the SetDeprecateVersionOptions.Setting property. -// Set deprecation (true) or cancel deprecation (false). -const ( - SetDeprecateVersionOptionsSettingFalseConst = "false" - SetDeprecateVersionOptionsSettingTrueConst = "true" -) - -// NewSetDeprecateVersionOptions : Instantiate SetDeprecateVersionOptions -func (*CatalogManagementV1) NewSetDeprecateVersionOptions(versionLocID string, setting string) *SetDeprecateVersionOptions { - return &SetDeprecateVersionOptions{ +// NewInstallVersionOptions : Instantiate InstallVersionOptions +func (*CatalogManagementV1) NewInstallVersionOptions(versionLocID string, xAuthRefreshToken string) *InstallVersionOptions { + return &InstallVersionOptions{ VersionLocID: core.StringPtr(versionLocID), - Setting: core.StringPtr(setting), + XAuthRefreshToken: core.StringPtr(xAuthRefreshToken), } } // SetVersionLocID : Allow user to set VersionLocID -func (_options *SetDeprecateVersionOptions) SetVersionLocID(versionLocID string) *SetDeprecateVersionOptions { +func (_options *InstallVersionOptions) SetVersionLocID(versionLocID string) *InstallVersionOptions { _options.VersionLocID = core.StringPtr(versionLocID) return _options } -// SetSetting : Allow user to set Setting -func (_options *SetDeprecateVersionOptions) SetSetting(setting string) *SetDeprecateVersionOptions { - _options.Setting = core.StringPtr(setting) +// SetXAuthRefreshToken : Allow user to set XAuthRefreshToken +func (_options *InstallVersionOptions) SetXAuthRefreshToken(xAuthRefreshToken string) *InstallVersionOptions { + _options.XAuthRefreshToken = core.StringPtr(xAuthRefreshToken) return _options } -// SetDescription : Allow user to set Description -func (_options *SetDeprecateVersionOptions) SetDescription(description string) *SetDeprecateVersionOptions { - _options.Description = core.StringPtr(description) +// SetClusterID : Allow user to set ClusterID +func (_options *InstallVersionOptions) SetClusterID(clusterID string) *InstallVersionOptions { + _options.ClusterID = core.StringPtr(clusterID) return _options } -// SetDaysUntilDeprecate : Allow user to set DaysUntilDeprecate -func (_options *SetDeprecateVersionOptions) SetDaysUntilDeprecate(daysUntilDeprecate int64) *SetDeprecateVersionOptions { - _options.DaysUntilDeprecate = core.Int64Ptr(daysUntilDeprecate) +// SetRegion : Allow user to set Region +func (_options *InstallVersionOptions) SetRegion(region string) *InstallVersionOptions { + _options.Region = core.StringPtr(region) return _options } -// SetHeaders : Allow user to set Headers -func (options *SetDeprecateVersionOptions) SetHeaders(param map[string]string) *SetDeprecateVersionOptions { - options.Headers = param - return options +// SetNamespace : Allow user to set Namespace +func (_options *InstallVersionOptions) SetNamespace(namespace string) *InstallVersionOptions { + _options.Namespace = core.StringPtr(namespace) + return _options } -// SharedPublishObjectOptions : The SharedPublishObject options. -type SharedPublishObjectOptions struct { - // Catalog identifier. - CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` +// SetOverrideValues : Allow user to set OverrideValues +func (_options *InstallVersionOptions) SetOverrideValues(overrideValues *DeployRequestBodyOverrideValues) *InstallVersionOptions { + _options.OverrideValues = overrideValues + return _options +} - // Object identifier. - ObjectIdentifier *string `json:"object_identifier" validate:"required,ne="` +// SetEnvironmentVariables : Allow user to set EnvironmentVariables +func (_options *InstallVersionOptions) SetEnvironmentVariables(environmentVariables []DeployRequestBodyEnvironmentVariablesItem) *InstallVersionOptions { + _options.EnvironmentVariables = environmentVariables + return _options +} - // Allows users to set headers on API requests - Headers map[string]string +// SetEntitlementApikey : Allow user to set EntitlementApikey +func (_options *InstallVersionOptions) SetEntitlementApikey(entitlementApikey string) *InstallVersionOptions { + _options.EntitlementApikey = core.StringPtr(entitlementApikey) + return _options } -// NewSharedPublishObjectOptions : Instantiate SharedPublishObjectOptions -func (*CatalogManagementV1) NewSharedPublishObjectOptions(catalogIdentifier string, objectIdentifier string) *SharedPublishObjectOptions { - return &SharedPublishObjectOptions{ - CatalogIdentifier: core.StringPtr(catalogIdentifier), - ObjectIdentifier: core.StringPtr(objectIdentifier), - } +// SetSchematics : Allow user to set Schematics +func (_options *InstallVersionOptions) SetSchematics(schematics *DeployRequestBodySchematics) *InstallVersionOptions { + _options.Schematics = schematics + return _options } -// SetCatalogIdentifier : Allow user to set CatalogIdentifier -func (_options *SharedPublishObjectOptions) SetCatalogIdentifier(catalogIdentifier string) *SharedPublishObjectOptions { - _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) +// SetScript : Allow user to set Script +func (_options *InstallVersionOptions) SetScript(script string) *InstallVersionOptions { + _options.Script = core.StringPtr(script) return _options } -// SetObjectIdentifier : Allow user to set ObjectIdentifier -func (_options *SharedPublishObjectOptions) SetObjectIdentifier(objectIdentifier string) *SharedPublishObjectOptions { - _options.ObjectIdentifier = core.StringPtr(objectIdentifier) +// SetScriptID : Allow user to set ScriptID +func (_options *InstallVersionOptions) SetScriptID(scriptID string) *InstallVersionOptions { + _options.ScriptID = core.StringPtr(scriptID) return _options } -// SetHeaders : Allow user to set Headers -func (options *SharedPublishObjectOptions) SetHeaders(param map[string]string) *SharedPublishObjectOptions { - options.Headers = param - return options +// SetVersionLocatorID : Allow user to set VersionLocatorID +func (_options *InstallVersionOptions) SetVersionLocatorID(versionLocatorID string) *InstallVersionOptions { + _options.VersionLocatorID = core.StringPtr(versionLocatorID) + return _options } -// State : Offering state. -type State struct { - // one of: new, validated, account-published, ibm-published, public-published. - Current *string `json:"current,omitempty"` +// SetVcenterID : Allow user to set VcenterID +func (_options *InstallVersionOptions) SetVcenterID(vcenterID string) *InstallVersionOptions { + _options.VcenterID = core.StringPtr(vcenterID) + return _options +} - // Date and time of current request. - CurrentEntered *strfmt.DateTime `json:"current_entered,omitempty"` +// SetVcenterLocation : Allow user to set VcenterLocation +func (_options *InstallVersionOptions) SetVcenterLocation(vcenterLocation string) *InstallVersionOptions { + _options.VcenterLocation = core.StringPtr(vcenterLocation) + return _options +} - // one of: new, validated, account-published, ibm-published, public-published. - Pending *string `json:"pending,omitempty"` +// SetVcenterUser : Allow user to set VcenterUser +func (_options *InstallVersionOptions) SetVcenterUser(vcenterUser string) *InstallVersionOptions { + _options.VcenterUser = core.StringPtr(vcenterUser) + return _options +} - // Date and time of pending request. - PendingRequested *strfmt.DateTime `json:"pending_requested,omitempty"` +// SetVcenterPassword : Allow user to set VcenterPassword +func (_options *InstallVersionOptions) SetVcenterPassword(vcenterPassword string) *InstallVersionOptions { + _options.VcenterPassword = core.StringPtr(vcenterPassword) + return _options +} - // one of: new, validated, account-published, ibm-published, public-published. - Previous *string `json:"previous,omitempty"` +// SetVcenterDatastore : Allow user to set VcenterDatastore +func (_options *InstallVersionOptions) SetVcenterDatastore(vcenterDatastore string) *InstallVersionOptions { + _options.VcenterDatastore = core.StringPtr(vcenterDatastore) + return _options } -// UnmarshalState unmarshals an instance of State from the specified map of raw messages. -func UnmarshalState(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(State) - err = core.UnmarshalPrimitive(m, "current", &obj.Current) - if err != nil { - return +// SetHeaders : Allow user to set Headers +func (options *InstallVersionOptions) SetHeaders(param map[string]string) *InstallVersionOptions { + options.Headers = param + return options +} + +// JSONPatchOperation : A JSONPatch document as defined by RFC 6902. +type JSONPatchOperation struct { + // The operation to be performed. + Op *string `json:"op" validate:"required"` + + // A JSON-Pointer. + Path *string `json:"path" validate:"required"` + + // The value to be used within the operations. + Value interface{} `json:"value,omitempty"` + + // A string containing a JSON Pointer value. + From *string `json:"from,omitempty"` +} + +// Constants associated with the JSONPatchOperation.Op property. +// The operation to be performed. +const ( + JSONPatchOperationOpAddConst = "add" + JSONPatchOperationOpCopyConst = "copy" + JSONPatchOperationOpMoveConst = "move" + JSONPatchOperationOpRemoveConst = "remove" + JSONPatchOperationOpReplaceConst = "replace" + JSONPatchOperationOpTestConst = "test" +) + +// NewJSONPatchOperation : Instantiate JSONPatchOperation (Generic Model Constructor) +func (*CatalogManagementV1) NewJSONPatchOperation(op string, path string) (_model *JSONPatchOperation, err error) { + _model = &JSONPatchOperation{ + Op: core.StringPtr(op), + Path: core.StringPtr(path), } - err = core.UnmarshalPrimitive(m, "current_entered", &obj.CurrentEntered) + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalJSONPatchOperation unmarshals an instance of JSONPatchOperation from the specified map of raw messages. +func UnmarshalJSONPatchOperation(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(JSONPatchOperation) + err = core.UnmarshalPrimitive(m, "op", &obj.Op) if err != nil { return } - err = core.UnmarshalPrimitive(m, "pending", &obj.Pending) + err = core.UnmarshalPrimitive(m, "path", &obj.Path) if err != nil { return } - err = core.UnmarshalPrimitive(m, "pending_requested", &obj.PendingRequested) + err = core.UnmarshalPrimitive(m, "value", &obj.Value) if err != nil { return } - err = core.UnmarshalPrimitive(m, "previous", &obj.Previous) + err = core.UnmarshalPrimitive(m, "from", &obj.From) if err != nil { return } @@ -13024,113 +13674,86 @@ func UnmarshalState(m map[string]json.RawMessage, result interface{}) (err error return } -// Support : Offering Support information. -type Support struct { - // URL to be displayed in the Consumption UI for getting support on this offering. - URL *string `json:"url,omitempty"` +// Kind : Offering kind. +type Kind struct { + // Unique ID. + ID *string `json:"id,omitempty"` - // Support process as provided by an ISV. - Process *string `json:"process,omitempty"` + // content kind, e.g., helm, vm image. + FormatKind *string `json:"format_kind,omitempty"` - // A list of country codes indicating where support is provided. - Locations []string `json:"locations,omitempty"` + // install kind, e.g., helm, operator, terraform. + InstallKind *string `json:"install_kind,omitempty"` + + // target cloud to install, e.g., iks, open_shift_iks. + TargetKind *string `json:"target_kind,omitempty"` + + // Open ended metadata information. + Metadata map[string]interface{} `json:"metadata,omitempty"` + + // List of tags associated with this catalog. + Tags []string `json:"tags,omitempty"` + + // List of features associated with this offering. + AdditionalFeatures []Feature `json:"additional_features,omitempty"` + + // The date and time this catalog was created. + Created *strfmt.DateTime `json:"created,omitempty"` + + // The date and time this catalog was last updated. + Updated *strfmt.DateTime `json:"updated,omitempty"` + + // list of versions. + Versions []Version `json:"versions,omitempty"` + + // list of plans. + Plans []Plan `json:"plans,omitempty"` } -// UnmarshalSupport unmarshals an instance of Support from the specified map of raw messages. -func UnmarshalSupport(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(Support) - err = core.UnmarshalPrimitive(m, "url", &obj.URL) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "process", &obj.Process) +// UnmarshalKind unmarshals an instance of Kind from the specified map of raw messages. +func UnmarshalKind(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Kind) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } - err = core.UnmarshalPrimitive(m, "locations", &obj.Locations) + err = core.UnmarshalPrimitive(m, "format_kind", &obj.FormatKind) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SyndicationAuthorization : Feature information. -type SyndicationAuthorization struct { - // Array of syndicated namespaces. - Token *string `json:"token,omitempty"` - - // Date and time last updated. - LastRun *strfmt.DateTime `json:"last_run,omitempty"` -} - -// UnmarshalSyndicationAuthorization unmarshals an instance of SyndicationAuthorization from the specified map of raw messages. -func UnmarshalSyndicationAuthorization(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SyndicationAuthorization) - err = core.UnmarshalPrimitive(m, "token", &obj.Token) + err = core.UnmarshalPrimitive(m, "install_kind", &obj.InstallKind) if err != nil { return } - err = core.UnmarshalPrimitive(m, "last_run", &obj.LastRun) + err = core.UnmarshalPrimitive(m, "target_kind", &obj.TargetKind) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SyndicationCluster : Feature information. -type SyndicationCluster struct { - // Cluster region. - Region *string `json:"region,omitempty"` - - // Cluster ID. - ID *string `json:"id,omitempty"` - - // Cluster name. - Name *string `json:"name,omitempty"` - - // Resource group ID. - ResourceGroupName *string `json:"resource_group_name,omitempty"` - - // Syndication type. - Type *string `json:"type,omitempty"` - - // Syndicated namespaces. - Namespaces []string `json:"namespaces,omitempty"` - - // Syndicated to all namespaces on cluster. - AllNamespaces *bool `json:"all_namespaces,omitempty"` -} - -// UnmarshalSyndicationCluster unmarshals an instance of SyndicationCluster from the specified map of raw messages. -func UnmarshalSyndicationCluster(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SyndicationCluster) - err = core.UnmarshalPrimitive(m, "region", &obj.Region) + err = core.UnmarshalPrimitive(m, "metadata", &obj.Metadata) if err != nil { return } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) + err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) if err != nil { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalModel(m, "additional_features", &obj.AdditionalFeatures, UnmarshalFeature) if err != nil { return } - err = core.UnmarshalPrimitive(m, "resource_group_name", &obj.ResourceGroupName) + err = core.UnmarshalPrimitive(m, "created", &obj.Created) if err != nil { return } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) + err = core.UnmarshalPrimitive(m, "updated", &obj.Updated) if err != nil { return } - err = core.UnmarshalPrimitive(m, "namespaces", &obj.Namespaces) + err = core.UnmarshalModel(m, "versions", &obj.Versions, UnmarshalVersion) if err != nil { return } - err = core.UnmarshalPrimitive(m, "all_namespaces", &obj.AllNamespaces) + err = core.UnmarshalModel(m, "plans", &obj.Plans, UnmarshalPlan) if err != nil { return } @@ -13138,30 +13761,23 @@ func UnmarshalSyndicationCluster(m map[string]json.RawMessage, result interface{ return } -// SyndicationHistory : Feature information. -type SyndicationHistory struct { - // Array of syndicated namespaces. - Namespaces []string `json:"namespaces,omitempty"` - - // Array of syndicated namespaces. - Clusters []SyndicationCluster `json:"clusters,omitempty"` +// LearnMoreLinks : Learn more links for a badge. +type LearnMoreLinks struct { + // First party link. + FirstParty *string `json:"first_party,omitempty"` - // Date and time last syndicated. - LastRun *strfmt.DateTime `json:"last_run,omitempty"` + // Third party link. + ThirdParty *string `json:"third_party,omitempty"` } -// UnmarshalSyndicationHistory unmarshals an instance of SyndicationHistory from the specified map of raw messages. -func UnmarshalSyndicationHistory(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SyndicationHistory) - err = core.UnmarshalPrimitive(m, "namespaces", &obj.Namespaces) - if err != nil { - return - } - err = core.UnmarshalModel(m, "clusters", &obj.Clusters, UnmarshalSyndicationCluster) +// UnmarshalLearnMoreLinks unmarshals an instance of LearnMoreLinks from the specified map of raw messages. +func UnmarshalLearnMoreLinks(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LearnMoreLinks) + err = core.UnmarshalPrimitive(m, "first_party", &obj.FirstParty) if err != nil { return } - err = core.UnmarshalPrimitive(m, "last_run", &obj.LastRun) + err = core.UnmarshalPrimitive(m, "third_party", &obj.ThirdParty) if err != nil { return } @@ -13169,37 +13785,44 @@ func UnmarshalSyndicationHistory(m map[string]json.RawMessage, result interface{ return } -// SyndicationResource : Feature information. -type SyndicationResource struct { - // Remove related components. - RemoveRelatedComponents *bool `json:"remove_related_components,omitempty"` +// License : BSS license. +type License struct { + // License ID. + ID *string `json:"id,omitempty"` - // Syndication clusters. - Clusters []SyndicationCluster `json:"clusters,omitempty"` + // license name. + Name *string `json:"name,omitempty"` - // Feature information. - History *SyndicationHistory `json:"history,omitempty"` + // type of license e.g., Apache xxx. + Type *string `json:"type,omitempty"` - // Feature information. - Authorization *SyndicationAuthorization `json:"authorization,omitempty"` + // URL for the license text. + URL *string `json:"url,omitempty"` + + // License description. + Description *string `json:"description,omitempty"` } -// UnmarshalSyndicationResource unmarshals an instance of SyndicationResource from the specified map of raw messages. -func UnmarshalSyndicationResource(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SyndicationResource) - err = core.UnmarshalPrimitive(m, "remove_related_components", &obj.RemoveRelatedComponents) +// UnmarshalLicense unmarshals an instance of License from the specified map of raw messages. +func UnmarshalLicense(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(License) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } - err = core.UnmarshalModel(m, "clusters", &obj.Clusters, UnmarshalSyndicationCluster) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalModel(m, "history", &obj.History, UnmarshalSyndicationHistory) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { return } - err = core.UnmarshalModel(m, "authorization", &obj.Authorization, UnmarshalSyndicationAuthorization) + err = core.UnmarshalPrimitive(m, "url", &obj.URL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "description", &obj.Description) if err != nil { return } @@ -13207,384 +13830,5331 @@ func UnmarshalSyndicationResource(m map[string]json.RawMessage, result interface return } -// UpdateCatalogAccountOptions : The UpdateCatalogAccount options. -type UpdateCatalogAccountOptions struct { - // Account identification. - ID *string `json:"id,omitempty"` +// ListCatalogAccountAuditsOptions : The ListCatalogAccountAudits options. +type ListCatalogAccountAuditsOptions struct { + // Start token for a query. + Start *string `json:"start,omitempty"` - // Hide the public catalog in this account. - HideIBMCloudCatalog *bool `json:"hide_IBM_cloud_catalog,omitempty"` + // number or results to return in the query. + Limit *int64 `json:"limit,omitempty"` - // Filters for account and catalog filters. - AccountFilters *Filters `json:"account_filters,omitempty"` + // Auditlog Lookup Names - by default names are not returned in auditlog. + Lookupnames *bool `json:"lookupnames,omitempty"` // Allows users to set headers on API requests Headers map[string]string } -// NewUpdateCatalogAccountOptions : Instantiate UpdateCatalogAccountOptions -func (*CatalogManagementV1) NewUpdateCatalogAccountOptions() *UpdateCatalogAccountOptions { - return &UpdateCatalogAccountOptions{} +// NewListCatalogAccountAuditsOptions : Instantiate ListCatalogAccountAuditsOptions +func (*CatalogManagementV1) NewListCatalogAccountAuditsOptions() *ListCatalogAccountAuditsOptions { + return &ListCatalogAccountAuditsOptions{} } -// SetID : Allow user to set ID -func (_options *UpdateCatalogAccountOptions) SetID(id string) *UpdateCatalogAccountOptions { - _options.ID = core.StringPtr(id) +// SetStart : Allow user to set Start +func (_options *ListCatalogAccountAuditsOptions) SetStart(start string) *ListCatalogAccountAuditsOptions { + _options.Start = core.StringPtr(start) return _options } -// SetHideIBMCloudCatalog : Allow user to set HideIBMCloudCatalog -func (_options *UpdateCatalogAccountOptions) SetHideIBMCloudCatalog(hideIBMCloudCatalog bool) *UpdateCatalogAccountOptions { - _options.HideIBMCloudCatalog = core.BoolPtr(hideIBMCloudCatalog) +// SetLimit : Allow user to set Limit +func (_options *ListCatalogAccountAuditsOptions) SetLimit(limit int64) *ListCatalogAccountAuditsOptions { + _options.Limit = core.Int64Ptr(limit) return _options } -// SetAccountFilters : Allow user to set AccountFilters -func (_options *UpdateCatalogAccountOptions) SetAccountFilters(accountFilters *Filters) *UpdateCatalogAccountOptions { - _options.AccountFilters = accountFilters +// SetLookupnames : Allow user to set Lookupnames +func (_options *ListCatalogAccountAuditsOptions) SetLookupnames(lookupnames bool) *ListCatalogAccountAuditsOptions { + _options.Lookupnames = core.BoolPtr(lookupnames) return _options } // SetHeaders : Allow user to set Headers -func (options *UpdateCatalogAccountOptions) SetHeaders(param map[string]string) *UpdateCatalogAccountOptions { +func (options *ListCatalogAccountAuditsOptions) SetHeaders(param map[string]string) *ListCatalogAccountAuditsOptions { options.Headers = param return options } -// UpdateOfferingIBMOptions : The UpdateOfferingIBM options. -type UpdateOfferingIBMOptions struct { +// ListCatalogAuditsOptions : The ListCatalogAudits options. +type ListCatalogAuditsOptions struct { // Catalog identifier. CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` - // Offering identification. - OfferingID *string `json:"offering_id" validate:"required,ne="` + // Start token for a query. + Start *string `json:"start,omitempty"` - // Type of approval, ibm or public. - ApprovalType *string `json:"approval_type" validate:"required,ne="` + // number or results to return in the query. + Limit *int64 `json:"limit,omitempty"` - // Approve (true) or disapprove (false). - Approved *string `json:"approved" validate:"required,ne="` + // Auditlog Lookup Names - by default names are not returned in auditlog. + Lookupnames *bool `json:"lookupnames,omitempty"` // Allows users to set headers on API requests Headers map[string]string } -// Constants associated with the UpdateOfferingIBMOptions.ApprovalType property. -// Type of approval, ibm or public. -const ( - UpdateOfferingIBMOptionsApprovalTypeAllowRequestConst = "allow_request" - UpdateOfferingIBMOptionsApprovalTypeIBMConst = "ibm" - UpdateOfferingIBMOptionsApprovalTypePcManagedConst = "pc_managed" - UpdateOfferingIBMOptionsApprovalTypePublicConst = "public" -) - -// Constants associated with the UpdateOfferingIBMOptions.Approved property. -// Approve (true) or disapprove (false). -const ( - UpdateOfferingIBMOptionsApprovedFalseConst = "false" - UpdateOfferingIBMOptionsApprovedTrueConst = "true" -) - -// NewUpdateOfferingIBMOptions : Instantiate UpdateOfferingIBMOptions -func (*CatalogManagementV1) NewUpdateOfferingIBMOptions(catalogIdentifier string, offeringID string, approvalType string, approved string) *UpdateOfferingIBMOptions { - return &UpdateOfferingIBMOptions{ +// NewListCatalogAuditsOptions : Instantiate ListCatalogAuditsOptions +func (*CatalogManagementV1) NewListCatalogAuditsOptions(catalogIdentifier string) *ListCatalogAuditsOptions { + return &ListCatalogAuditsOptions{ CatalogIdentifier: core.StringPtr(catalogIdentifier), - OfferingID: core.StringPtr(offeringID), - ApprovalType: core.StringPtr(approvalType), - Approved: core.StringPtr(approved), } } // SetCatalogIdentifier : Allow user to set CatalogIdentifier -func (_options *UpdateOfferingIBMOptions) SetCatalogIdentifier(catalogIdentifier string) *UpdateOfferingIBMOptions { +func (_options *ListCatalogAuditsOptions) SetCatalogIdentifier(catalogIdentifier string) *ListCatalogAuditsOptions { _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) return _options } -// SetOfferingID : Allow user to set OfferingID -func (_options *UpdateOfferingIBMOptions) SetOfferingID(offeringID string) *UpdateOfferingIBMOptions { - _options.OfferingID = core.StringPtr(offeringID) +// SetStart : Allow user to set Start +func (_options *ListCatalogAuditsOptions) SetStart(start string) *ListCatalogAuditsOptions { + _options.Start = core.StringPtr(start) return _options } -// SetApprovalType : Allow user to set ApprovalType -func (_options *UpdateOfferingIBMOptions) SetApprovalType(approvalType string) *UpdateOfferingIBMOptions { - _options.ApprovalType = core.StringPtr(approvalType) +// SetLimit : Allow user to set Limit +func (_options *ListCatalogAuditsOptions) SetLimit(limit int64) *ListCatalogAuditsOptions { + _options.Limit = core.Int64Ptr(limit) return _options } -// SetApproved : Allow user to set Approved -func (_options *UpdateOfferingIBMOptions) SetApproved(approved string) *UpdateOfferingIBMOptions { - _options.Approved = core.StringPtr(approved) +// SetLookupnames : Allow user to set Lookupnames +func (_options *ListCatalogAuditsOptions) SetLookupnames(lookupnames bool) *ListCatalogAuditsOptions { + _options.Lookupnames = core.BoolPtr(lookupnames) return _options } // SetHeaders : Allow user to set Headers -func (options *UpdateOfferingIBMOptions) SetHeaders(param map[string]string) *UpdateOfferingIBMOptions { +func (options *ListCatalogAuditsOptions) SetHeaders(param map[string]string) *ListCatalogAuditsOptions { options.Headers = param return options } -// UpdateOfferingOptions : The UpdateOffering options. -type UpdateOfferingOptions struct { - // Catalog identifier. - CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` +// ListCatalogsOptions : The ListCatalogs options. +type ListCatalogsOptions struct { - // Offering identification. - OfferingID *string `json:"offering_id" validate:"required,ne="` + // Allows users to set headers on API requests + Headers map[string]string +} - // Offering etag contained in quotes. - IfMatch *string `json:"If-Match" validate:"required"` +// NewListCatalogsOptions : Instantiate ListCatalogsOptions +func (*CatalogManagementV1) NewListCatalogsOptions() *ListCatalogsOptions { + return &ListCatalogsOptions{} +} - // Array of patch operations as defined in RFC 6902. - Updates []JSONPatchOperation `json:"updates,omitempty"` +// SetHeaders : Allow user to set Headers +func (options *ListCatalogsOptions) SetHeaders(param map[string]string) *ListCatalogsOptions { + options.Headers = param + return options +} + +// ListEnterpriseAuditsOptions : The ListEnterpriseAudits options. +type ListEnterpriseAuditsOptions struct { + // Enterprise ID. + EnterpriseIdentifier *string `json:"enterprise_identifier" validate:"required,ne="` + + // Start token for a query. + Start *string `json:"start,omitempty"` + + // number or results to return in the query. + Limit *int64 `json:"limit,omitempty"` + + // Auditlog Lookup Names - by default names are not returned in auditlog. + Lookupnames *bool `json:"lookupnames,omitempty"` // Allows users to set headers on API requests Headers map[string]string } -// NewUpdateOfferingOptions : Instantiate UpdateOfferingOptions -func (*CatalogManagementV1) NewUpdateOfferingOptions(catalogIdentifier string, offeringID string, ifMatch string) *UpdateOfferingOptions { - return &UpdateOfferingOptions{ - CatalogIdentifier: core.StringPtr(catalogIdentifier), - OfferingID: core.StringPtr(offeringID), - IfMatch: core.StringPtr(ifMatch), +// NewListEnterpriseAuditsOptions : Instantiate ListEnterpriseAuditsOptions +func (*CatalogManagementV1) NewListEnterpriseAuditsOptions(enterpriseIdentifier string) *ListEnterpriseAuditsOptions { + return &ListEnterpriseAuditsOptions{ + EnterpriseIdentifier: core.StringPtr(enterpriseIdentifier), } } -// SetCatalogIdentifier : Allow user to set CatalogIdentifier -func (_options *UpdateOfferingOptions) SetCatalogIdentifier(catalogIdentifier string) *UpdateOfferingOptions { - _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) +// SetEnterpriseIdentifier : Allow user to set EnterpriseIdentifier +func (_options *ListEnterpriseAuditsOptions) SetEnterpriseIdentifier(enterpriseIdentifier string) *ListEnterpriseAuditsOptions { + _options.EnterpriseIdentifier = core.StringPtr(enterpriseIdentifier) return _options } -// SetOfferingID : Allow user to set OfferingID -func (_options *UpdateOfferingOptions) SetOfferingID(offeringID string) *UpdateOfferingOptions { - _options.OfferingID = core.StringPtr(offeringID) +// SetStart : Allow user to set Start +func (_options *ListEnterpriseAuditsOptions) SetStart(start string) *ListEnterpriseAuditsOptions { + _options.Start = core.StringPtr(start) return _options } -// SetIfMatch : Allow user to set IfMatch -func (_options *UpdateOfferingOptions) SetIfMatch(ifMatch string) *UpdateOfferingOptions { - _options.IfMatch = core.StringPtr(ifMatch) +// SetLimit : Allow user to set Limit +func (_options *ListEnterpriseAuditsOptions) SetLimit(limit int64) *ListEnterpriseAuditsOptions { + _options.Limit = core.Int64Ptr(limit) return _options } -// SetUpdates : Allow user to set Updates -func (_options *UpdateOfferingOptions) SetUpdates(updates []JSONPatchOperation) *UpdateOfferingOptions { - _options.Updates = updates +// SetLookupnames : Allow user to set Lookupnames +func (_options *ListEnterpriseAuditsOptions) SetLookupnames(lookupnames bool) *ListEnterpriseAuditsOptions { + _options.Lookupnames = core.BoolPtr(lookupnames) return _options } // SetHeaders : Allow user to set Headers -func (options *UpdateOfferingOptions) SetHeaders(param map[string]string) *UpdateOfferingOptions { +func (options *ListEnterpriseAuditsOptions) SetHeaders(param map[string]string) *ListEnterpriseAuditsOptions { options.Headers = param return options } -// ValidateInstallOptions : The ValidateInstall options. -type ValidateInstallOptions struct { - // A dotted value of `catalogID`.`versionID`. - VersionLocID *string `json:"version_loc_id" validate:"required,ne="` - - // IAM Refresh token. - XAuthRefreshToken *string `json:"X-Auth-Refresh-Token" validate:"required"` - - // Cluster ID. - ClusterID *string `json:"cluster_id,omitempty"` - - // Cluster region. - Region *string `json:"region,omitempty"` - - // Kube namespace. - Namespace *string `json:"namespace,omitempty"` - - // Object containing Helm chart override values. To use a secret for items of type password, specify a JSON encoded - // value of $ref:#/components/schemas/SecretInstance, prefixed with `cmsm_v1:`. - OverrideValues map[string]interface{} `json:"override_values,omitempty"` - - // Entitlement API Key for this offering. - EntitlementApikey *string `json:"entitlement_apikey,omitempty"` - - // Schematics workspace configuration. - Schematics *DeployRequestBodySchematics `json:"schematics,omitempty"` - - // Script. - Script *string `json:"script,omitempty"` - - // Script ID. - ScriptID *string `json:"script_id,omitempty"` - - // A dotted value of `catalogID`.`versionID`. - VersionLocatorID *string `json:"version_locator_id,omitempty"` - - // VCenter ID. - VcenterID *string `json:"vcenter_id,omitempty"` +// ListObjectAuditsOptions : The ListObjectAudits options. +type ListObjectAuditsOptions struct { + // Catalog identifier. + CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` - // VCenter User. - VcenterUser *string `json:"vcenter_user,omitempty"` + // Object identifier. + ObjectIdentifier *string `json:"object_identifier" validate:"required,ne="` - // VCenter Password. - VcenterPassword *string `json:"vcenter_password,omitempty"` + // Start token for a query. + Start *string `json:"start,omitempty"` - // VCenter Location. - VcenterLocation *string `json:"vcenter_location,omitempty"` + // number or results to return in the query. + Limit *int64 `json:"limit,omitempty"` - // VCenter Datastore. - VcenterDatastore *string `json:"vcenter_datastore,omitempty"` + // Auditlog Lookup Names - by default names are not returned in auditlog. + Lookupnames *bool `json:"lookupnames,omitempty"` // Allows users to set headers on API requests Headers map[string]string } -// NewValidateInstallOptions : Instantiate ValidateInstallOptions -func (*CatalogManagementV1) NewValidateInstallOptions(versionLocID string, xAuthRefreshToken string) *ValidateInstallOptions { - return &ValidateInstallOptions{ - VersionLocID: core.StringPtr(versionLocID), - XAuthRefreshToken: core.StringPtr(xAuthRefreshToken), +// NewListObjectAuditsOptions : Instantiate ListObjectAuditsOptions +func (*CatalogManagementV1) NewListObjectAuditsOptions(catalogIdentifier string, objectIdentifier string) *ListObjectAuditsOptions { + return &ListObjectAuditsOptions{ + CatalogIdentifier: core.StringPtr(catalogIdentifier), + ObjectIdentifier: core.StringPtr(objectIdentifier), } } -// SetVersionLocID : Allow user to set VersionLocID -func (_options *ValidateInstallOptions) SetVersionLocID(versionLocID string) *ValidateInstallOptions { - _options.VersionLocID = core.StringPtr(versionLocID) +// SetCatalogIdentifier : Allow user to set CatalogIdentifier +func (_options *ListObjectAuditsOptions) SetCatalogIdentifier(catalogIdentifier string) *ListObjectAuditsOptions { + _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) return _options } -// SetXAuthRefreshToken : Allow user to set XAuthRefreshToken -func (_options *ValidateInstallOptions) SetXAuthRefreshToken(xAuthRefreshToken string) *ValidateInstallOptions { - _options.XAuthRefreshToken = core.StringPtr(xAuthRefreshToken) +// SetObjectIdentifier : Allow user to set ObjectIdentifier +func (_options *ListObjectAuditsOptions) SetObjectIdentifier(objectIdentifier string) *ListObjectAuditsOptions { + _options.ObjectIdentifier = core.StringPtr(objectIdentifier) return _options } -// SetClusterID : Allow user to set ClusterID -func (_options *ValidateInstallOptions) SetClusterID(clusterID string) *ValidateInstallOptions { - _options.ClusterID = core.StringPtr(clusterID) +// SetStart : Allow user to set Start +func (_options *ListObjectAuditsOptions) SetStart(start string) *ListObjectAuditsOptions { + _options.Start = core.StringPtr(start) return _options } -// SetRegion : Allow user to set Region -func (_options *ValidateInstallOptions) SetRegion(region string) *ValidateInstallOptions { - _options.Region = core.StringPtr(region) +// SetLimit : Allow user to set Limit +func (_options *ListObjectAuditsOptions) SetLimit(limit int64) *ListObjectAuditsOptions { + _options.Limit = core.Int64Ptr(limit) return _options } -// SetNamespace : Allow user to set Namespace -func (_options *ValidateInstallOptions) SetNamespace(namespace string) *ValidateInstallOptions { - _options.Namespace = core.StringPtr(namespace) +// SetLookupnames : Allow user to set Lookupnames +func (_options *ListObjectAuditsOptions) SetLookupnames(lookupnames bool) *ListObjectAuditsOptions { + _options.Lookupnames = core.BoolPtr(lookupnames) return _options } -// SetOverrideValues : Allow user to set OverrideValues -func (_options *ValidateInstallOptions) SetOverrideValues(overrideValues map[string]interface{}) *ValidateInstallOptions { - _options.OverrideValues = overrideValues - return _options +// SetHeaders : Allow user to set Headers +func (options *ListObjectAuditsOptions) SetHeaders(param map[string]string) *ListObjectAuditsOptions { + options.Headers = param + return options } -// SetEntitlementApikey : Allow user to set EntitlementApikey -func (_options *ValidateInstallOptions) SetEntitlementApikey(entitlementApikey string) *ValidateInstallOptions { - _options.EntitlementApikey = core.StringPtr(entitlementApikey) - return _options -} +// ListObjectsOptions : The ListObjects options. +type ListObjectsOptions struct { + // Catalog identifier. + CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` -// SetSchematics : Allow user to set Schematics -func (_options *ValidateInstallOptions) SetSchematics(schematics *DeployRequestBodySchematics) *ValidateInstallOptions { - _options.Schematics = schematics - return _options -} + // The number of results to return. + Limit *int64 `json:"limit,omitempty"` -// SetScript : Allow user to set Script -func (_options *ValidateInstallOptions) SetScript(script string) *ValidateInstallOptions { - _options.Script = core.StringPtr(script) - return _options -} + // The number of results to skip before returning values. + Offset *int64 `json:"offset,omitempty"` -// SetScriptID : Allow user to set ScriptID -func (_options *ValidateInstallOptions) SetScriptID(scriptID string) *ValidateInstallOptions { - _options.ScriptID = core.StringPtr(scriptID) - return _options + // Only return results that contain the specified string. + Name *string `json:"name,omitempty"` + + // The field on which the output is sorted. Sorts by default by **label** property. Available fields are **name**, + // **label**, **created**, and **updated**. By adding **-** (i.e. **-label**) in front of the query string, you can + // specify descending order. Default is ascending order. + Sort *string `json:"sort,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string } -// SetVersionLocatorID : Allow user to set VersionLocatorID -func (_options *ValidateInstallOptions) SetVersionLocatorID(versionLocatorID string) *ValidateInstallOptions { - _options.VersionLocatorID = core.StringPtr(versionLocatorID) - return _options +// NewListObjectsOptions : Instantiate ListObjectsOptions +func (*CatalogManagementV1) NewListObjectsOptions(catalogIdentifier string) *ListObjectsOptions { + return &ListObjectsOptions{ + CatalogIdentifier: core.StringPtr(catalogIdentifier), + } } -// SetVcenterID : Allow user to set VcenterID -func (_options *ValidateInstallOptions) SetVcenterID(vcenterID string) *ValidateInstallOptions { - _options.VcenterID = core.StringPtr(vcenterID) +// SetCatalogIdentifier : Allow user to set CatalogIdentifier +func (_options *ListObjectsOptions) SetCatalogIdentifier(catalogIdentifier string) *ListObjectsOptions { + _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) return _options } -// SetVcenterUser : Allow user to set VcenterUser -func (_options *ValidateInstallOptions) SetVcenterUser(vcenterUser string) *ValidateInstallOptions { - _options.VcenterUser = core.StringPtr(vcenterUser) +// SetLimit : Allow user to set Limit +func (_options *ListObjectsOptions) SetLimit(limit int64) *ListObjectsOptions { + _options.Limit = core.Int64Ptr(limit) return _options } -// SetVcenterPassword : Allow user to set VcenterPassword -func (_options *ValidateInstallOptions) SetVcenterPassword(vcenterPassword string) *ValidateInstallOptions { - _options.VcenterPassword = core.StringPtr(vcenterPassword) +// SetOffset : Allow user to set Offset +func (_options *ListObjectsOptions) SetOffset(offset int64) *ListObjectsOptions { + _options.Offset = core.Int64Ptr(offset) return _options } -// SetVcenterLocation : Allow user to set VcenterLocation -func (_options *ValidateInstallOptions) SetVcenterLocation(vcenterLocation string) *ValidateInstallOptions { - _options.VcenterLocation = core.StringPtr(vcenterLocation) +// SetName : Allow user to set Name +func (_options *ListObjectsOptions) SetName(name string) *ListObjectsOptions { + _options.Name = core.StringPtr(name) return _options } -// SetVcenterDatastore : Allow user to set VcenterDatastore -func (_options *ValidateInstallOptions) SetVcenterDatastore(vcenterDatastore string) *ValidateInstallOptions { - _options.VcenterDatastore = core.StringPtr(vcenterDatastore) +// SetSort : Allow user to set Sort +func (_options *ListObjectsOptions) SetSort(sort string) *ListObjectsOptions { + _options.Sort = core.StringPtr(sort) return _options } // SetHeaders : Allow user to set Headers -func (options *ValidateInstallOptions) SetHeaders(param map[string]string) *ValidateInstallOptions { +func (options *ListObjectsOptions) SetHeaders(param map[string]string) *ListObjectsOptions { options.Headers = param return options } -// Validation : Validation response. -type Validation struct { - // Date and time of last successful validation. - Validated *strfmt.DateTime `json:"validated,omitempty"` +// ListOfferingAuditsOptions : The ListOfferingAudits options. +type ListOfferingAuditsOptions struct { + // Catalog identifier. + CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` + + // Offering identification. + OfferingID *string `json:"offering_id" validate:"required,ne="` + + // Start token for a query. + Start *string `json:"start,omitempty"` + + // number or results to return in the query. + Limit *int64 `json:"limit,omitempty"` + + // Auditlog Lookup Names - by default names are not returned in auditlog. + Lookupnames *bool `json:"lookupnames,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListOfferingAuditsOptions : Instantiate ListOfferingAuditsOptions +func (*CatalogManagementV1) NewListOfferingAuditsOptions(catalogIdentifier string, offeringID string) *ListOfferingAuditsOptions { + return &ListOfferingAuditsOptions{ + CatalogIdentifier: core.StringPtr(catalogIdentifier), + OfferingID: core.StringPtr(offeringID), + } +} + +// SetCatalogIdentifier : Allow user to set CatalogIdentifier +func (_options *ListOfferingAuditsOptions) SetCatalogIdentifier(catalogIdentifier string) *ListOfferingAuditsOptions { + _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) + return _options +} + +// SetOfferingID : Allow user to set OfferingID +func (_options *ListOfferingAuditsOptions) SetOfferingID(offeringID string) *ListOfferingAuditsOptions { + _options.OfferingID = core.StringPtr(offeringID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListOfferingAuditsOptions) SetStart(start string) *ListOfferingAuditsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListOfferingAuditsOptions) SetLimit(limit int64) *ListOfferingAuditsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetLookupnames : Allow user to set Lookupnames +func (_options *ListOfferingAuditsOptions) SetLookupnames(lookupnames bool) *ListOfferingAuditsOptions { + _options.Lookupnames = core.BoolPtr(lookupnames) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListOfferingAuditsOptions) SetHeaders(param map[string]string) *ListOfferingAuditsOptions { + options.Headers = param + return options +} + +// ListOfferingInstanceAuditsOptions : The ListOfferingInstanceAudits options. +type ListOfferingInstanceAuditsOptions struct { + // Version Instance identifier. + InstanceIdentifier *string `json:"instance_identifier" validate:"required,ne="` + + // Start token for a query. + Start *string `json:"start,omitempty"` + + // number or results to return in the query. + Limit *int64 `json:"limit,omitempty"` + + // Auditlog Lookup Names - by default names are not returned in auditlog. + Lookupnames *bool `json:"lookupnames,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListOfferingInstanceAuditsOptions : Instantiate ListOfferingInstanceAuditsOptions +func (*CatalogManagementV1) NewListOfferingInstanceAuditsOptions(instanceIdentifier string) *ListOfferingInstanceAuditsOptions { + return &ListOfferingInstanceAuditsOptions{ + InstanceIdentifier: core.StringPtr(instanceIdentifier), + } +} + +// SetInstanceIdentifier : Allow user to set InstanceIdentifier +func (_options *ListOfferingInstanceAuditsOptions) SetInstanceIdentifier(instanceIdentifier string) *ListOfferingInstanceAuditsOptions { + _options.InstanceIdentifier = core.StringPtr(instanceIdentifier) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListOfferingInstanceAuditsOptions) SetStart(start string) *ListOfferingInstanceAuditsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListOfferingInstanceAuditsOptions) SetLimit(limit int64) *ListOfferingInstanceAuditsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetLookupnames : Allow user to set Lookupnames +func (_options *ListOfferingInstanceAuditsOptions) SetLookupnames(lookupnames bool) *ListOfferingInstanceAuditsOptions { + _options.Lookupnames = core.BoolPtr(lookupnames) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListOfferingInstanceAuditsOptions) SetHeaders(param map[string]string) *ListOfferingInstanceAuditsOptions { + options.Headers = param + return options +} + +// ListOfferingsOptions : The ListOfferings options. +type ListOfferingsOptions struct { + // Catalog identifier. + CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` + + // true - Strip down the content of what is returned. For example don't return the readme. Makes the result much + // smaller. Defaults to false. + Digest *bool `json:"digest,omitempty"` + + // The maximum number of results to return. + Limit *int64 `json:"limit,omitempty"` + + // The number of results to skip before returning values. + Offset *int64 `json:"offset,omitempty"` + + // Only return results that contain the specified string. + Name *string `json:"name,omitempty"` + + // The field on which the output is sorted. Sorts by default by **label** property. Available fields are **name**, + // **label**, **created**, and **updated**. By adding **-** (i.e. **-label**) in front of the query string, you can + // specify descending order. Default is ascending order. + Sort *string `json:"sort,omitempty"` + + // true - include offerings which have been marked as hidden. The default is true. To not return hidden offerings false + // must be explicitly set. + IncludeHidden *bool `json:"includeHidden,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListOfferingsOptions : Instantiate ListOfferingsOptions +func (*CatalogManagementV1) NewListOfferingsOptions(catalogIdentifier string) *ListOfferingsOptions { + return &ListOfferingsOptions{ + CatalogIdentifier: core.StringPtr(catalogIdentifier), + } +} + +// SetCatalogIdentifier : Allow user to set CatalogIdentifier +func (_options *ListOfferingsOptions) SetCatalogIdentifier(catalogIdentifier string) *ListOfferingsOptions { + _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) + return _options +} + +// SetDigest : Allow user to set Digest +func (_options *ListOfferingsOptions) SetDigest(digest bool) *ListOfferingsOptions { + _options.Digest = core.BoolPtr(digest) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListOfferingsOptions) SetLimit(limit int64) *ListOfferingsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetOffset : Allow user to set Offset +func (_options *ListOfferingsOptions) SetOffset(offset int64) *ListOfferingsOptions { + _options.Offset = core.Int64Ptr(offset) + return _options +} + +// SetName : Allow user to set Name +func (_options *ListOfferingsOptions) SetName(name string) *ListOfferingsOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetSort : Allow user to set Sort +func (_options *ListOfferingsOptions) SetSort(sort string) *ListOfferingsOptions { + _options.Sort = core.StringPtr(sort) + return _options +} + +// SetIncludeHidden : Allow user to set IncludeHidden +func (_options *ListOfferingsOptions) SetIncludeHidden(includeHidden bool) *ListOfferingsOptions { + _options.IncludeHidden = core.BoolPtr(includeHidden) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListOfferingsOptions) SetHeaders(param map[string]string) *ListOfferingsOptions { + options.Headers = param + return options +} + +// ListOperatorsOptions : The ListOperators options. +type ListOperatorsOptions struct { + // IAM Refresh token. + XAuthRefreshToken *string `json:"X-Auth-Refresh-Token" validate:"required"` + + // Cluster identification. + ClusterID *string `json:"cluster_id" validate:"required"` + + // Cluster region. + Region *string `json:"region" validate:"required"` + + // A dotted value of `catalogID`.`versionID`. + VersionLocatorID *string `json:"version_locator_id" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListOperatorsOptions : Instantiate ListOperatorsOptions +func (*CatalogManagementV1) NewListOperatorsOptions(xAuthRefreshToken string, clusterID string, region string, versionLocatorID string) *ListOperatorsOptions { + return &ListOperatorsOptions{ + XAuthRefreshToken: core.StringPtr(xAuthRefreshToken), + ClusterID: core.StringPtr(clusterID), + Region: core.StringPtr(region), + VersionLocatorID: core.StringPtr(versionLocatorID), + } +} + +// SetXAuthRefreshToken : Allow user to set XAuthRefreshToken +func (_options *ListOperatorsOptions) SetXAuthRefreshToken(xAuthRefreshToken string) *ListOperatorsOptions { + _options.XAuthRefreshToken = core.StringPtr(xAuthRefreshToken) + return _options +} + +// SetClusterID : Allow user to set ClusterID +func (_options *ListOperatorsOptions) SetClusterID(clusterID string) *ListOperatorsOptions { + _options.ClusterID = core.StringPtr(clusterID) + return _options +} + +// SetRegion : Allow user to set Region +func (_options *ListOperatorsOptions) SetRegion(region string) *ListOperatorsOptions { + _options.Region = core.StringPtr(region) + return _options +} + +// SetVersionLocatorID : Allow user to set VersionLocatorID +func (_options *ListOperatorsOptions) SetVersionLocatorID(versionLocatorID string) *ListOperatorsOptions { + _options.VersionLocatorID = core.StringPtr(versionLocatorID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListOperatorsOptions) SetHeaders(param map[string]string) *ListOperatorsOptions { + options.Headers = param + return options +} + +// MediaItem : Offering Media information. +type MediaItem struct { + // URL of the specified media item. + URL *string `json:"url,omitempty"` + + // CM API specific URL of the specified media item. + APIURL *string `json:"api_url,omitempty"` + + // Offering URL proxy information. + URLProxy *URLProxy `json:"url_proxy,omitempty"` + + // Caption for this media item. + Caption *string `json:"caption,omitempty"` + + // A map of translated strings, by language code. + CaptionI18n map[string]string `json:"caption_i18n,omitempty"` + + // Type of this media item. + Type *string `json:"type,omitempty"` + + // Thumbnail URL for this media item. + ThumbnailURL *string `json:"thumbnail_url,omitempty"` +} + +// UnmarshalMediaItem unmarshals an instance of MediaItem from the specified map of raw messages. +func UnmarshalMediaItem(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(MediaItem) + err = core.UnmarshalPrimitive(m, "url", &obj.URL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "api_url", &obj.APIURL) + if err != nil { + return + } + err = core.UnmarshalModel(m, "url_proxy", &obj.URLProxy, UnmarshalURLProxy) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "caption", &obj.Caption) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "caption_i18n", &obj.CaptionI18n) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "thumbnail_url", &obj.ThumbnailURL) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NamespaceSearchResult : Paginated list of namespace search results. +type NamespaceSearchResult struct { + // The offset (origin 0) of the first resource in this page of search results. + Offset *int64 `json:"offset" validate:"required"` + + // The maximum number of resources returned in each page of search results. + Limit *int64 `json:"limit" validate:"required"` + + // The overall total number of resources in the search result set. + TotalCount *int64 `json:"total_count,omitempty"` + + // The number of resources returned in this page of search results. + ResourceCount *int64 `json:"resource_count,omitempty"` + + // A URL for retrieving the first page of search results. + First *string `json:"first,omitempty"` + + // A URL for retrieving the last page of search results. + Last *string `json:"last,omitempty"` + + // A URL for retrieving the previous page of search results. + Prev *string `json:"prev,omitempty"` + + // A URL for retrieving the next page of search results. + Next *string `json:"next,omitempty"` + + // Resulting objects. + Resources []string `json:"resources,omitempty"` +} + +// UnmarshalNamespaceSearchResult unmarshals an instance of NamespaceSearchResult from the specified map of raw messages. +func UnmarshalNamespaceSearchResult(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NamespaceSearchResult) + err = core.UnmarshalPrimitive(m, "offset", &obj.Offset) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_count", &obj.ResourceCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "first", &obj.First) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "last", &obj.Last) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "prev", &obj.Prev) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "next", &obj.Next) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resources", &obj.Resources) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ObjectAccessListResult : Paginated object search result. +type ObjectAccessListResult struct { + // The offset (origin 0) of the first resource in this page of search results. + Offset *int64 `json:"offset" validate:"required"` + + // The maximum number of resources returned in each page of search results. + Limit *int64 `json:"limit" validate:"required"` + + // The overall total number of resources in the search result set. + TotalCount *int64 `json:"total_count,omitempty"` + + // The number of resources returned in this page of search results. + ResourceCount *int64 `json:"resource_count,omitempty"` + + // A URL for retrieving the first page of search results. + First *string `json:"first,omitempty"` + + // A URL for retrieving the last page of search results. + Last *string `json:"last,omitempty"` + + // A URL for retrieving the previous page of search results. + Prev *string `json:"prev,omitempty"` + + // A URL for retrieving the next page of search results. + Next *string `json:"next,omitempty"` + + // Resulting objects. + Resources []Access `json:"resources,omitempty"` +} + +// UnmarshalObjectAccessListResult unmarshals an instance of ObjectAccessListResult from the specified map of raw messages. +func UnmarshalObjectAccessListResult(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ObjectAccessListResult) + err = core.UnmarshalPrimitive(m, "offset", &obj.Offset) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_count", &obj.ResourceCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "first", &obj.First) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "last", &obj.Last) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "prev", &obj.Prev) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "next", &obj.Next) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resources", &obj.Resources, UnmarshalAccess) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ObjectListResult : Paginated object search result. +type ObjectListResult struct { + // The offset (origin 0) of the first resource in this page of search results. + Offset *int64 `json:"offset" validate:"required"` + + // The maximum number of resources returned in each page of search results. + Limit *int64 `json:"limit" validate:"required"` + + // The overall total number of resources in the search result set. + TotalCount *int64 `json:"total_count,omitempty"` + + // The number of resources returned in this page of search results. + ResourceCount *int64 `json:"resource_count,omitempty"` + + // A URL for retrieving the first page of search results. + First *string `json:"first,omitempty"` + + // A URL for retrieving the last page of search results. + Last *string `json:"last,omitempty"` + + // A URL for retrieving the previous page of search results. + Prev *string `json:"prev,omitempty"` + + // A URL for retrieving the next page of search results. + Next *string `json:"next,omitempty"` + + // Resulting objects. + Resources []CatalogObject `json:"resources,omitempty"` +} + +// UnmarshalObjectListResult unmarshals an instance of ObjectListResult from the specified map of raw messages. +func UnmarshalObjectListResult(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ObjectListResult) + err = core.UnmarshalPrimitive(m, "offset", &obj.Offset) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_count", &obj.ResourceCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "first", &obj.First) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "last", &obj.Last) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "prev", &obj.Prev) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "next", &obj.Next) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resources", &obj.Resources, UnmarshalCatalogObject) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ObjectSearchResult : Paginated object search result. +type ObjectSearchResult struct { + // The offset (origin 0) of the first resource in this page of search results. + Offset *int64 `json:"offset" validate:"required"` + + // The maximum number of resources returned in each page of search results. + Limit *int64 `json:"limit" validate:"required"` + + // The overall total number of resources in the search result set. + TotalCount *int64 `json:"total_count,omitempty"` + + // The number of resources returned in this page of search results. + ResourceCount *int64 `json:"resource_count,omitempty"` + + // A URL for retrieving the first page of search results. + First *string `json:"first,omitempty"` + + // A URL for retrieving the last page of search results. + Last *string `json:"last,omitempty"` + + // A URL for retrieving the previous page of search results. + Prev *string `json:"prev,omitempty"` + + // A URL for retrieving the next page of search results. + Next *string `json:"next,omitempty"` + + // Resulting objects. + Resources []CatalogObject `json:"resources,omitempty"` +} + +// UnmarshalObjectSearchResult unmarshals an instance of ObjectSearchResult from the specified map of raw messages. +func UnmarshalObjectSearchResult(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ObjectSearchResult) + err = core.UnmarshalPrimitive(m, "offset", &obj.Offset) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_count", &obj.ResourceCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "first", &obj.First) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "last", &obj.Last) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "prev", &obj.Prev) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "next", &obj.Next) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resources", &obj.Resources, UnmarshalCatalogObject) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Offering : Offering information. +type Offering struct { + // unique id. + ID *string `json:"id,omitempty"` + + // Cloudant revision. + Rev *string `json:"_rev,omitempty"` + + // The url for this specific offering. + URL *string `json:"url,omitempty"` + + // The crn for this specific offering. + CRN *string `json:"crn,omitempty"` + + // Display Name in the requested language. + Label *string `json:"label,omitempty"` + + // A map of translated strings, by language code. + LabelI18n map[string]string `json:"label_i18n,omitempty"` + + // The programmatic name of this offering. + Name *string `json:"name,omitempty"` + + // URL for an icon associated with this offering. + OfferingIconURL *string `json:"offering_icon_url,omitempty"` + + // URL for an additional docs with this offering. + OfferingDocsURL *string `json:"offering_docs_url,omitempty"` + + // [deprecated] - Use offering.support instead. URL to be displayed in the Consumption UI for getting support on this + // offering. + OfferingSupportURL *string `json:"offering_support_url,omitempty"` + + // List of tags associated with this catalog. + Tags []string `json:"tags,omitempty"` + + // List of keywords associated with offering, typically used to search for it. + Keywords []string `json:"keywords,omitempty"` + + // Repository info for offerings. + Rating *Rating `json:"rating,omitempty"` + + // The date and time this catalog was created. + Created *strfmt.DateTime `json:"created,omitempty"` + + // The date and time this catalog was last updated. + Updated *strfmt.DateTime `json:"updated,omitempty"` + + // Short description in the requested language. + ShortDescription *string `json:"short_description,omitempty"` + + // A map of translated strings, by language code. + ShortDescriptionI18n map[string]string `json:"short_description_i18n,omitempty"` + + // Long description in the requested language. + LongDescription *string `json:"long_description,omitempty"` + + // A map of translated strings, by language code. + LongDescriptionI18n map[string]string `json:"long_description_i18n,omitempty"` + + // list of features associated with this offering. + Features []Feature `json:"features,omitempty"` + + // Array of kind. + Kinds []Kind `json:"kinds,omitempty"` + + // Offering is managed by Partner Center. + PcManaged *bool `json:"pc_managed,omitempty"` + + // Offering has been approved to publish to permitted to IBM or Public Catalog. + PublishApproved *bool `json:"publish_approved,omitempty"` + + // Denotes public availability of an Offering - if share_enabled is true. + ShareWithAll *bool `json:"share_with_all,omitempty"` + + // Denotes IBM employee availability of an Offering - if share_enabled is true. + ShareWithIBM *bool `json:"share_with_ibm,omitempty"` + + // Denotes sharing including access list availability of an Offering is enabled. + ShareEnabled *bool `json:"share_enabled,omitempty"` + + // Is it permitted to request publishing to IBM or Public. + PermitRequestIBMPublicPublish *bool `json:"permit_request_ibm_public_publish,omitempty"` + + // Indicates if this offering has been approved for use by all IBMers. + IBMPublishApproved *bool `json:"ibm_publish_approved,omitempty"` + + // Indicates if this offering has been approved for use by all IBM Cloud users. + PublicPublishApproved *bool `json:"public_publish_approved,omitempty"` + + // The original offering CRN that this publish entry came from. + PublicOriginalCRN *string `json:"public_original_crn,omitempty"` + + // The crn of the public catalog entry of this offering. + PublishPublicCRN *string `json:"publish_public_crn,omitempty"` + + // The portal's approval record ID. + PortalApprovalRecord *string `json:"portal_approval_record,omitempty"` + + // The portal UI URL. + PortalUIURL *string `json:"portal_ui_url,omitempty"` + + // The id of the catalog containing this offering. + CatalogID *string `json:"catalog_id,omitempty"` + + // The name of the catalog. + CatalogName *string `json:"catalog_name,omitempty"` + + // Map of metadata values for this offering. + Metadata map[string]interface{} `json:"metadata,omitempty"` + + // A disclaimer for this offering. + Disclaimer *string `json:"disclaimer,omitempty"` + + // Determine if this offering should be displayed in the Consumption UI. + Hidden *bool `json:"hidden,omitempty"` + + // Deprecated - Provider of this offering. + Provider *string `json:"provider,omitempty"` + + // Information on the provider for this offering, or omitted if no provider information is given. + ProviderInfo *ProviderInfo `json:"provider_info,omitempty"` + + // Repository info for offerings. + RepoInfo *RepoInfo `json:"repo_info,omitempty"` + + // Image pull keys for this offering. + ImagePullKeys []ImagePullKey `json:"image_pull_keys,omitempty"` + + // Offering Support information. + Support *Support `json:"support,omitempty"` + + // A list of media items related to this offering. + Media []MediaItem `json:"media,omitempty"` + + // Deprecation information for an Offering. + DeprecatePending *DeprecatePending `json:"deprecate_pending,omitempty"` + + // The product kind. Valid values are module, solution, or empty string. + ProductKind *string `json:"product_kind,omitempty"` + + // A list of badges for this offering. + Badges []Badge `json:"badges,omitempty"` +} + +// UnmarshalOffering unmarshals an instance of Offering from the specified map of raw messages. +func UnmarshalOffering(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Offering) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "_rev", &obj.Rev) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "url", &obj.URL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "label", &obj.Label) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "label_i18n", &obj.LabelI18n) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "offering_icon_url", &obj.OfferingIconURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "offering_docs_url", &obj.OfferingDocsURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "offering_support_url", &obj.OfferingSupportURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "keywords", &obj.Keywords) + if err != nil { + return + } + err = core.UnmarshalModel(m, "rating", &obj.Rating, UnmarshalRating) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created", &obj.Created) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated", &obj.Updated) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "short_description", &obj.ShortDescription) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "short_description_i18n", &obj.ShortDescriptionI18n) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "long_description", &obj.LongDescription) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "long_description_i18n", &obj.LongDescriptionI18n) + if err != nil { + return + } + err = core.UnmarshalModel(m, "features", &obj.Features, UnmarshalFeature) + if err != nil { + return + } + err = core.UnmarshalModel(m, "kinds", &obj.Kinds, UnmarshalKind) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "pc_managed", &obj.PcManaged) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "publish_approved", &obj.PublishApproved) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "share_with_all", &obj.ShareWithAll) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "share_with_ibm", &obj.ShareWithIBM) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "share_enabled", &obj.ShareEnabled) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "permit_request_ibm_public_publish", &obj.PermitRequestIBMPublicPublish) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ibm_publish_approved", &obj.IBMPublishApproved) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "public_publish_approved", &obj.PublicPublishApproved) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "public_original_crn", &obj.PublicOriginalCRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "publish_public_crn", &obj.PublishPublicCRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "portal_approval_record", &obj.PortalApprovalRecord) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "portal_ui_url", &obj.PortalUIURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "catalog_id", &obj.CatalogID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "catalog_name", &obj.CatalogName) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "metadata", &obj.Metadata) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "disclaimer", &obj.Disclaimer) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "hidden", &obj.Hidden) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "provider", &obj.Provider) + if err != nil { + return + } + err = core.UnmarshalModel(m, "provider_info", &obj.ProviderInfo, UnmarshalProviderInfo) + if err != nil { + return + } + err = core.UnmarshalModel(m, "repo_info", &obj.RepoInfo, UnmarshalRepoInfo) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image_pull_keys", &obj.ImagePullKeys, UnmarshalImagePullKey) + if err != nil { + return + } + err = core.UnmarshalModel(m, "support", &obj.Support, UnmarshalSupport) + if err != nil { + return + } + err = core.UnmarshalModel(m, "media", &obj.Media, UnmarshalMediaItem) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deprecate_pending", &obj.DeprecatePending, UnmarshalDeprecatePending) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "product_kind", &obj.ProductKind) + if err != nil { + return + } + err = core.UnmarshalModel(m, "badges", &obj.Badges, UnmarshalBadge) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// OfferingInstance : A offering instance resource (provision instance of a catalog offering). +type OfferingInstance struct { + // provisioned instance ID (part of the CRN). + ID *string `json:"id,omitempty"` + + // Cloudant revision. + Rev *string `json:"_rev,omitempty"` + + // url reference to this object. + URL *string `json:"url,omitempty"` + + // platform CRN for this instance. + CRN *string `json:"crn,omitempty"` + + // the label for this instance. + Label *string `json:"label,omitempty"` + + // Catalog ID this instance was created from. + CatalogID *string `json:"catalog_id,omitempty"` + + // Offering ID this instance was created from. + OfferingID *string `json:"offering_id,omitempty"` + + // the format this instance has (helm, operator, ova...). + KindFormat *string `json:"kind_format,omitempty"` + + // The version this instance was installed from (semver - not version id). + Version *string `json:"version,omitempty"` + + // The version id this instance was installed from (version id - not semver). + VersionID *string `json:"version_id,omitempty"` + + // Cluster ID. + ClusterID *string `json:"cluster_id,omitempty"` + + // Cluster region (e.g., us-south). + ClusterRegion *string `json:"cluster_region,omitempty"` + + // List of target namespaces to install into. + ClusterNamespaces []string `json:"cluster_namespaces,omitempty"` + + // designate to install into all namespaces. + ClusterAllNamespaces *bool `json:"cluster_all_namespaces,omitempty"` + + // Id of the schematics workspace, for offering instances provisioned through schematics. + SchematicsWorkspaceID *string `json:"schematics_workspace_id,omitempty"` + + // Type of install plan (also known as approval strategy) for operator subscriptions. Can be either automatic, which + // automatically upgrades operators to the latest in a channel, or manual, which requires approval on the cluster. + InstallPlan *string `json:"install_plan,omitempty"` + + // Channel to pin the operator subscription to. + Channel *string `json:"channel,omitempty"` + + // date and time create. + Created *strfmt.DateTime `json:"created,omitempty"` + + // date and time updated. + Updated *strfmt.DateTime `json:"updated,omitempty"` + + // Map of metadata values for this offering instance. + Metadata map[string]interface{} `json:"metadata,omitempty"` + + // Id of the resource group to provision the offering instance into. + ResourceGroupID *string `json:"resource_group_id,omitempty"` + + // String location of OfferingInstance deployment. + Location *string `json:"location,omitempty"` + + // Indicates if Resource Controller has disabled this instance. + Disabled *bool `json:"disabled,omitempty"` + + // The account this instance is owned by. + Account *string `json:"account,omitempty"` + + // the last operation performed and status. + LastOperation *OfferingInstanceLastOperation `json:"last_operation,omitempty"` + + // The target kind for the installed software version. + KindTarget *string `json:"kind_target,omitempty"` + + // The digest value of the installed software version. + Sha *string `json:"sha,omitempty"` +} + +// UnmarshalOfferingInstance unmarshals an instance of OfferingInstance from the specified map of raw messages. +func UnmarshalOfferingInstance(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(OfferingInstance) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "_rev", &obj.Rev) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "url", &obj.URL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "label", &obj.Label) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "catalog_id", &obj.CatalogID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "offering_id", &obj.OfferingID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "kind_format", &obj.KindFormat) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "version", &obj.Version) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "version_id", &obj.VersionID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cluster_id", &obj.ClusterID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cluster_region", &obj.ClusterRegion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cluster_namespaces", &obj.ClusterNamespaces) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cluster_all_namespaces", &obj.ClusterAllNamespaces) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "schematics_workspace_id", &obj.SchematicsWorkspaceID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "install_plan", &obj.InstallPlan) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "channel", &obj.Channel) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created", &obj.Created) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated", &obj.Updated) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "metadata", &obj.Metadata) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_group_id", &obj.ResourceGroupID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "location", &obj.Location) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "disabled", &obj.Disabled) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "account", &obj.Account) + if err != nil { + return + } + err = core.UnmarshalModel(m, "last_operation", &obj.LastOperation, UnmarshalOfferingInstanceLastOperation) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "kind_target", &obj.KindTarget) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "sha", &obj.Sha) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// OfferingInstanceLastOperation : the last operation performed and status. +type OfferingInstanceLastOperation struct { + // last operation performed. + Operation *string `json:"operation,omitempty"` + + // state after the last operation performed. + State *string `json:"state,omitempty"` + + // additional information about the last operation. + Message *string `json:"message,omitempty"` + + // transaction id from the last operation. + TransactionID *string `json:"transaction_id,omitempty"` + + // Date and time last updated. + Updated *strfmt.DateTime `json:"updated,omitempty"` + + // Error code from the last operation, if applicable. + Code *string `json:"code,omitempty"` +} + +// UnmarshalOfferingInstanceLastOperation unmarshals an instance of OfferingInstanceLastOperation from the specified map of raw messages. +func UnmarshalOfferingInstanceLastOperation(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(OfferingInstanceLastOperation) + err = core.UnmarshalPrimitive(m, "operation", &obj.Operation) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "state", &obj.State) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "transaction_id", &obj.TransactionID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated", &obj.Updated) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// OfferingSearchResult : Paginated offering search result. +type OfferingSearchResult struct { + // The offset (origin 0) of the first resource in this page of search results. + Offset *int64 `json:"offset" validate:"required"` + + // The maximum number of resources returned in each page of search results. + Limit *int64 `json:"limit" validate:"required"` + + // The overall total number of resources in the search result set. + TotalCount *int64 `json:"total_count,omitempty"` + + // The number of resources returned in this page of search results. + ResourceCount *int64 `json:"resource_count,omitempty"` + + // A URL for retrieving the first page of search results. + First *string `json:"first,omitempty"` + + // A URL for retrieving the last page of search results. + Last *string `json:"last,omitempty"` + + // A URL for retrieving the previous page of search results. + Prev *string `json:"prev,omitempty"` + + // A URL for retrieving the next page of search results. + Next *string `json:"next,omitempty"` + + // Resulting objects. + Resources []Offering `json:"resources,omitempty"` +} + +// UnmarshalOfferingSearchResult unmarshals an instance of OfferingSearchResult from the specified map of raw messages. +func UnmarshalOfferingSearchResult(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(OfferingSearchResult) + err = core.UnmarshalPrimitive(m, "offset", &obj.Offset) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_count", &obj.ResourceCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "first", &obj.First) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "last", &obj.Last) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "prev", &obj.Prev) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "next", &obj.Next) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resources", &obj.Resources, UnmarshalOffering) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// OperatorDeployResult : Operator deploy result. +type OperatorDeployResult struct { + // Status phase. + Phase *string `json:"phase,omitempty"` + + // Status message. + Message *string `json:"message,omitempty"` + + // Operator API path. + Link *string `json:"link,omitempty"` + + // Name of Operator. + Name *string `json:"name,omitempty"` + + // Operator version. + Version *string `json:"version,omitempty"` + + // Kube namespace. + Namespace *string `json:"namespace,omitempty"` + + // Package Operator exists in. + PackageName *string `json:"package_name,omitempty"` + + // Catalog identification. + CatalogID *string `json:"catalog_id,omitempty"` +} + +// UnmarshalOperatorDeployResult unmarshals an instance of OperatorDeployResult from the specified map of raw messages. +func UnmarshalOperatorDeployResult(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(OperatorDeployResult) + err = core.UnmarshalPrimitive(m, "phase", &obj.Phase) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "link", &obj.Link) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "version", &obj.Version) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "namespace", &obj.Namespace) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "package_name", &obj.PackageName) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "catalog_id", &obj.CatalogID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Output : Outputs for a version. +type Output struct { + // Output key. + Key *string `json:"key,omitempty"` + + // Output description. + Description *string `json:"description,omitempty"` +} + +// UnmarshalOutput unmarshals an instance of Output from the specified map of raw messages. +func UnmarshalOutput(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Output) + err = core.UnmarshalPrimitive(m, "key", &obj.Key) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "description", &obj.Description) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PaginationTokenLink : Link response on a token paginated query. +type PaginationTokenLink struct { + // The href to the linked response. + Href *string `json:"href" validate:"required"` + + // The start token used in this link. Will not be returned on First links. + Start *string `json:"start,omitempty"` +} + +// UnmarshalPaginationTokenLink unmarshals an instance of PaginationTokenLink from the specified map of raw messages. +func UnmarshalPaginationTokenLink(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PaginationTokenLink) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "start", &obj.Start) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Plan : Offering plan. +type Plan struct { + // unique id. + ID *string `json:"id,omitempty"` + + // Display Name in the requested language. + Label *string `json:"label,omitempty"` + + // The programmatic name of this offering. + Name *string `json:"name,omitempty"` + + // Short description in the requested language. + ShortDescription *string `json:"short_description,omitempty"` + + // Long description in the requested language. + LongDescription *string `json:"long_description,omitempty"` + + // open ended metadata information. + Metadata map[string]interface{} `json:"metadata,omitempty"` + + // list of tags associated with this catalog. + Tags []string `json:"tags,omitempty"` + + // list of features associated with this offering. + AdditionalFeatures []Feature `json:"additional_features,omitempty"` + + // the date'time this catalog was created. + Created *strfmt.DateTime `json:"created,omitempty"` + + // the date'time this catalog was last updated. + Updated *strfmt.DateTime `json:"updated,omitempty"` + + // list of deployments. + Deployments []Deployment `json:"deployments,omitempty"` +} + +// UnmarshalPlan unmarshals an instance of Plan from the specified map of raw messages. +func UnmarshalPlan(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Plan) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "label", &obj.Label) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "short_description", &obj.ShortDescription) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "long_description", &obj.LongDescription) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "metadata", &obj.Metadata) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) + if err != nil { + return + } + err = core.UnmarshalModel(m, "additional_features", &obj.AdditionalFeatures, UnmarshalFeature) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created", &obj.Created) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated", &obj.Updated) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deployments", &obj.Deployments, UnmarshalDeployment) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PreinstallVersionOptions : The PreinstallVersion options. +type PreinstallVersionOptions struct { + // A dotted value of `catalogID`.`versionID`. + VersionLocID *string `json:"version_loc_id" validate:"required,ne="` + + // IAM Refresh token. + XAuthRefreshToken *string `json:"X-Auth-Refresh-Token" validate:"required"` + + // Cluster ID. + ClusterID *string `json:"cluster_id,omitempty"` + + // Cluster region. + Region *string `json:"region,omitempty"` + + // Kube namespace. + Namespace *string `json:"namespace,omitempty"` + + // Validation override values. Required for virtual server image for VPC. + OverrideValues *DeployRequestBodyOverrideValues `json:"override_values,omitempty"` + + // Schematics environment variables to use with this workspace. + EnvironmentVariables []DeployRequestBodyEnvironmentVariablesItem `json:"environment_variables,omitempty"` + + // Entitlement API Key for this offering. + EntitlementApikey *string `json:"entitlement_apikey,omitempty"` + + // Schematics workspace configuration. + Schematics *DeployRequestBodySchematics `json:"schematics,omitempty"` + + // Script. + Script *string `json:"script,omitempty"` + + // Script ID. + ScriptID *string `json:"script_id,omitempty"` + + // A dotted value of `catalogID`.`versionID`. + VersionLocatorID *string `json:"version_locator_id,omitempty"` + + // VCenter ID. + VcenterID *string `json:"vcenter_id,omitempty"` + + // VCenter Location. + VcenterLocation *string `json:"vcenter_location,omitempty"` + + // VCenter User. + VcenterUser *string `json:"vcenter_user,omitempty"` + + // VCenter Password. + VcenterPassword *string `json:"vcenter_password,omitempty"` + + // VCenter Datastore. + VcenterDatastore *string `json:"vcenter_datastore,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewPreinstallVersionOptions : Instantiate PreinstallVersionOptions +func (*CatalogManagementV1) NewPreinstallVersionOptions(versionLocID string, xAuthRefreshToken string) *PreinstallVersionOptions { + return &PreinstallVersionOptions{ + VersionLocID: core.StringPtr(versionLocID), + XAuthRefreshToken: core.StringPtr(xAuthRefreshToken), + } +} + +// SetVersionLocID : Allow user to set VersionLocID +func (_options *PreinstallVersionOptions) SetVersionLocID(versionLocID string) *PreinstallVersionOptions { + _options.VersionLocID = core.StringPtr(versionLocID) + return _options +} + +// SetXAuthRefreshToken : Allow user to set XAuthRefreshToken +func (_options *PreinstallVersionOptions) SetXAuthRefreshToken(xAuthRefreshToken string) *PreinstallVersionOptions { + _options.XAuthRefreshToken = core.StringPtr(xAuthRefreshToken) + return _options +} + +// SetClusterID : Allow user to set ClusterID +func (_options *PreinstallVersionOptions) SetClusterID(clusterID string) *PreinstallVersionOptions { + _options.ClusterID = core.StringPtr(clusterID) + return _options +} + +// SetRegion : Allow user to set Region +func (_options *PreinstallVersionOptions) SetRegion(region string) *PreinstallVersionOptions { + _options.Region = core.StringPtr(region) + return _options +} + +// SetNamespace : Allow user to set Namespace +func (_options *PreinstallVersionOptions) SetNamespace(namespace string) *PreinstallVersionOptions { + _options.Namespace = core.StringPtr(namespace) + return _options +} + +// SetOverrideValues : Allow user to set OverrideValues +func (_options *PreinstallVersionOptions) SetOverrideValues(overrideValues *DeployRequestBodyOverrideValues) *PreinstallVersionOptions { + _options.OverrideValues = overrideValues + return _options +} + +// SetEnvironmentVariables : Allow user to set EnvironmentVariables +func (_options *PreinstallVersionOptions) SetEnvironmentVariables(environmentVariables []DeployRequestBodyEnvironmentVariablesItem) *PreinstallVersionOptions { + _options.EnvironmentVariables = environmentVariables + return _options +} + +// SetEntitlementApikey : Allow user to set EntitlementApikey +func (_options *PreinstallVersionOptions) SetEntitlementApikey(entitlementApikey string) *PreinstallVersionOptions { + _options.EntitlementApikey = core.StringPtr(entitlementApikey) + return _options +} + +// SetSchematics : Allow user to set Schematics +func (_options *PreinstallVersionOptions) SetSchematics(schematics *DeployRequestBodySchematics) *PreinstallVersionOptions { + _options.Schematics = schematics + return _options +} + +// SetScript : Allow user to set Script +func (_options *PreinstallVersionOptions) SetScript(script string) *PreinstallVersionOptions { + _options.Script = core.StringPtr(script) + return _options +} + +// SetScriptID : Allow user to set ScriptID +func (_options *PreinstallVersionOptions) SetScriptID(scriptID string) *PreinstallVersionOptions { + _options.ScriptID = core.StringPtr(scriptID) + return _options +} + +// SetVersionLocatorID : Allow user to set VersionLocatorID +func (_options *PreinstallVersionOptions) SetVersionLocatorID(versionLocatorID string) *PreinstallVersionOptions { + _options.VersionLocatorID = core.StringPtr(versionLocatorID) + return _options +} + +// SetVcenterID : Allow user to set VcenterID +func (_options *PreinstallVersionOptions) SetVcenterID(vcenterID string) *PreinstallVersionOptions { + _options.VcenterID = core.StringPtr(vcenterID) + return _options +} + +// SetVcenterLocation : Allow user to set VcenterLocation +func (_options *PreinstallVersionOptions) SetVcenterLocation(vcenterLocation string) *PreinstallVersionOptions { + _options.VcenterLocation = core.StringPtr(vcenterLocation) + return _options +} + +// SetVcenterUser : Allow user to set VcenterUser +func (_options *PreinstallVersionOptions) SetVcenterUser(vcenterUser string) *PreinstallVersionOptions { + _options.VcenterUser = core.StringPtr(vcenterUser) + return _options +} + +// SetVcenterPassword : Allow user to set VcenterPassword +func (_options *PreinstallVersionOptions) SetVcenterPassword(vcenterPassword string) *PreinstallVersionOptions { + _options.VcenterPassword = core.StringPtr(vcenterPassword) + return _options +} + +// SetVcenterDatastore : Allow user to set VcenterDatastore +func (_options *PreinstallVersionOptions) SetVcenterDatastore(vcenterDatastore string) *PreinstallVersionOptions { + _options.VcenterDatastore = core.StringPtr(vcenterDatastore) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *PreinstallVersionOptions) SetHeaders(param map[string]string) *PreinstallVersionOptions { + options.Headers = param + return options +} + +// Project : Cost estimate project definition. +type Project struct { + // Project name. + Name *string `json:"name,omitempty"` + + // Project metadata. + Metadata map[string]interface{} `json:"metadata,omitempty"` + + // Cost breakdown definition. + PastBreakdown *CostBreakdown `json:"pastBreakdown,omitempty"` + + // Cost breakdown definition. + Breakdown *CostBreakdown `json:"breakdown,omitempty"` + + // Cost breakdown definition. + Diff *CostBreakdown `json:"diff,omitempty"` + + // Cost summary definition. + Summary *CostSummary `json:"summary,omitempty"` +} + +// UnmarshalProject unmarshals an instance of Project from the specified map of raw messages. +func UnmarshalProject(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Project) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "metadata", &obj.Metadata) + if err != nil { + return + } + err = core.UnmarshalModel(m, "pastBreakdown", &obj.PastBreakdown, UnmarshalCostBreakdown) + if err != nil { + return + } + err = core.UnmarshalModel(m, "breakdown", &obj.Breakdown, UnmarshalCostBreakdown) + if err != nil { + return + } + err = core.UnmarshalModel(m, "diff", &obj.Diff, UnmarshalCostBreakdown) + if err != nil { + return + } + err = core.UnmarshalModel(m, "summary", &obj.Summary, UnmarshalCostSummary) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ProviderInfo : Information on the provider for this offering, or omitted if no provider information is given. +type ProviderInfo struct { + // The id of this provider. + ID *string `json:"id,omitempty"` + + // The name of this provider. + Name *string `json:"name,omitempty"` +} + +// UnmarshalProviderInfo unmarshals an instance of ProviderInfo from the specified map of raw messages. +func UnmarshalProviderInfo(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ProviderInfo) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicPublishObjectOptions : The PublicPublishObject options. +type PublicPublishObjectOptions struct { + // Catalog identifier. + CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` + + // Object identifier. + ObjectIdentifier *string `json:"object_identifier" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewPublicPublishObjectOptions : Instantiate PublicPublishObjectOptions +func (*CatalogManagementV1) NewPublicPublishObjectOptions(catalogIdentifier string, objectIdentifier string) *PublicPublishObjectOptions { + return &PublicPublishObjectOptions{ + CatalogIdentifier: core.StringPtr(catalogIdentifier), + ObjectIdentifier: core.StringPtr(objectIdentifier), + } +} + +// SetCatalogIdentifier : Allow user to set CatalogIdentifier +func (_options *PublicPublishObjectOptions) SetCatalogIdentifier(catalogIdentifier string) *PublicPublishObjectOptions { + _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) + return _options +} + +// SetObjectIdentifier : Allow user to set ObjectIdentifier +func (_options *PublicPublishObjectOptions) SetObjectIdentifier(objectIdentifier string) *PublicPublishObjectOptions { + _options.ObjectIdentifier = core.StringPtr(objectIdentifier) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *PublicPublishObjectOptions) SetHeaders(param map[string]string) *PublicPublishObjectOptions { + options.Headers = param + return options +} + +// PublicPublishVersionOptions : The PublicPublishVersion options. +type PublicPublishVersionOptions struct { + // A dotted value of `catalogID`.`versionID`. + VersionLocID *string `json:"version_loc_id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewPublicPublishVersionOptions : Instantiate PublicPublishVersionOptions +func (*CatalogManagementV1) NewPublicPublishVersionOptions(versionLocID string) *PublicPublishVersionOptions { + return &PublicPublishVersionOptions{ + VersionLocID: core.StringPtr(versionLocID), + } +} + +// SetVersionLocID : Allow user to set VersionLocID +func (_options *PublicPublishVersionOptions) SetVersionLocID(versionLocID string) *PublicPublishVersionOptions { + _options.VersionLocID = core.StringPtr(versionLocID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *PublicPublishVersionOptions) SetHeaders(param map[string]string) *PublicPublishVersionOptions { + options.Headers = param + return options +} + +// PublishObject : Publish information. +type PublishObject struct { + // Is it permitted to request publishing to IBM or Public. + PermitIBMPublicPublish *bool `json:"permit_ibm_public_publish,omitempty"` + + // Indicates if this offering has been approved for use by all IBMers. + IBMApproved *bool `json:"ibm_approved,omitempty"` + + // Indicates if this offering has been approved for use by all IBM Cloud users. + PublicApproved *bool `json:"public_approved,omitempty"` + + // The portal's approval record ID. + PortalApprovalRecord *string `json:"portal_approval_record,omitempty"` + + // The portal UI URL. + PortalURL *string `json:"portal_url,omitempty"` +} + +// UnmarshalPublishObject unmarshals an instance of PublishObject from the specified map of raw messages. +func UnmarshalPublishObject(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublishObject) + err = core.UnmarshalPrimitive(m, "permit_ibm_public_publish", &obj.PermitIBMPublicPublish) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ibm_approved", &obj.IBMApproved) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "public_approved", &obj.PublicApproved) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "portal_approval_record", &obj.PortalApprovalRecord) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "portal_url", &obj.PortalURL) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PutOfferingInstanceOptions : The PutOfferingInstance options. +type PutOfferingInstanceOptions struct { + // Version Instance identifier. + InstanceIdentifier *string `json:"instance_identifier" validate:"required,ne="` + + // IAM Refresh token. + XAuthRefreshToken *string `json:"X-Auth-Refresh-Token" validate:"required"` + + // provisioned instance ID (part of the CRN). + ID *string `json:"id,omitempty"` + + // Cloudant revision. + Rev *string `json:"_rev,omitempty"` + + // url reference to this object. + URL *string `json:"url,omitempty"` + + // platform CRN for this instance. + CRN *string `json:"crn,omitempty"` + + // the label for this instance. + Label *string `json:"label,omitempty"` + + // Catalog ID this instance was created from. + CatalogID *string `json:"catalog_id,omitempty"` + + // Offering ID this instance was created from. + OfferingID *string `json:"offering_id,omitempty"` + + // the format this instance has (helm, operator, ova...). + KindFormat *string `json:"kind_format,omitempty"` + + // The version this instance was installed from (semver - not version id). + Version *string `json:"version,omitempty"` + + // The version id this instance was installed from (version id - not semver). + VersionID *string `json:"version_id,omitempty"` + + // Cluster ID. + ClusterID *string `json:"cluster_id,omitempty"` + + // Cluster region (e.g., us-south). + ClusterRegion *string `json:"cluster_region,omitempty"` + + // List of target namespaces to install into. + ClusterNamespaces []string `json:"cluster_namespaces,omitempty"` + + // designate to install into all namespaces. + ClusterAllNamespaces *bool `json:"cluster_all_namespaces,omitempty"` + + // Id of the schematics workspace, for offering instances provisioned through schematics. + SchematicsWorkspaceID *string `json:"schematics_workspace_id,omitempty"` + + // Type of install plan (also known as approval strategy) for operator subscriptions. Can be either automatic, which + // automatically upgrades operators to the latest in a channel, or manual, which requires approval on the cluster. + InstallPlan *string `json:"install_plan,omitempty"` + + // Channel to pin the operator subscription to. + Channel *string `json:"channel,omitempty"` + + // date and time create. + Created *strfmt.DateTime `json:"created,omitempty"` + + // date and time updated. + Updated *strfmt.DateTime `json:"updated,omitempty"` + + // Map of metadata values for this offering instance. + Metadata map[string]interface{} `json:"metadata,omitempty"` + + // Id of the resource group to provision the offering instance into. + ResourceGroupID *string `json:"resource_group_id,omitempty"` + + // String location of OfferingInstance deployment. + Location *string `json:"location,omitempty"` + + // Indicates if Resource Controller has disabled this instance. + Disabled *bool `json:"disabled,omitempty"` + + // The account this instance is owned by. + Account *string `json:"account,omitempty"` + + // the last operation performed and status. + LastOperation *OfferingInstanceLastOperation `json:"last_operation,omitempty"` + + // The target kind for the installed software version. + KindTarget *string `json:"kind_target,omitempty"` + + // The digest value of the installed software version. + Sha *string `json:"sha,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewPutOfferingInstanceOptions : Instantiate PutOfferingInstanceOptions +func (*CatalogManagementV1) NewPutOfferingInstanceOptions(instanceIdentifier string, xAuthRefreshToken string) *PutOfferingInstanceOptions { + return &PutOfferingInstanceOptions{ + InstanceIdentifier: core.StringPtr(instanceIdentifier), + XAuthRefreshToken: core.StringPtr(xAuthRefreshToken), + } +} + +// SetInstanceIdentifier : Allow user to set InstanceIdentifier +func (_options *PutOfferingInstanceOptions) SetInstanceIdentifier(instanceIdentifier string) *PutOfferingInstanceOptions { + _options.InstanceIdentifier = core.StringPtr(instanceIdentifier) + return _options +} + +// SetXAuthRefreshToken : Allow user to set XAuthRefreshToken +func (_options *PutOfferingInstanceOptions) SetXAuthRefreshToken(xAuthRefreshToken string) *PutOfferingInstanceOptions { + _options.XAuthRefreshToken = core.StringPtr(xAuthRefreshToken) + return _options +} + +// SetID : Allow user to set ID +func (_options *PutOfferingInstanceOptions) SetID(id string) *PutOfferingInstanceOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetRev : Allow user to set Rev +func (_options *PutOfferingInstanceOptions) SetRev(rev string) *PutOfferingInstanceOptions { + _options.Rev = core.StringPtr(rev) + return _options +} + +// SetURL : Allow user to set URL +func (_options *PutOfferingInstanceOptions) SetURL(url string) *PutOfferingInstanceOptions { + _options.URL = core.StringPtr(url) + return _options +} + +// SetCRN : Allow user to set CRN +func (_options *PutOfferingInstanceOptions) SetCRN(crn string) *PutOfferingInstanceOptions { + _options.CRN = core.StringPtr(crn) + return _options +} + +// SetLabel : Allow user to set Label +func (_options *PutOfferingInstanceOptions) SetLabel(label string) *PutOfferingInstanceOptions { + _options.Label = core.StringPtr(label) + return _options +} + +// SetCatalogID : Allow user to set CatalogID +func (_options *PutOfferingInstanceOptions) SetCatalogID(catalogID string) *PutOfferingInstanceOptions { + _options.CatalogID = core.StringPtr(catalogID) + return _options +} + +// SetOfferingID : Allow user to set OfferingID +func (_options *PutOfferingInstanceOptions) SetOfferingID(offeringID string) *PutOfferingInstanceOptions { + _options.OfferingID = core.StringPtr(offeringID) + return _options +} + +// SetKindFormat : Allow user to set KindFormat +func (_options *PutOfferingInstanceOptions) SetKindFormat(kindFormat string) *PutOfferingInstanceOptions { + _options.KindFormat = core.StringPtr(kindFormat) + return _options +} + +// SetVersion : Allow user to set Version +func (_options *PutOfferingInstanceOptions) SetVersion(version string) *PutOfferingInstanceOptions { + _options.Version = core.StringPtr(version) + return _options +} + +// SetVersionID : Allow user to set VersionID +func (_options *PutOfferingInstanceOptions) SetVersionID(versionID string) *PutOfferingInstanceOptions { + _options.VersionID = core.StringPtr(versionID) + return _options +} + +// SetClusterID : Allow user to set ClusterID +func (_options *PutOfferingInstanceOptions) SetClusterID(clusterID string) *PutOfferingInstanceOptions { + _options.ClusterID = core.StringPtr(clusterID) + return _options +} + +// SetClusterRegion : Allow user to set ClusterRegion +func (_options *PutOfferingInstanceOptions) SetClusterRegion(clusterRegion string) *PutOfferingInstanceOptions { + _options.ClusterRegion = core.StringPtr(clusterRegion) + return _options +} + +// SetClusterNamespaces : Allow user to set ClusterNamespaces +func (_options *PutOfferingInstanceOptions) SetClusterNamespaces(clusterNamespaces []string) *PutOfferingInstanceOptions { + _options.ClusterNamespaces = clusterNamespaces + return _options +} + +// SetClusterAllNamespaces : Allow user to set ClusterAllNamespaces +func (_options *PutOfferingInstanceOptions) SetClusterAllNamespaces(clusterAllNamespaces bool) *PutOfferingInstanceOptions { + _options.ClusterAllNamespaces = core.BoolPtr(clusterAllNamespaces) + return _options +} + +// SetSchematicsWorkspaceID : Allow user to set SchematicsWorkspaceID +func (_options *PutOfferingInstanceOptions) SetSchematicsWorkspaceID(schematicsWorkspaceID string) *PutOfferingInstanceOptions { + _options.SchematicsWorkspaceID = core.StringPtr(schematicsWorkspaceID) + return _options +} + +// SetInstallPlan : Allow user to set InstallPlan +func (_options *PutOfferingInstanceOptions) SetInstallPlan(installPlan string) *PutOfferingInstanceOptions { + _options.InstallPlan = core.StringPtr(installPlan) + return _options +} + +// SetChannel : Allow user to set Channel +func (_options *PutOfferingInstanceOptions) SetChannel(channel string) *PutOfferingInstanceOptions { + _options.Channel = core.StringPtr(channel) + return _options +} + +// SetCreated : Allow user to set Created +func (_options *PutOfferingInstanceOptions) SetCreated(created *strfmt.DateTime) *PutOfferingInstanceOptions { + _options.Created = created + return _options +} + +// SetUpdated : Allow user to set Updated +func (_options *PutOfferingInstanceOptions) SetUpdated(updated *strfmt.DateTime) *PutOfferingInstanceOptions { + _options.Updated = updated + return _options +} + +// SetMetadata : Allow user to set Metadata +func (_options *PutOfferingInstanceOptions) SetMetadata(metadata map[string]interface{}) *PutOfferingInstanceOptions { + _options.Metadata = metadata + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *PutOfferingInstanceOptions) SetResourceGroupID(resourceGroupID string) *PutOfferingInstanceOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetLocation : Allow user to set Location +func (_options *PutOfferingInstanceOptions) SetLocation(location string) *PutOfferingInstanceOptions { + _options.Location = core.StringPtr(location) + return _options +} + +// SetDisabled : Allow user to set Disabled +func (_options *PutOfferingInstanceOptions) SetDisabled(disabled bool) *PutOfferingInstanceOptions { + _options.Disabled = core.BoolPtr(disabled) + return _options +} + +// SetAccount : Allow user to set Account +func (_options *PutOfferingInstanceOptions) SetAccount(account string) *PutOfferingInstanceOptions { + _options.Account = core.StringPtr(account) + return _options +} + +// SetLastOperation : Allow user to set LastOperation +func (_options *PutOfferingInstanceOptions) SetLastOperation(lastOperation *OfferingInstanceLastOperation) *PutOfferingInstanceOptions { + _options.LastOperation = lastOperation + return _options +} + +// SetKindTarget : Allow user to set KindTarget +func (_options *PutOfferingInstanceOptions) SetKindTarget(kindTarget string) *PutOfferingInstanceOptions { + _options.KindTarget = core.StringPtr(kindTarget) + return _options +} + +// SetSha : Allow user to set Sha +func (_options *PutOfferingInstanceOptions) SetSha(sha string) *PutOfferingInstanceOptions { + _options.Sha = core.StringPtr(sha) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *PutOfferingInstanceOptions) SetHeaders(param map[string]string) *PutOfferingInstanceOptions { + options.Headers = param + return options +} + +// Rating : Repository info for offerings. +type Rating struct { + // One start rating. + OneStarCount *int64 `json:"one_star_count,omitempty"` + + // Two start rating. + TwoStarCount *int64 `json:"two_star_count,omitempty"` + + // Three start rating. + ThreeStarCount *int64 `json:"three_star_count,omitempty"` + + // Four start rating. + FourStarCount *int64 `json:"four_star_count,omitempty"` +} + +// UnmarshalRating unmarshals an instance of Rating from the specified map of raw messages. +func UnmarshalRating(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Rating) + err = core.UnmarshalPrimitive(m, "one_star_count", &obj.OneStarCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "two_star_count", &obj.TwoStarCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "three_star_count", &obj.ThreeStarCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "four_star_count", &obj.FourStarCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReloadOfferingOptions : The ReloadOffering options. +type ReloadOfferingOptions struct { + // Catalog identifier. + CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` + + // Offering identification. + OfferingID *string `json:"offering_id" validate:"required,ne="` + + // The semver value for this new version. + TargetVersion *string `json:"targetVersion" validate:"required"` + + // Tags array. + Tags []string `json:"tags,omitempty"` + + // byte array representing the content to be imported. Only supported for OVA images at this time. + Content *[]byte `json:"content,omitempty"` + + // Target kinds. Current valid values are 'iks', 'roks', 'vcenter', 'power-iaas', and 'terraform'. + TargetKinds []string `json:"target_kinds,omitempty"` + + // Format of content being onboarded. Example: vsi-image. Required for virtual server image for VPC. + FormatKind *string `json:"format_kind,omitempty"` + + // Version Flavor Information. Only supported for Product kind Solution. + Flavor *Flavor `json:"flavor,omitempty"` + + // Optional - The sub-folder within the specified tgz file that contains the software being onboarded. + WorkingDirectory *string `json:"working_directory,omitempty"` + + // URL path to zip location. If not specified, must provide content in this post body. + Zipurl *string `json:"zipurl,omitempty"` + + // The type of repository containing this version. Valid values are 'public_git' or 'enterprise_git'. + RepoType *string `json:"repoType,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewReloadOfferingOptions : Instantiate ReloadOfferingOptions +func (*CatalogManagementV1) NewReloadOfferingOptions(catalogIdentifier string, offeringID string, targetVersion string) *ReloadOfferingOptions { + return &ReloadOfferingOptions{ + CatalogIdentifier: core.StringPtr(catalogIdentifier), + OfferingID: core.StringPtr(offeringID), + TargetVersion: core.StringPtr(targetVersion), + } +} + +// SetCatalogIdentifier : Allow user to set CatalogIdentifier +func (_options *ReloadOfferingOptions) SetCatalogIdentifier(catalogIdentifier string) *ReloadOfferingOptions { + _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) + return _options +} + +// SetOfferingID : Allow user to set OfferingID +func (_options *ReloadOfferingOptions) SetOfferingID(offeringID string) *ReloadOfferingOptions { + _options.OfferingID = core.StringPtr(offeringID) + return _options +} + +// SetTargetVersion : Allow user to set TargetVersion +func (_options *ReloadOfferingOptions) SetTargetVersion(targetVersion string) *ReloadOfferingOptions { + _options.TargetVersion = core.StringPtr(targetVersion) + return _options +} + +// SetTags : Allow user to set Tags +func (_options *ReloadOfferingOptions) SetTags(tags []string) *ReloadOfferingOptions { + _options.Tags = tags + return _options +} + +// SetContent : Allow user to set Content +func (_options *ReloadOfferingOptions) SetContent(content []byte) *ReloadOfferingOptions { + _options.Content = &content + return _options +} + +// SetTargetKinds : Allow user to set TargetKinds +func (_options *ReloadOfferingOptions) SetTargetKinds(targetKinds []string) *ReloadOfferingOptions { + _options.TargetKinds = targetKinds + return _options +} + +// SetFormatKind : Allow user to set FormatKind +func (_options *ReloadOfferingOptions) SetFormatKind(formatKind string) *ReloadOfferingOptions { + _options.FormatKind = core.StringPtr(formatKind) + return _options +} + +// SetFlavor : Allow user to set Flavor +func (_options *ReloadOfferingOptions) SetFlavor(flavor *Flavor) *ReloadOfferingOptions { + _options.Flavor = flavor + return _options +} + +// SetWorkingDirectory : Allow user to set WorkingDirectory +func (_options *ReloadOfferingOptions) SetWorkingDirectory(workingDirectory string) *ReloadOfferingOptions { + _options.WorkingDirectory = core.StringPtr(workingDirectory) + return _options +} + +// SetZipurl : Allow user to set Zipurl +func (_options *ReloadOfferingOptions) SetZipurl(zipurl string) *ReloadOfferingOptions { + _options.Zipurl = core.StringPtr(zipurl) + return _options +} + +// SetRepoType : Allow user to set RepoType +func (_options *ReloadOfferingOptions) SetRepoType(repoType string) *ReloadOfferingOptions { + _options.RepoType = core.StringPtr(repoType) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ReloadOfferingOptions) SetHeaders(param map[string]string) *ReloadOfferingOptions { + options.Headers = param + return options +} + +// RenderType : Render type. +type RenderType struct { + // ID of the widget type. + Type *string `json:"type,omitempty"` + + // Determines where this configuration type is rendered (3 sections today - Target, Resource, and Deployment). + Grouping *string `json:"grouping,omitempty"` + + // Original grouping type for this configuration (3 types - Target, Resource, and Deployment). + OriginalGrouping *string `json:"original_grouping,omitempty"` + + // Determines the order that this configuration item shows in that particular grouping. + GroupingIndex *int64 `json:"grouping_index,omitempty"` + + // Map of constraint parameters that will be passed to the custom widget. + ConfigConstraints interface{} `json:"config_constraints,omitempty"` + + // List of parameters that are associated with this configuration. + Associations *RenderTypeAssociations `json:"associations,omitempty"` +} + +// UnmarshalRenderType unmarshals an instance of RenderType from the specified map of raw messages. +func UnmarshalRenderType(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RenderType) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "grouping", &obj.Grouping) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "original_grouping", &obj.OriginalGrouping) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "grouping_index", &obj.GroupingIndex) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "config_constraints", &obj.ConfigConstraints) + if err != nil { + return + } + err = core.UnmarshalModel(m, "associations", &obj.Associations, UnmarshalRenderTypeAssociations) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RenderTypeAssociations : List of parameters that are associated with this configuration. +type RenderTypeAssociations struct { + // Parameters for this association. + Parameters []RenderTypeAssociationsParametersItem `json:"parameters,omitempty"` +} + +// UnmarshalRenderTypeAssociations unmarshals an instance of RenderTypeAssociations from the specified map of raw messages. +func UnmarshalRenderTypeAssociations(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RenderTypeAssociations) + err = core.UnmarshalModel(m, "parameters", &obj.Parameters, UnmarshalRenderTypeAssociationsParametersItem) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RenderTypeAssociationsParametersItem : RenderTypeAssociationsParametersItem struct +type RenderTypeAssociationsParametersItem struct { + // Name of this parameter. + Name *string `json:"name,omitempty"` + + // Refresh options. + OptionsRefresh *bool `json:"optionsRefresh,omitempty"` +} + +// UnmarshalRenderTypeAssociationsParametersItem unmarshals an instance of RenderTypeAssociationsParametersItem from the specified map of raw messages. +func UnmarshalRenderTypeAssociationsParametersItem(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RenderTypeAssociationsParametersItem) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "optionsRefresh", &obj.OptionsRefresh) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReplaceCatalogOptions : The ReplaceCatalog options. +type ReplaceCatalogOptions struct { + // Catalog identifier. + CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` + + // Unique ID. + ID *string `json:"id,omitempty"` + + // Cloudant revision. + Rev *string `json:"_rev,omitempty"` + + // Display Name in the requested language. + Label *string `json:"label,omitempty"` + + // A map of translated strings, by language code. + LabelI18n map[string]string `json:"label_i18n,omitempty"` + + // Description in the requested language. + ShortDescription *string `json:"short_description,omitempty"` + + // A map of translated strings, by language code. + ShortDescriptionI18n map[string]string `json:"short_description_i18n,omitempty"` + + // URL for an icon associated with this catalog. + CatalogIconURL *string `json:"catalog_icon_url,omitempty"` + + // List of tags associated with this catalog. + Tags []string `json:"tags,omitempty"` + + // List of features associated with this catalog. + Features []Feature `json:"features,omitempty"` + + // Denotes whether a catalog is disabled. + Disabled *bool `json:"disabled,omitempty"` + + // Resource group id the catalog is owned by. + ResourceGroupID *string `json:"resource_group_id,omitempty"` + + // Account that owns catalog. + OwningAccount *string `json:"owning_account,omitempty"` + + // Filters for account and catalog filters. + CatalogFilters *Filters `json:"catalog_filters,omitempty"` + + // Feature information. + SyndicationSettings *SyndicationResource `json:"syndication_settings,omitempty"` + + // Kind of catalog. Supported kinds are offering and vpe. + Kind *string `json:"kind,omitempty"` + + // Catalog specific metadata. + Metadata map[string]interface{} `json:"metadata,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewReplaceCatalogOptions : Instantiate ReplaceCatalogOptions +func (*CatalogManagementV1) NewReplaceCatalogOptions(catalogIdentifier string) *ReplaceCatalogOptions { + return &ReplaceCatalogOptions{ + CatalogIdentifier: core.StringPtr(catalogIdentifier), + } +} + +// SetCatalogIdentifier : Allow user to set CatalogIdentifier +func (_options *ReplaceCatalogOptions) SetCatalogIdentifier(catalogIdentifier string) *ReplaceCatalogOptions { + _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) + return _options +} + +// SetID : Allow user to set ID +func (_options *ReplaceCatalogOptions) SetID(id string) *ReplaceCatalogOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetRev : Allow user to set Rev +func (_options *ReplaceCatalogOptions) SetRev(rev string) *ReplaceCatalogOptions { + _options.Rev = core.StringPtr(rev) + return _options +} + +// SetLabel : Allow user to set Label +func (_options *ReplaceCatalogOptions) SetLabel(label string) *ReplaceCatalogOptions { + _options.Label = core.StringPtr(label) + return _options +} + +// SetLabelI18n : Allow user to set LabelI18n +func (_options *ReplaceCatalogOptions) SetLabelI18n(labelI18n map[string]string) *ReplaceCatalogOptions { + _options.LabelI18n = labelI18n + return _options +} + +// SetShortDescription : Allow user to set ShortDescription +func (_options *ReplaceCatalogOptions) SetShortDescription(shortDescription string) *ReplaceCatalogOptions { + _options.ShortDescription = core.StringPtr(shortDescription) + return _options +} + +// SetShortDescriptionI18n : Allow user to set ShortDescriptionI18n +func (_options *ReplaceCatalogOptions) SetShortDescriptionI18n(shortDescriptionI18n map[string]string) *ReplaceCatalogOptions { + _options.ShortDescriptionI18n = shortDescriptionI18n + return _options +} + +// SetCatalogIconURL : Allow user to set CatalogIconURL +func (_options *ReplaceCatalogOptions) SetCatalogIconURL(catalogIconURL string) *ReplaceCatalogOptions { + _options.CatalogIconURL = core.StringPtr(catalogIconURL) + return _options +} + +// SetTags : Allow user to set Tags +func (_options *ReplaceCatalogOptions) SetTags(tags []string) *ReplaceCatalogOptions { + _options.Tags = tags + return _options +} + +// SetFeatures : Allow user to set Features +func (_options *ReplaceCatalogOptions) SetFeatures(features []Feature) *ReplaceCatalogOptions { + _options.Features = features + return _options +} + +// SetDisabled : Allow user to set Disabled +func (_options *ReplaceCatalogOptions) SetDisabled(disabled bool) *ReplaceCatalogOptions { + _options.Disabled = core.BoolPtr(disabled) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ReplaceCatalogOptions) SetResourceGroupID(resourceGroupID string) *ReplaceCatalogOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetOwningAccount : Allow user to set OwningAccount +func (_options *ReplaceCatalogOptions) SetOwningAccount(owningAccount string) *ReplaceCatalogOptions { + _options.OwningAccount = core.StringPtr(owningAccount) + return _options +} + +// SetCatalogFilters : Allow user to set CatalogFilters +func (_options *ReplaceCatalogOptions) SetCatalogFilters(catalogFilters *Filters) *ReplaceCatalogOptions { + _options.CatalogFilters = catalogFilters + return _options +} + +// SetSyndicationSettings : Allow user to set SyndicationSettings +func (_options *ReplaceCatalogOptions) SetSyndicationSettings(syndicationSettings *SyndicationResource) *ReplaceCatalogOptions { + _options.SyndicationSettings = syndicationSettings + return _options +} + +// SetKind : Allow user to set Kind +func (_options *ReplaceCatalogOptions) SetKind(kind string) *ReplaceCatalogOptions { + _options.Kind = core.StringPtr(kind) + return _options +} + +// SetMetadata : Allow user to set Metadata +func (_options *ReplaceCatalogOptions) SetMetadata(metadata map[string]interface{}) *ReplaceCatalogOptions { + _options.Metadata = metadata + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ReplaceCatalogOptions) SetHeaders(param map[string]string) *ReplaceCatalogOptions { + options.Headers = param + return options +} + +// ReplaceObjectOptions : The ReplaceObject options. +type ReplaceObjectOptions struct { + // Catalog identifier. + CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` + + // Object identifier. + ObjectIdentifier *string `json:"object_identifier" validate:"required,ne="` + + // unique id. + ID *string `json:"id,omitempty"` + + // The programmatic name of this object. + Name *string `json:"name,omitempty"` + + // Cloudant revision. + Rev *string `json:"_rev,omitempty"` + + // The crn for this specific object. + CRN *string `json:"crn,omitempty"` + + // The url for this specific object. + URL *string `json:"url,omitempty"` + + // The parent for this specific object. + ParentID *string `json:"parent_id,omitempty"` + + // A map of translated strings, by language code. + LabelI18n map[string]string `json:"label_i18n,omitempty"` + + // Display name in the requested language. + Label *string `json:"label,omitempty"` + + // List of tags associated with this catalog. + Tags []string `json:"tags,omitempty"` + + // The date and time this catalog was created. + Created *strfmt.DateTime `json:"created,omitempty"` + + // The date and time this catalog was last updated. + Updated *strfmt.DateTime `json:"updated,omitempty"` + + // Short description in the requested language. + ShortDescription *string `json:"short_description,omitempty"` + + // A map of translated strings, by language code. + ShortDescriptionI18n map[string]string `json:"short_description_i18n,omitempty"` + + // Kind of object. + Kind *string `json:"kind,omitempty"` + + // Publish information. + Publish *PublishObject `json:"publish,omitempty"` + + // Offering state. + State *State `json:"state,omitempty"` + + // The id of the catalog containing this offering. + CatalogID *string `json:"catalog_id,omitempty"` + + // The name of the catalog. + CatalogName *string `json:"catalog_name,omitempty"` + + // Map of data values for this object. + Data map[string]interface{} `json:"data,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewReplaceObjectOptions : Instantiate ReplaceObjectOptions +func (*CatalogManagementV1) NewReplaceObjectOptions(catalogIdentifier string, objectIdentifier string) *ReplaceObjectOptions { + return &ReplaceObjectOptions{ + CatalogIdentifier: core.StringPtr(catalogIdentifier), + ObjectIdentifier: core.StringPtr(objectIdentifier), + } +} + +// SetCatalogIdentifier : Allow user to set CatalogIdentifier +func (_options *ReplaceObjectOptions) SetCatalogIdentifier(catalogIdentifier string) *ReplaceObjectOptions { + _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) + return _options +} + +// SetObjectIdentifier : Allow user to set ObjectIdentifier +func (_options *ReplaceObjectOptions) SetObjectIdentifier(objectIdentifier string) *ReplaceObjectOptions { + _options.ObjectIdentifier = core.StringPtr(objectIdentifier) + return _options +} + +// SetID : Allow user to set ID +func (_options *ReplaceObjectOptions) SetID(id string) *ReplaceObjectOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetName : Allow user to set Name +func (_options *ReplaceObjectOptions) SetName(name string) *ReplaceObjectOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetRev : Allow user to set Rev +func (_options *ReplaceObjectOptions) SetRev(rev string) *ReplaceObjectOptions { + _options.Rev = core.StringPtr(rev) + return _options +} + +// SetCRN : Allow user to set CRN +func (_options *ReplaceObjectOptions) SetCRN(crn string) *ReplaceObjectOptions { + _options.CRN = core.StringPtr(crn) + return _options +} + +// SetURL : Allow user to set URL +func (_options *ReplaceObjectOptions) SetURL(url string) *ReplaceObjectOptions { + _options.URL = core.StringPtr(url) + return _options +} + +// SetParentID : Allow user to set ParentID +func (_options *ReplaceObjectOptions) SetParentID(parentID string) *ReplaceObjectOptions { + _options.ParentID = core.StringPtr(parentID) + return _options +} + +// SetLabelI18n : Allow user to set LabelI18n +func (_options *ReplaceObjectOptions) SetLabelI18n(labelI18n map[string]string) *ReplaceObjectOptions { + _options.LabelI18n = labelI18n + return _options +} + +// SetLabel : Allow user to set Label +func (_options *ReplaceObjectOptions) SetLabel(label string) *ReplaceObjectOptions { + _options.Label = core.StringPtr(label) + return _options +} + +// SetTags : Allow user to set Tags +func (_options *ReplaceObjectOptions) SetTags(tags []string) *ReplaceObjectOptions { + _options.Tags = tags + return _options +} + +// SetCreated : Allow user to set Created +func (_options *ReplaceObjectOptions) SetCreated(created *strfmt.DateTime) *ReplaceObjectOptions { + _options.Created = created + return _options +} + +// SetUpdated : Allow user to set Updated +func (_options *ReplaceObjectOptions) SetUpdated(updated *strfmt.DateTime) *ReplaceObjectOptions { + _options.Updated = updated + return _options +} + +// SetShortDescription : Allow user to set ShortDescription +func (_options *ReplaceObjectOptions) SetShortDescription(shortDescription string) *ReplaceObjectOptions { + _options.ShortDescription = core.StringPtr(shortDescription) + return _options +} + +// SetShortDescriptionI18n : Allow user to set ShortDescriptionI18n +func (_options *ReplaceObjectOptions) SetShortDescriptionI18n(shortDescriptionI18n map[string]string) *ReplaceObjectOptions { + _options.ShortDescriptionI18n = shortDescriptionI18n + return _options +} + +// SetKind : Allow user to set Kind +func (_options *ReplaceObjectOptions) SetKind(kind string) *ReplaceObjectOptions { + _options.Kind = core.StringPtr(kind) + return _options +} + +// SetPublish : Allow user to set Publish +func (_options *ReplaceObjectOptions) SetPublish(publish *PublishObject) *ReplaceObjectOptions { + _options.Publish = publish + return _options +} + +// SetState : Allow user to set State +func (_options *ReplaceObjectOptions) SetState(state *State) *ReplaceObjectOptions { + _options.State = state + return _options +} + +// SetCatalogID : Allow user to set CatalogID +func (_options *ReplaceObjectOptions) SetCatalogID(catalogID string) *ReplaceObjectOptions { + _options.CatalogID = core.StringPtr(catalogID) + return _options +} + +// SetCatalogName : Allow user to set CatalogName +func (_options *ReplaceObjectOptions) SetCatalogName(catalogName string) *ReplaceObjectOptions { + _options.CatalogName = core.StringPtr(catalogName) + return _options +} + +// SetData : Allow user to set Data +func (_options *ReplaceObjectOptions) SetData(data map[string]interface{}) *ReplaceObjectOptions { + _options.Data = data + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ReplaceObjectOptions) SetHeaders(param map[string]string) *ReplaceObjectOptions { + options.Headers = param + return options +} + +// ReplaceOfferingOptions : The ReplaceOffering options. +type ReplaceOfferingOptions struct { + // Catalog identifier. + CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` + + // Offering identification. + OfferingID *string `json:"offering_id" validate:"required,ne="` + + // unique id. + ID *string `json:"id,omitempty"` + + // Cloudant revision. + Rev *string `json:"_rev,omitempty"` + + // The url for this specific offering. + URL *string `json:"url,omitempty"` + + // The crn for this specific offering. + CRN *string `json:"crn,omitempty"` + + // Display Name in the requested language. + Label *string `json:"label,omitempty"` + + // A map of translated strings, by language code. + LabelI18n map[string]string `json:"label_i18n,omitempty"` + + // The programmatic name of this offering. + Name *string `json:"name,omitempty"` + + // URL for an icon associated with this offering. + OfferingIconURL *string `json:"offering_icon_url,omitempty"` + + // URL for an additional docs with this offering. + OfferingDocsURL *string `json:"offering_docs_url,omitempty"` + + // [deprecated] - Use offering.support instead. URL to be displayed in the Consumption UI for getting support on this + // offering. + OfferingSupportURL *string `json:"offering_support_url,omitempty"` + + // List of tags associated with this catalog. + Tags []string `json:"tags,omitempty"` + + // List of keywords associated with offering, typically used to search for it. + Keywords []string `json:"keywords,omitempty"` + + // Repository info for offerings. + Rating *Rating `json:"rating,omitempty"` + + // The date and time this catalog was created. + Created *strfmt.DateTime `json:"created,omitempty"` + + // The date and time this catalog was last updated. + Updated *strfmt.DateTime `json:"updated,omitempty"` + + // Short description in the requested language. + ShortDescription *string `json:"short_description,omitempty"` + + // A map of translated strings, by language code. + ShortDescriptionI18n map[string]string `json:"short_description_i18n,omitempty"` + + // Long description in the requested language. + LongDescription *string `json:"long_description,omitempty"` + + // A map of translated strings, by language code. + LongDescriptionI18n map[string]string `json:"long_description_i18n,omitempty"` + + // list of features associated with this offering. + Features []Feature `json:"features,omitempty"` + + // Array of kind. + Kinds []Kind `json:"kinds,omitempty"` + + // Offering is managed by Partner Center. + PcManaged *bool `json:"pc_managed,omitempty"` + + // Offering has been approved to publish to permitted to IBM or Public Catalog. + PublishApproved *bool `json:"publish_approved,omitempty"` + + // Denotes public availability of an Offering - if share_enabled is true. + ShareWithAll *bool `json:"share_with_all,omitempty"` + + // Denotes IBM employee availability of an Offering - if share_enabled is true. + ShareWithIBM *bool `json:"share_with_ibm,omitempty"` + + // Denotes sharing including access list availability of an Offering is enabled. + ShareEnabled *bool `json:"share_enabled,omitempty"` + + // Is it permitted to request publishing to IBM or Public. + PermitRequestIBMPublicPublish *bool `json:"permit_request_ibm_public_publish,omitempty"` + + // Indicates if this offering has been approved for use by all IBMers. + IBMPublishApproved *bool `json:"ibm_publish_approved,omitempty"` + + // Indicates if this offering has been approved for use by all IBM Cloud users. + PublicPublishApproved *bool `json:"public_publish_approved,omitempty"` + + // The original offering CRN that this publish entry came from. + PublicOriginalCRN *string `json:"public_original_crn,omitempty"` + + // The crn of the public catalog entry of this offering. + PublishPublicCRN *string `json:"publish_public_crn,omitempty"` + + // The portal's approval record ID. + PortalApprovalRecord *string `json:"portal_approval_record,omitempty"` + + // The portal UI URL. + PortalUIURL *string `json:"portal_ui_url,omitempty"` + + // The id of the catalog containing this offering. + CatalogID *string `json:"catalog_id,omitempty"` + + // The name of the catalog. + CatalogName *string `json:"catalog_name,omitempty"` + + // Map of metadata values for this offering. + Metadata map[string]interface{} `json:"metadata,omitempty"` + + // A disclaimer for this offering. + Disclaimer *string `json:"disclaimer,omitempty"` + + // Determine if this offering should be displayed in the Consumption UI. + Hidden *bool `json:"hidden,omitempty"` + + // Deprecated - Provider of this offering. + Provider *string `json:"provider,omitempty"` + + // Information on the provider for this offering, or omitted if no provider information is given. + ProviderInfo *ProviderInfo `json:"provider_info,omitempty"` + + // Repository info for offerings. + RepoInfo *RepoInfo `json:"repo_info,omitempty"` + + // Image pull keys for this offering. + ImagePullKeys []ImagePullKey `json:"image_pull_keys,omitempty"` + + // Offering Support information. + Support *Support `json:"support,omitempty"` + + // A list of media items related to this offering. + Media []MediaItem `json:"media,omitempty"` + + // Deprecation information for an Offering. + DeprecatePending *DeprecatePending `json:"deprecate_pending,omitempty"` + + // The product kind. Valid values are module, solution, or empty string. + ProductKind *string `json:"product_kind,omitempty"` + + // A list of badges for this offering. + Badges []Badge `json:"badges,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewReplaceOfferingOptions : Instantiate ReplaceOfferingOptions +func (*CatalogManagementV1) NewReplaceOfferingOptions(catalogIdentifier string, offeringID string) *ReplaceOfferingOptions { + return &ReplaceOfferingOptions{ + CatalogIdentifier: core.StringPtr(catalogIdentifier), + OfferingID: core.StringPtr(offeringID), + } +} + +// SetCatalogIdentifier : Allow user to set CatalogIdentifier +func (_options *ReplaceOfferingOptions) SetCatalogIdentifier(catalogIdentifier string) *ReplaceOfferingOptions { + _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) + return _options +} + +// SetOfferingID : Allow user to set OfferingID +func (_options *ReplaceOfferingOptions) SetOfferingID(offeringID string) *ReplaceOfferingOptions { + _options.OfferingID = core.StringPtr(offeringID) + return _options +} + +// SetID : Allow user to set ID +func (_options *ReplaceOfferingOptions) SetID(id string) *ReplaceOfferingOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetRev : Allow user to set Rev +func (_options *ReplaceOfferingOptions) SetRev(rev string) *ReplaceOfferingOptions { + _options.Rev = core.StringPtr(rev) + return _options +} + +// SetURL : Allow user to set URL +func (_options *ReplaceOfferingOptions) SetURL(url string) *ReplaceOfferingOptions { + _options.URL = core.StringPtr(url) + return _options +} + +// SetCRN : Allow user to set CRN +func (_options *ReplaceOfferingOptions) SetCRN(crn string) *ReplaceOfferingOptions { + _options.CRN = core.StringPtr(crn) + return _options +} + +// SetLabel : Allow user to set Label +func (_options *ReplaceOfferingOptions) SetLabel(label string) *ReplaceOfferingOptions { + _options.Label = core.StringPtr(label) + return _options +} + +// SetLabelI18n : Allow user to set LabelI18n +func (_options *ReplaceOfferingOptions) SetLabelI18n(labelI18n map[string]string) *ReplaceOfferingOptions { + _options.LabelI18n = labelI18n + return _options +} + +// SetName : Allow user to set Name +func (_options *ReplaceOfferingOptions) SetName(name string) *ReplaceOfferingOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetOfferingIconURL : Allow user to set OfferingIconURL +func (_options *ReplaceOfferingOptions) SetOfferingIconURL(offeringIconURL string) *ReplaceOfferingOptions { + _options.OfferingIconURL = core.StringPtr(offeringIconURL) + return _options +} + +// SetOfferingDocsURL : Allow user to set OfferingDocsURL +func (_options *ReplaceOfferingOptions) SetOfferingDocsURL(offeringDocsURL string) *ReplaceOfferingOptions { + _options.OfferingDocsURL = core.StringPtr(offeringDocsURL) + return _options +} + +// SetOfferingSupportURL : Allow user to set OfferingSupportURL +func (_options *ReplaceOfferingOptions) SetOfferingSupportURL(offeringSupportURL string) *ReplaceOfferingOptions { + _options.OfferingSupportURL = core.StringPtr(offeringSupportURL) + return _options +} + +// SetTags : Allow user to set Tags +func (_options *ReplaceOfferingOptions) SetTags(tags []string) *ReplaceOfferingOptions { + _options.Tags = tags + return _options +} + +// SetKeywords : Allow user to set Keywords +func (_options *ReplaceOfferingOptions) SetKeywords(keywords []string) *ReplaceOfferingOptions { + _options.Keywords = keywords + return _options +} + +// SetRating : Allow user to set Rating +func (_options *ReplaceOfferingOptions) SetRating(rating *Rating) *ReplaceOfferingOptions { + _options.Rating = rating + return _options +} + +// SetCreated : Allow user to set Created +func (_options *ReplaceOfferingOptions) SetCreated(created *strfmt.DateTime) *ReplaceOfferingOptions { + _options.Created = created + return _options +} + +// SetUpdated : Allow user to set Updated +func (_options *ReplaceOfferingOptions) SetUpdated(updated *strfmt.DateTime) *ReplaceOfferingOptions { + _options.Updated = updated + return _options +} + +// SetShortDescription : Allow user to set ShortDescription +func (_options *ReplaceOfferingOptions) SetShortDescription(shortDescription string) *ReplaceOfferingOptions { + _options.ShortDescription = core.StringPtr(shortDescription) + return _options +} + +// SetShortDescriptionI18n : Allow user to set ShortDescriptionI18n +func (_options *ReplaceOfferingOptions) SetShortDescriptionI18n(shortDescriptionI18n map[string]string) *ReplaceOfferingOptions { + _options.ShortDescriptionI18n = shortDescriptionI18n + return _options +} + +// SetLongDescription : Allow user to set LongDescription +func (_options *ReplaceOfferingOptions) SetLongDescription(longDescription string) *ReplaceOfferingOptions { + _options.LongDescription = core.StringPtr(longDescription) + return _options +} + +// SetLongDescriptionI18n : Allow user to set LongDescriptionI18n +func (_options *ReplaceOfferingOptions) SetLongDescriptionI18n(longDescriptionI18n map[string]string) *ReplaceOfferingOptions { + _options.LongDescriptionI18n = longDescriptionI18n + return _options +} + +// SetFeatures : Allow user to set Features +func (_options *ReplaceOfferingOptions) SetFeatures(features []Feature) *ReplaceOfferingOptions { + _options.Features = features + return _options +} + +// SetKinds : Allow user to set Kinds +func (_options *ReplaceOfferingOptions) SetKinds(kinds []Kind) *ReplaceOfferingOptions { + _options.Kinds = kinds + return _options +} + +// SetPcManaged : Allow user to set PcManaged +func (_options *ReplaceOfferingOptions) SetPcManaged(pcManaged bool) *ReplaceOfferingOptions { + _options.PcManaged = core.BoolPtr(pcManaged) + return _options +} + +// SetPublishApproved : Allow user to set PublishApproved +func (_options *ReplaceOfferingOptions) SetPublishApproved(publishApproved bool) *ReplaceOfferingOptions { + _options.PublishApproved = core.BoolPtr(publishApproved) + return _options +} + +// SetShareWithAll : Allow user to set ShareWithAll +func (_options *ReplaceOfferingOptions) SetShareWithAll(shareWithAll bool) *ReplaceOfferingOptions { + _options.ShareWithAll = core.BoolPtr(shareWithAll) + return _options +} + +// SetShareWithIBM : Allow user to set ShareWithIBM +func (_options *ReplaceOfferingOptions) SetShareWithIBM(shareWithIBM bool) *ReplaceOfferingOptions { + _options.ShareWithIBM = core.BoolPtr(shareWithIBM) + return _options +} + +// SetShareEnabled : Allow user to set ShareEnabled +func (_options *ReplaceOfferingOptions) SetShareEnabled(shareEnabled bool) *ReplaceOfferingOptions { + _options.ShareEnabled = core.BoolPtr(shareEnabled) + return _options +} + +// SetPermitRequestIBMPublicPublish : Allow user to set PermitRequestIBMPublicPublish +func (_options *ReplaceOfferingOptions) SetPermitRequestIBMPublicPublish(permitRequestIBMPublicPublish bool) *ReplaceOfferingOptions { + _options.PermitRequestIBMPublicPublish = core.BoolPtr(permitRequestIBMPublicPublish) + return _options +} + +// SetIBMPublishApproved : Allow user to set IBMPublishApproved +func (_options *ReplaceOfferingOptions) SetIBMPublishApproved(ibmPublishApproved bool) *ReplaceOfferingOptions { + _options.IBMPublishApproved = core.BoolPtr(ibmPublishApproved) + return _options +} + +// SetPublicPublishApproved : Allow user to set PublicPublishApproved +func (_options *ReplaceOfferingOptions) SetPublicPublishApproved(publicPublishApproved bool) *ReplaceOfferingOptions { + _options.PublicPublishApproved = core.BoolPtr(publicPublishApproved) + return _options +} + +// SetPublicOriginalCRN : Allow user to set PublicOriginalCRN +func (_options *ReplaceOfferingOptions) SetPublicOriginalCRN(publicOriginalCRN string) *ReplaceOfferingOptions { + _options.PublicOriginalCRN = core.StringPtr(publicOriginalCRN) + return _options +} + +// SetPublishPublicCRN : Allow user to set PublishPublicCRN +func (_options *ReplaceOfferingOptions) SetPublishPublicCRN(publishPublicCRN string) *ReplaceOfferingOptions { + _options.PublishPublicCRN = core.StringPtr(publishPublicCRN) + return _options +} + +// SetPortalApprovalRecord : Allow user to set PortalApprovalRecord +func (_options *ReplaceOfferingOptions) SetPortalApprovalRecord(portalApprovalRecord string) *ReplaceOfferingOptions { + _options.PortalApprovalRecord = core.StringPtr(portalApprovalRecord) + return _options +} + +// SetPortalUIURL : Allow user to set PortalUIURL +func (_options *ReplaceOfferingOptions) SetPortalUIURL(portalUIURL string) *ReplaceOfferingOptions { + _options.PortalUIURL = core.StringPtr(portalUIURL) + return _options +} + +// SetCatalogID : Allow user to set CatalogID +func (_options *ReplaceOfferingOptions) SetCatalogID(catalogID string) *ReplaceOfferingOptions { + _options.CatalogID = core.StringPtr(catalogID) + return _options +} + +// SetCatalogName : Allow user to set CatalogName +func (_options *ReplaceOfferingOptions) SetCatalogName(catalogName string) *ReplaceOfferingOptions { + _options.CatalogName = core.StringPtr(catalogName) + return _options +} + +// SetMetadata : Allow user to set Metadata +func (_options *ReplaceOfferingOptions) SetMetadata(metadata map[string]interface{}) *ReplaceOfferingOptions { + _options.Metadata = metadata + return _options +} + +// SetDisclaimer : Allow user to set Disclaimer +func (_options *ReplaceOfferingOptions) SetDisclaimer(disclaimer string) *ReplaceOfferingOptions { + _options.Disclaimer = core.StringPtr(disclaimer) + return _options +} + +// SetHidden : Allow user to set Hidden +func (_options *ReplaceOfferingOptions) SetHidden(hidden bool) *ReplaceOfferingOptions { + _options.Hidden = core.BoolPtr(hidden) + return _options +} + +// SetProvider : Allow user to set Provider +func (_options *ReplaceOfferingOptions) SetProvider(provider string) *ReplaceOfferingOptions { + _options.Provider = core.StringPtr(provider) + return _options +} + +// SetProviderInfo : Allow user to set ProviderInfo +func (_options *ReplaceOfferingOptions) SetProviderInfo(providerInfo *ProviderInfo) *ReplaceOfferingOptions { + _options.ProviderInfo = providerInfo + return _options +} + +// SetRepoInfo : Allow user to set RepoInfo +func (_options *ReplaceOfferingOptions) SetRepoInfo(repoInfo *RepoInfo) *ReplaceOfferingOptions { + _options.RepoInfo = repoInfo + return _options +} + +// SetImagePullKeys : Allow user to set ImagePullKeys +func (_options *ReplaceOfferingOptions) SetImagePullKeys(imagePullKeys []ImagePullKey) *ReplaceOfferingOptions { + _options.ImagePullKeys = imagePullKeys + return _options +} + +// SetSupport : Allow user to set Support +func (_options *ReplaceOfferingOptions) SetSupport(support *Support) *ReplaceOfferingOptions { + _options.Support = support + return _options +} + +// SetMedia : Allow user to set Media +func (_options *ReplaceOfferingOptions) SetMedia(media []MediaItem) *ReplaceOfferingOptions { + _options.Media = media + return _options +} + +// SetDeprecatePending : Allow user to set DeprecatePending +func (_options *ReplaceOfferingOptions) SetDeprecatePending(deprecatePending *DeprecatePending) *ReplaceOfferingOptions { + _options.DeprecatePending = deprecatePending + return _options +} + +// SetProductKind : Allow user to set ProductKind +func (_options *ReplaceOfferingOptions) SetProductKind(productKind string) *ReplaceOfferingOptions { + _options.ProductKind = core.StringPtr(productKind) + return _options +} + +// SetBadges : Allow user to set Badges +func (_options *ReplaceOfferingOptions) SetBadges(badges []Badge) *ReplaceOfferingOptions { + _options.Badges = badges + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ReplaceOfferingOptions) SetHeaders(param map[string]string) *ReplaceOfferingOptions { + options.Headers = param + return options +} + +// ReplaceOperatorsOptions : The ReplaceOperators options. +type ReplaceOperatorsOptions struct { + // IAM Refresh token. + XAuthRefreshToken *string `json:"X-Auth-Refresh-Token" validate:"required"` + + // Cluster ID. + ClusterID *string `json:"cluster_id,omitempty"` + + // Cluster region. + Region *string `json:"region,omitempty"` + + // Kube namespaces to deploy Operator(s) to. + Namespaces []string `json:"namespaces,omitempty"` + + // Denotes whether to install Operator(s) globally. + AllNamespaces *bool `json:"all_namespaces,omitempty"` + + // A dotted value of `catalogID`.`versionID`. + VersionLocatorID *string `json:"version_locator_id,omitempty"` + + // Operator channel. + Channel *string `json:"channel,omitempty"` + + // Plan. + InstallPlan *string `json:"install_plan,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewReplaceOperatorsOptions : Instantiate ReplaceOperatorsOptions +func (*CatalogManagementV1) NewReplaceOperatorsOptions(xAuthRefreshToken string) *ReplaceOperatorsOptions { + return &ReplaceOperatorsOptions{ + XAuthRefreshToken: core.StringPtr(xAuthRefreshToken), + } +} + +// SetXAuthRefreshToken : Allow user to set XAuthRefreshToken +func (_options *ReplaceOperatorsOptions) SetXAuthRefreshToken(xAuthRefreshToken string) *ReplaceOperatorsOptions { + _options.XAuthRefreshToken = core.StringPtr(xAuthRefreshToken) + return _options +} + +// SetClusterID : Allow user to set ClusterID +func (_options *ReplaceOperatorsOptions) SetClusterID(clusterID string) *ReplaceOperatorsOptions { + _options.ClusterID = core.StringPtr(clusterID) + return _options +} + +// SetRegion : Allow user to set Region +func (_options *ReplaceOperatorsOptions) SetRegion(region string) *ReplaceOperatorsOptions { + _options.Region = core.StringPtr(region) + return _options +} + +// SetNamespaces : Allow user to set Namespaces +func (_options *ReplaceOperatorsOptions) SetNamespaces(namespaces []string) *ReplaceOperatorsOptions { + _options.Namespaces = namespaces + return _options +} + +// SetAllNamespaces : Allow user to set AllNamespaces +func (_options *ReplaceOperatorsOptions) SetAllNamespaces(allNamespaces bool) *ReplaceOperatorsOptions { + _options.AllNamespaces = core.BoolPtr(allNamespaces) + return _options +} + +// SetVersionLocatorID : Allow user to set VersionLocatorID +func (_options *ReplaceOperatorsOptions) SetVersionLocatorID(versionLocatorID string) *ReplaceOperatorsOptions { + _options.VersionLocatorID = core.StringPtr(versionLocatorID) + return _options +} + +// SetChannel : Allow user to set Channel +func (_options *ReplaceOperatorsOptions) SetChannel(channel string) *ReplaceOperatorsOptions { + _options.Channel = core.StringPtr(channel) + return _options +} + +// SetInstallPlan : Allow user to set InstallPlan +func (_options *ReplaceOperatorsOptions) SetInstallPlan(installPlan string) *ReplaceOperatorsOptions { + _options.InstallPlan = core.StringPtr(installPlan) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ReplaceOperatorsOptions) SetHeaders(param map[string]string) *ReplaceOperatorsOptions { + options.Headers = param + return options +} + +// RepoInfo : Repository info for offerings. +type RepoInfo struct { + // Token for private repos. + Token *string `json:"token,omitempty"` + + // Public or enterprise GitHub. + Type *string `json:"type,omitempty"` +} + +// UnmarshalRepoInfo unmarshals an instance of RepoInfo from the specified map of raw messages. +func UnmarshalRepoInfo(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RepoInfo) + err = core.UnmarshalPrimitive(m, "token", &obj.Token) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Resource : Resource requirements. +type Resource struct { + // Type of requirement. + Type *string `json:"type,omitempty"` + + // mem, disk, cores, and nodes can be parsed as an int. targetVersion will be a semver range value. + Value interface{} `json:"value,omitempty"` +} + +// Constants associated with the Resource.Type property. +// Type of requirement. +const ( + ResourceTypeCoresConst = "cores" + ResourceTypeDiskConst = "disk" + ResourceTypeMemConst = "mem" + ResourceTypeNodesConst = "nodes" + ResourceTypeTargetversionConst = "targetVersion" +) + +// UnmarshalResource unmarshals an instance of Resource from the specified map of raw messages. +func UnmarshalResource(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Resource) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Script : Script information. +type Script struct { + // Instruction on step and by whom (role) that are needed to take place to prepare the target for installing this + // version. + Instructions *string `json:"instructions,omitempty"` + + // A map of translated strings, by language code. + InstructionsI18n map[string]string `json:"instructions_i18n,omitempty"` + + // Optional script that needs to be run post any pre-condition script. + Script *string `json:"script,omitempty"` + + // Optional iam permissions that are required on the target cluster to run this script. + ScriptPermission *string `json:"script_permission,omitempty"` + + // Optional script that if run will remove the installed version. + DeleteScript *string `json:"delete_script,omitempty"` + + // Optional value indicating if this script is scoped to a namespace or the entire cluster. + Scope *string `json:"scope,omitempty"` +} + +// UnmarshalScript unmarshals an instance of Script from the specified map of raw messages. +func UnmarshalScript(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Script) + err = core.UnmarshalPrimitive(m, "instructions", &obj.Instructions) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "instructions_i18n", &obj.InstructionsI18n) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "script", &obj.Script) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "script_permission", &obj.ScriptPermission) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "delete_script", &obj.DeleteScript) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "scope", &obj.Scope) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SearchObjectsOptions : The SearchObjects options. +type SearchObjectsOptions struct { + // Lucene query string. + Query *string `json:"query" validate:"required"` + + // The kind of the object. It will default to "vpe". + Kind *string `json:"kind,omitempty"` + + // The maximum number of results to return. + Limit *int64 `json:"limit,omitempty"` + + // The number of results to skip before returning values. + Offset *int64 `json:"offset,omitempty"` + + // When true, hide private objects that correspond to public or IBM published objects. + Collapse *bool `json:"collapse,omitempty"` + + // Display a digests of search results, has default value of true. + Digest *bool `json:"digest,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the SearchObjectsOptions.Kind property. +// The kind of the object. It will default to "vpe". +const ( + SearchObjectsOptionsKindVpeConst = "vpe" +) + +// NewSearchObjectsOptions : Instantiate SearchObjectsOptions +func (*CatalogManagementV1) NewSearchObjectsOptions(query string) *SearchObjectsOptions { + return &SearchObjectsOptions{ + Query: core.StringPtr(query), + } +} + +// SetQuery : Allow user to set Query +func (_options *SearchObjectsOptions) SetQuery(query string) *SearchObjectsOptions { + _options.Query = core.StringPtr(query) + return _options +} + +// SetKind : Allow user to set Kind +func (_options *SearchObjectsOptions) SetKind(kind string) *SearchObjectsOptions { + _options.Kind = core.StringPtr(kind) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *SearchObjectsOptions) SetLimit(limit int64) *SearchObjectsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetOffset : Allow user to set Offset +func (_options *SearchObjectsOptions) SetOffset(offset int64) *SearchObjectsOptions { + _options.Offset = core.Int64Ptr(offset) + return _options +} + +// SetCollapse : Allow user to set Collapse +func (_options *SearchObjectsOptions) SetCollapse(collapse bool) *SearchObjectsOptions { + _options.Collapse = core.BoolPtr(collapse) + return _options +} + +// SetDigest : Allow user to set Digest +func (_options *SearchObjectsOptions) SetDigest(digest bool) *SearchObjectsOptions { + _options.Digest = core.BoolPtr(digest) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *SearchObjectsOptions) SetHeaders(param map[string]string) *SearchObjectsOptions { + options.Headers = param + return options +} + +// SetDeprecateVersionOptions : The SetDeprecateVersion options. +type SetDeprecateVersionOptions struct { + // A dotted value of `catalogID`.`versionID`. + VersionLocID *string `json:"version_loc_id" validate:"required,ne="` + + // Set deprecation (true) or cancel deprecation (false). + Setting *string `json:"setting" validate:"required,ne="` + + // Additional information that users can provide to be displayed in deprecation notification. + Description *string `json:"description,omitempty"` + + // Specifies the amount of days until product is not available in catalog. + DaysUntilDeprecate *int64 `json:"days_until_deprecate,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the SetDeprecateVersionOptions.Setting property. +// Set deprecation (true) or cancel deprecation (false). +const ( + SetDeprecateVersionOptionsSettingFalseConst = "false" + SetDeprecateVersionOptionsSettingTrueConst = "true" +) + +// NewSetDeprecateVersionOptions : Instantiate SetDeprecateVersionOptions +func (*CatalogManagementV1) NewSetDeprecateVersionOptions(versionLocID string, setting string) *SetDeprecateVersionOptions { + return &SetDeprecateVersionOptions{ + VersionLocID: core.StringPtr(versionLocID), + Setting: core.StringPtr(setting), + } +} + +// SetVersionLocID : Allow user to set VersionLocID +func (_options *SetDeprecateVersionOptions) SetVersionLocID(versionLocID string) *SetDeprecateVersionOptions { + _options.VersionLocID = core.StringPtr(versionLocID) + return _options +} + +// SetSetting : Allow user to set Setting +func (_options *SetDeprecateVersionOptions) SetSetting(setting string) *SetDeprecateVersionOptions { + _options.Setting = core.StringPtr(setting) + return _options +} + +// SetDescription : Allow user to set Description +func (_options *SetDeprecateVersionOptions) SetDescription(description string) *SetDeprecateVersionOptions { + _options.Description = core.StringPtr(description) + return _options +} + +// SetDaysUntilDeprecate : Allow user to set DaysUntilDeprecate +func (_options *SetDeprecateVersionOptions) SetDaysUntilDeprecate(daysUntilDeprecate int64) *SetDeprecateVersionOptions { + _options.DaysUntilDeprecate = core.Int64Ptr(daysUntilDeprecate) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *SetDeprecateVersionOptions) SetHeaders(param map[string]string) *SetDeprecateVersionOptions { + options.Headers = param + return options +} + +// SetOfferingPublishOptions : The SetOfferingPublish options. +type SetOfferingPublishOptions struct { + // Catalog identifier. + CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` + + // Offering identification. + OfferingID *string `json:"offering_id" validate:"required,ne="` + + // Type of approval. + // * `pc_managed` - Partner Center is managing this offering + // * `publish_approved` - Publishing approved, offering owners can now set who sees the offering in public catalog + // * `allow_request` - (deprecated) + // * `ibm` - (deprecated) + // * `public` - (deprecated). + ApprovalType *string `json:"approval_type" validate:"required,ne="` + + // Approve (true) or disapprove (false). + Approved *string `json:"approved" validate:"required,ne="` + + // Partner Center identifier for this offering. + PortalRecord *string `json:"portal_record,omitempty"` + + // Partner Center url for this offering. + PortalURL *string `json:"portal_url,omitempty"` + + // IAM token of partner center. Only needed when Partner Center accessing the private catalog offering. When accessing + // the public offering Partner Center only needs to use their token in the authorization header. + XApproverToken *string `json:"X-Approver-Token,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the SetOfferingPublishOptions.ApprovalType property. +// Type of approval. +// * `pc_managed` - Partner Center is managing this offering +// * `publish_approved` - Publishing approved, offering owners can now set who sees the offering in public catalog +// * `allow_request` - (deprecated) +// * `ibm` - (deprecated) +// * `public` - (deprecated). +const ( + SetOfferingPublishOptionsApprovalTypeAllowRequestConst = "allow_request" + SetOfferingPublishOptionsApprovalTypeIBMConst = "ibm" + SetOfferingPublishOptionsApprovalTypePcManagedConst = "pc_managed" + SetOfferingPublishOptionsApprovalTypePublicConst = "public" + SetOfferingPublishOptionsApprovalTypePublishApprovedConst = "publish_approved" +) + +// Constants associated with the SetOfferingPublishOptions.Approved property. +// Approve (true) or disapprove (false). +const ( + SetOfferingPublishOptionsApprovedFalseConst = "false" + SetOfferingPublishOptionsApprovedTrueConst = "true" +) + +// NewSetOfferingPublishOptions : Instantiate SetOfferingPublishOptions +func (*CatalogManagementV1) NewSetOfferingPublishOptions(catalogIdentifier string, offeringID string, approvalType string, approved string) *SetOfferingPublishOptions { + return &SetOfferingPublishOptions{ + CatalogIdentifier: core.StringPtr(catalogIdentifier), + OfferingID: core.StringPtr(offeringID), + ApprovalType: core.StringPtr(approvalType), + Approved: core.StringPtr(approved), + } +} + +// SetCatalogIdentifier : Allow user to set CatalogIdentifier +func (_options *SetOfferingPublishOptions) SetCatalogIdentifier(catalogIdentifier string) *SetOfferingPublishOptions { + _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) + return _options +} + +// SetOfferingID : Allow user to set OfferingID +func (_options *SetOfferingPublishOptions) SetOfferingID(offeringID string) *SetOfferingPublishOptions { + _options.OfferingID = core.StringPtr(offeringID) + return _options +} + +// SetApprovalType : Allow user to set ApprovalType +func (_options *SetOfferingPublishOptions) SetApprovalType(approvalType string) *SetOfferingPublishOptions { + _options.ApprovalType = core.StringPtr(approvalType) + return _options +} + +// SetApproved : Allow user to set Approved +func (_options *SetOfferingPublishOptions) SetApproved(approved string) *SetOfferingPublishOptions { + _options.Approved = core.StringPtr(approved) + return _options +} + +// SetPortalRecord : Allow user to set PortalRecord +func (_options *SetOfferingPublishOptions) SetPortalRecord(portalRecord string) *SetOfferingPublishOptions { + _options.PortalRecord = core.StringPtr(portalRecord) + return _options +} + +// SetPortalURL : Allow user to set PortalURL +func (_options *SetOfferingPublishOptions) SetPortalURL(portalURL string) *SetOfferingPublishOptions { + _options.PortalURL = core.StringPtr(portalURL) + return _options +} + +// SetXApproverToken : Allow user to set XApproverToken +func (_options *SetOfferingPublishOptions) SetXApproverToken(xApproverToken string) *SetOfferingPublishOptions { + _options.XApproverToken = core.StringPtr(xApproverToken) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *SetOfferingPublishOptions) SetHeaders(param map[string]string) *SetOfferingPublishOptions { + options.Headers = param + return options +} + +// ShareObjectOptions : The ShareObject options. +type ShareObjectOptions struct { + // Catalog identifier. + CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` + + // Object identifier. + ObjectIdentifier *string `json:"object_identifier" validate:"required,ne="` + + // Visible to IBM employees. + IBM *bool `json:"ibm,omitempty"` + + // Visible to everyone in the public catalog. + Public *bool `json:"public,omitempty"` + + // Visible to access list. + Enabled *bool `json:"enabled,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewShareObjectOptions : Instantiate ShareObjectOptions +func (*CatalogManagementV1) NewShareObjectOptions(catalogIdentifier string, objectIdentifier string) *ShareObjectOptions { + return &ShareObjectOptions{ + CatalogIdentifier: core.StringPtr(catalogIdentifier), + ObjectIdentifier: core.StringPtr(objectIdentifier), + } +} + +// SetCatalogIdentifier : Allow user to set CatalogIdentifier +func (_options *ShareObjectOptions) SetCatalogIdentifier(catalogIdentifier string) *ShareObjectOptions { + _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) + return _options +} + +// SetObjectIdentifier : Allow user to set ObjectIdentifier +func (_options *ShareObjectOptions) SetObjectIdentifier(objectIdentifier string) *ShareObjectOptions { + _options.ObjectIdentifier = core.StringPtr(objectIdentifier) + return _options +} + +// SetIBM : Allow user to set IBM +func (_options *ShareObjectOptions) SetIBM(ibm bool) *ShareObjectOptions { + _options.IBM = core.BoolPtr(ibm) + return _options +} + +// SetPublic : Allow user to set Public +func (_options *ShareObjectOptions) SetPublic(public bool) *ShareObjectOptions { + _options.Public = core.BoolPtr(public) + return _options +} + +// SetEnabled : Allow user to set Enabled +func (_options *ShareObjectOptions) SetEnabled(enabled bool) *ShareObjectOptions { + _options.Enabled = core.BoolPtr(enabled) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ShareObjectOptions) SetHeaders(param map[string]string) *ShareObjectOptions { + options.Headers = param + return options +} + +// ShareOfferingOptions : The ShareOffering options. +type ShareOfferingOptions struct { + // Catalog identifier. + CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` + + // Offering identification. + OfferingID *string `json:"offering_id" validate:"required,ne="` + + // Visible to IBM employees. + IBM *bool `json:"ibm,omitempty"` + + // Visible to everyone in the public catalog. + Public *bool `json:"public,omitempty"` + + // Visible to access list. + Enabled *bool `json:"enabled,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewShareOfferingOptions : Instantiate ShareOfferingOptions +func (*CatalogManagementV1) NewShareOfferingOptions(catalogIdentifier string, offeringID string) *ShareOfferingOptions { + return &ShareOfferingOptions{ + CatalogIdentifier: core.StringPtr(catalogIdentifier), + OfferingID: core.StringPtr(offeringID), + } +} + +// SetCatalogIdentifier : Allow user to set CatalogIdentifier +func (_options *ShareOfferingOptions) SetCatalogIdentifier(catalogIdentifier string) *ShareOfferingOptions { + _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) + return _options +} + +// SetOfferingID : Allow user to set OfferingID +func (_options *ShareOfferingOptions) SetOfferingID(offeringID string) *ShareOfferingOptions { + _options.OfferingID = core.StringPtr(offeringID) + return _options +} + +// SetIBM : Allow user to set IBM +func (_options *ShareOfferingOptions) SetIBM(ibm bool) *ShareOfferingOptions { + _options.IBM = core.BoolPtr(ibm) + return _options +} + +// SetPublic : Allow user to set Public +func (_options *ShareOfferingOptions) SetPublic(public bool) *ShareOfferingOptions { + _options.Public = core.BoolPtr(public) + return _options +} + +// SetEnabled : Allow user to set Enabled +func (_options *ShareOfferingOptions) SetEnabled(enabled bool) *ShareOfferingOptions { + _options.Enabled = core.BoolPtr(enabled) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ShareOfferingOptions) SetHeaders(param map[string]string) *ShareOfferingOptions { + options.Headers = param + return options +} + +// ShareSetting : Share setting information. +type ShareSetting struct { + // Visible to IBM employees. + IBM *bool `json:"ibm,omitempty"` + + // Visible to everyone in the public catalog. + Public *bool `json:"public,omitempty"` + + // Visible to access list. + Enabled *bool `json:"enabled,omitempty"` +} + +// UnmarshalShareSetting unmarshals an instance of ShareSetting from the specified map of raw messages. +func UnmarshalShareSetting(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ShareSetting) + err = core.UnmarshalPrimitive(m, "ibm", &obj.IBM) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "public", &obj.Public) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enabled", &obj.Enabled) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SharedPublishObjectOptions : The SharedPublishObject options. +type SharedPublishObjectOptions struct { + // Catalog identifier. + CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` + + // Object identifier. + ObjectIdentifier *string `json:"object_identifier" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewSharedPublishObjectOptions : Instantiate SharedPublishObjectOptions +func (*CatalogManagementV1) NewSharedPublishObjectOptions(catalogIdentifier string, objectIdentifier string) *SharedPublishObjectOptions { + return &SharedPublishObjectOptions{ + CatalogIdentifier: core.StringPtr(catalogIdentifier), + ObjectIdentifier: core.StringPtr(objectIdentifier), + } +} + +// SetCatalogIdentifier : Allow user to set CatalogIdentifier +func (_options *SharedPublishObjectOptions) SetCatalogIdentifier(catalogIdentifier string) *SharedPublishObjectOptions { + _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) + return _options +} + +// SetObjectIdentifier : Allow user to set ObjectIdentifier +func (_options *SharedPublishObjectOptions) SetObjectIdentifier(objectIdentifier string) *SharedPublishObjectOptions { + _options.ObjectIdentifier = core.StringPtr(objectIdentifier) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *SharedPublishObjectOptions) SetHeaders(param map[string]string) *SharedPublishObjectOptions { + options.Headers = param + return options +} + +// SolutionInfo : Version Solution Information. Only supported for Product kind Solution. +type SolutionInfo struct { + // Architecture diagrams for this solution. + ArchitectureDiagrams []ArchitectureDiagram `json:"architecture_diagrams,omitempty"` + + // Features - titles only. + Features []Feature `json:"features,omitempty"` + + // Cost estimate definition. + CostEstimate *CostEstimate `json:"cost_estimate,omitempty"` + + // Dependencies for this solution. + Dependencies []Dependency `json:"dependencies,omitempty"` +} + +// UnmarshalSolutionInfo unmarshals an instance of SolutionInfo from the specified map of raw messages. +func UnmarshalSolutionInfo(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SolutionInfo) + err = core.UnmarshalModel(m, "architecture_diagrams", &obj.ArchitectureDiagrams, UnmarshalArchitectureDiagram) + if err != nil { + return + } + err = core.UnmarshalModel(m, "features", &obj.Features, UnmarshalFeature) + if err != nil { + return + } + err = core.UnmarshalModel(m, "cost_estimate", &obj.CostEstimate, UnmarshalCostEstimate) + if err != nil { + return + } + err = core.UnmarshalModel(m, "dependencies", &obj.Dependencies, UnmarshalDependency) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// State : Offering state. +type State struct { + // one of: new, validated, account-published, ibm-published, public-published. + Current *string `json:"current,omitempty"` + + // Date and time of current request. + CurrentEntered *strfmt.DateTime `json:"current_entered,omitempty"` + + // one of: new, validated, account-published, ibm-published, public-published. + Pending *string `json:"pending,omitempty"` + + // Date and time of pending request. + PendingRequested *strfmt.DateTime `json:"pending_requested,omitempty"` + + // one of: new, validated, account-published, ibm-published, public-published. + Previous *string `json:"previous,omitempty"` +} + +// UnmarshalState unmarshals an instance of State from the specified map of raw messages. +func UnmarshalState(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(State) + err = core.UnmarshalPrimitive(m, "current", &obj.Current) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "current_entered", &obj.CurrentEntered) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "pending", &obj.Pending) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "pending_requested", &obj.PendingRequested) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "previous", &obj.Previous) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Support : Offering Support information. +type Support struct { + // URL to be displayed in the Consumption UI for getting support on this offering. + URL *string `json:"url,omitempty"` + + // Support process as provided by an ISV. + Process *string `json:"process,omitempty"` + + // A map of translated strings, by language code. + ProcessI18n map[string]string `json:"process_i18n,omitempty"` + + // A list of country codes indicating where support is provided. + Locations []string `json:"locations,omitempty"` + + // A list of support options (e.g. email, phone, slack, other). + SupportDetails []SupportDetail `json:"support_details,omitempty"` + + // Support escalation policy. + SupportEscalation *SupportEscalation `json:"support_escalation,omitempty"` + + // Support type for this product. + SupportType *string `json:"support_type,omitempty"` +} + +// UnmarshalSupport unmarshals an instance of Support from the specified map of raw messages. +func UnmarshalSupport(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Support) + err = core.UnmarshalPrimitive(m, "url", &obj.URL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "process", &obj.Process) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "process_i18n", &obj.ProcessI18n) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "locations", &obj.Locations) + if err != nil { + return + } + err = core.UnmarshalModel(m, "support_details", &obj.SupportDetails, UnmarshalSupportDetail) + if err != nil { + return + } + err = core.UnmarshalModel(m, "support_escalation", &obj.SupportEscalation, UnmarshalSupportEscalation) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "support_type", &obj.SupportType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SupportAvailability : Times when support is available. +type SupportAvailability struct { + // A list of support times. + Times []SupportTime `json:"times,omitempty"` + + // Timezone (e.g. America/New_York). + Timezone *string `json:"timezone,omitempty"` + + // Is this support always available. + AlwaysAvailable *bool `json:"always_available,omitempty"` +} + +// UnmarshalSupportAvailability unmarshals an instance of SupportAvailability from the specified map of raw messages. +func UnmarshalSupportAvailability(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SupportAvailability) + err = core.UnmarshalModel(m, "times", &obj.Times, UnmarshalSupportTime) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "timezone", &obj.Timezone) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "always_available", &obj.AlwaysAvailable) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SupportDetail : A support option. +type SupportDetail struct { + // Type of the current support detail. + Type *string `json:"type,omitempty"` + + // Contact for the current support detail. + Contact *string `json:"contact,omitempty"` + + // Time descriptor. + ResponseWaitTime *SupportWaitTime `json:"response_wait_time,omitempty"` + + // Times when support is available. + Availability *SupportAvailability `json:"availability,omitempty"` +} + +// UnmarshalSupportDetail unmarshals an instance of SupportDetail from the specified map of raw messages. +func UnmarshalSupportDetail(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SupportDetail) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "contact", &obj.Contact) + if err != nil { + return + } + err = core.UnmarshalModel(m, "response_wait_time", &obj.ResponseWaitTime, UnmarshalSupportWaitTime) + if err != nil { + return + } + err = core.UnmarshalModel(m, "availability", &obj.Availability, UnmarshalSupportAvailability) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SupportEscalation : Support escalation policy. +type SupportEscalation struct { + // Time descriptor. + EscalationWaitTime *SupportWaitTime `json:"escalation_wait_time,omitempty"` + + // Time descriptor. + ResponseWaitTime *SupportWaitTime `json:"response_wait_time,omitempty"` + + // Escalation contact. + Contact *string `json:"contact,omitempty"` +} + +// UnmarshalSupportEscalation unmarshals an instance of SupportEscalation from the specified map of raw messages. +func UnmarshalSupportEscalation(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SupportEscalation) + err = core.UnmarshalModel(m, "escalation_wait_time", &obj.EscalationWaitTime, UnmarshalSupportWaitTime) + if err != nil { + return + } + err = core.UnmarshalModel(m, "response_wait_time", &obj.ResponseWaitTime, UnmarshalSupportWaitTime) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "contact", &obj.Contact) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SupportTime : Time range for support on a given day. +type SupportTime struct { + // The day of the week, represented as an integer. + Day *int64 `json:"day,omitempty"` + + // HOURS:MINUTES:SECONDS using 24 hour time (e.g. 8:15:00). + StartTime *string `json:"start_time,omitempty"` + + // HOURS:MINUTES:SECONDS using 24 hour time (e.g. 8:15:00). + EndTime *string `json:"end_time,omitempty"` +} + +// UnmarshalSupportTime unmarshals an instance of SupportTime from the specified map of raw messages. +func UnmarshalSupportTime(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SupportTime) + err = core.UnmarshalPrimitive(m, "day", &obj.Day) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "start_time", &obj.StartTime) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "end_time", &obj.EndTime) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SupportWaitTime : Time descriptor. +type SupportWaitTime struct { + // Amount of time to wait in unit 'type'. + Value *int64 `json:"value,omitempty"` + + // Valid values are hour or day. + Type *string `json:"type,omitempty"` +} + +// UnmarshalSupportWaitTime unmarshals an instance of SupportWaitTime from the specified map of raw messages. +func UnmarshalSupportWaitTime(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SupportWaitTime) + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SuspendVersionOptions : The SuspendVersion options. +type SuspendVersionOptions struct { + // A dotted value of `catalogID`.`versionID`. + VersionLocID *string `json:"version_loc_id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewSuspendVersionOptions : Instantiate SuspendVersionOptions +func (*CatalogManagementV1) NewSuspendVersionOptions(versionLocID string) *SuspendVersionOptions { + return &SuspendVersionOptions{ + VersionLocID: core.StringPtr(versionLocID), + } +} + +// SetVersionLocID : Allow user to set VersionLocID +func (_options *SuspendVersionOptions) SetVersionLocID(versionLocID string) *SuspendVersionOptions { + _options.VersionLocID = core.StringPtr(versionLocID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *SuspendVersionOptions) SetHeaders(param map[string]string) *SuspendVersionOptions { + options.Headers = param + return options +} + +// SyndicationAuthorization : Feature information. +type SyndicationAuthorization struct { + // Array of syndicated namespaces. + Token *string `json:"token,omitempty"` + + // Date and time last updated. + LastRun *strfmt.DateTime `json:"last_run,omitempty"` +} + +// UnmarshalSyndicationAuthorization unmarshals an instance of SyndicationAuthorization from the specified map of raw messages. +func UnmarshalSyndicationAuthorization(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SyndicationAuthorization) + err = core.UnmarshalPrimitive(m, "token", &obj.Token) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "last_run", &obj.LastRun) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SyndicationCluster : Feature information. +type SyndicationCluster struct { + // Cluster region. + Region *string `json:"region,omitempty"` + + // Cluster ID. + ID *string `json:"id,omitempty"` + + // Cluster name. + Name *string `json:"name,omitempty"` + + // Resource group ID. + ResourceGroupName *string `json:"resource_group_name,omitempty"` + + // Syndication type. + Type *string `json:"type,omitempty"` + + // Syndicated namespaces. + Namespaces []string `json:"namespaces,omitempty"` + + // Syndicated to all namespaces on cluster. + AllNamespaces *bool `json:"all_namespaces,omitempty"` +} + +// UnmarshalSyndicationCluster unmarshals an instance of SyndicationCluster from the specified map of raw messages. +func UnmarshalSyndicationCluster(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SyndicationCluster) + err = core.UnmarshalPrimitive(m, "region", &obj.Region) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_group_name", &obj.ResourceGroupName) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "namespaces", &obj.Namespaces) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "all_namespaces", &obj.AllNamespaces) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SyndicationHistory : Feature information. +type SyndicationHistory struct { + // Array of syndicated namespaces. + Namespaces []string `json:"namespaces,omitempty"` + + // Array of syndicated namespaces. + Clusters []SyndicationCluster `json:"clusters,omitempty"` + + // Date and time last syndicated. + LastRun *strfmt.DateTime `json:"last_run,omitempty"` +} + +// UnmarshalSyndicationHistory unmarshals an instance of SyndicationHistory from the specified map of raw messages. +func UnmarshalSyndicationHistory(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SyndicationHistory) + err = core.UnmarshalPrimitive(m, "namespaces", &obj.Namespaces) + if err != nil { + return + } + err = core.UnmarshalModel(m, "clusters", &obj.Clusters, UnmarshalSyndicationCluster) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "last_run", &obj.LastRun) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SyndicationResource : Feature information. +type SyndicationResource struct { + // Remove related components. + RemoveRelatedComponents *bool `json:"remove_related_components,omitempty"` + + // Syndication clusters. + Clusters []SyndicationCluster `json:"clusters,omitempty"` + + // Feature information. + History *SyndicationHistory `json:"history,omitempty"` + + // Feature information. + Authorization *SyndicationAuthorization `json:"authorization,omitempty"` +} + +// UnmarshalSyndicationResource unmarshals an instance of SyndicationResource from the specified map of raw messages. +func UnmarshalSyndicationResource(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SyndicationResource) + err = core.UnmarshalPrimitive(m, "remove_related_components", &obj.RemoveRelatedComponents) + if err != nil { + return + } + err = core.UnmarshalModel(m, "clusters", &obj.Clusters, UnmarshalSyndicationCluster) + if err != nil { + return + } + err = core.UnmarshalModel(m, "history", &obj.History, UnmarshalSyndicationHistory) + if err != nil { + return + } + err = core.UnmarshalModel(m, "authorization", &obj.Authorization, UnmarshalSyndicationAuthorization) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// URLProxy : Offering URL proxy information. +type URLProxy struct { + // URL of the specified media item being proxied. + URL *string `json:"url,omitempty"` + + // SHA256 fingerprint of image. + Sha *string `json:"sha,omitempty"` +} + +// UnmarshalURLProxy unmarshals an instance of URLProxy from the specified map of raw messages. +func UnmarshalURLProxy(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(URLProxy) + err = core.UnmarshalPrimitive(m, "url", &obj.URL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "sha", &obj.Sha) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// UpdateCatalogAccountOptions : The UpdateCatalogAccount options. +type UpdateCatalogAccountOptions struct { + // Account identification. + ID *string `json:"id,omitempty"` + + // Cloudant revision. + Rev *string `json:"_rev,omitempty"` + + // Hide the public catalog in this account. + HideIBMCloudCatalog *bool `json:"hide_IBM_cloud_catalog,omitempty"` + + // Filters for account and catalog filters. + AccountFilters *Filters `json:"account_filters,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateCatalogAccountOptions : Instantiate UpdateCatalogAccountOptions +func (*CatalogManagementV1) NewUpdateCatalogAccountOptions() *UpdateCatalogAccountOptions { + return &UpdateCatalogAccountOptions{} +} + +// SetID : Allow user to set ID +func (_options *UpdateCatalogAccountOptions) SetID(id string) *UpdateCatalogAccountOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetRev : Allow user to set Rev +func (_options *UpdateCatalogAccountOptions) SetRev(rev string) *UpdateCatalogAccountOptions { + _options.Rev = core.StringPtr(rev) + return _options +} + +// SetHideIBMCloudCatalog : Allow user to set HideIBMCloudCatalog +func (_options *UpdateCatalogAccountOptions) SetHideIBMCloudCatalog(hideIBMCloudCatalog bool) *UpdateCatalogAccountOptions { + _options.HideIBMCloudCatalog = core.BoolPtr(hideIBMCloudCatalog) + return _options +} + +// SetAccountFilters : Allow user to set AccountFilters +func (_options *UpdateCatalogAccountOptions) SetAccountFilters(accountFilters *Filters) *UpdateCatalogAccountOptions { + _options.AccountFilters = accountFilters + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateCatalogAccountOptions) SetHeaders(param map[string]string) *UpdateCatalogAccountOptions { + options.Headers = param + return options +} + +// UpdateOfferingOptions : The UpdateOffering options. +type UpdateOfferingOptions struct { + // Catalog identifier. + CatalogIdentifier *string `json:"catalog_identifier" validate:"required,ne="` + + // Offering identification. + OfferingID *string `json:"offering_id" validate:"required,ne="` + + // Offering etag contained in quotes. + IfMatch *string `json:"If-Match" validate:"required"` + + Updates []JSONPatchOperation `json:"updates,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateOfferingOptions : Instantiate UpdateOfferingOptions +func (*CatalogManagementV1) NewUpdateOfferingOptions(catalogIdentifier string, offeringID string, ifMatch string) *UpdateOfferingOptions { + return &UpdateOfferingOptions{ + CatalogIdentifier: core.StringPtr(catalogIdentifier), + OfferingID: core.StringPtr(offeringID), + IfMatch: core.StringPtr(ifMatch), + } +} + +// SetCatalogIdentifier : Allow user to set CatalogIdentifier +func (_options *UpdateOfferingOptions) SetCatalogIdentifier(catalogIdentifier string) *UpdateOfferingOptions { + _options.CatalogIdentifier = core.StringPtr(catalogIdentifier) + return _options +} + +// SetOfferingID : Allow user to set OfferingID +func (_options *UpdateOfferingOptions) SetOfferingID(offeringID string) *UpdateOfferingOptions { + _options.OfferingID = core.StringPtr(offeringID) + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *UpdateOfferingOptions) SetIfMatch(ifMatch string) *UpdateOfferingOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetUpdates : Allow user to set Updates +func (_options *UpdateOfferingOptions) SetUpdates(updates []JSONPatchOperation) *UpdateOfferingOptions { + _options.Updates = updates + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateOfferingOptions) SetHeaders(param map[string]string) *UpdateOfferingOptions { + options.Headers = param + return options +} + +// ValidateInstallOptions : The ValidateInstall options. +type ValidateInstallOptions struct { + // A dotted value of `catalogID`.`versionID`. + VersionLocID *string `json:"version_loc_id" validate:"required,ne="` + + // IAM Refresh token. + XAuthRefreshToken *string `json:"X-Auth-Refresh-Token" validate:"required"` + + // Cluster ID. + ClusterID *string `json:"cluster_id,omitempty"` + + // Cluster region. + Region *string `json:"region,omitempty"` + + // Kube namespace. + Namespace *string `json:"namespace,omitempty"` + + // Validation override values. Required for virtual server image for VPC. + OverrideValues *DeployRequestBodyOverrideValues `json:"override_values,omitempty"` + + // Schematics environment variables to use with this workspace. + EnvironmentVariables []DeployRequestBodyEnvironmentVariablesItem `json:"environment_variables,omitempty"` + + // Entitlement API Key for this offering. + EntitlementApikey *string `json:"entitlement_apikey,omitempty"` + + // Schematics workspace configuration. + Schematics *DeployRequestBodySchematics `json:"schematics,omitempty"` + + // Script. + Script *string `json:"script,omitempty"` + + // Script ID. + ScriptID *string `json:"script_id,omitempty"` + + // A dotted value of `catalogID`.`versionID`. + VersionLocatorID *string `json:"version_locator_id,omitempty"` + + // VCenter ID. + VcenterID *string `json:"vcenter_id,omitempty"` + + // VCenter Location. + VcenterLocation *string `json:"vcenter_location,omitempty"` + + // VCenter User. + VcenterUser *string `json:"vcenter_user,omitempty"` + + // VCenter Password. + VcenterPassword *string `json:"vcenter_password,omitempty"` + + // VCenter Datastore. + VcenterDatastore *string `json:"vcenter_datastore,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewValidateInstallOptions : Instantiate ValidateInstallOptions +func (*CatalogManagementV1) NewValidateInstallOptions(versionLocID string, xAuthRefreshToken string) *ValidateInstallOptions { + return &ValidateInstallOptions{ + VersionLocID: core.StringPtr(versionLocID), + XAuthRefreshToken: core.StringPtr(xAuthRefreshToken), + } +} + +// SetVersionLocID : Allow user to set VersionLocID +func (_options *ValidateInstallOptions) SetVersionLocID(versionLocID string) *ValidateInstallOptions { + _options.VersionLocID = core.StringPtr(versionLocID) + return _options +} + +// SetXAuthRefreshToken : Allow user to set XAuthRefreshToken +func (_options *ValidateInstallOptions) SetXAuthRefreshToken(xAuthRefreshToken string) *ValidateInstallOptions { + _options.XAuthRefreshToken = core.StringPtr(xAuthRefreshToken) + return _options +} + +// SetClusterID : Allow user to set ClusterID +func (_options *ValidateInstallOptions) SetClusterID(clusterID string) *ValidateInstallOptions { + _options.ClusterID = core.StringPtr(clusterID) + return _options +} + +// SetRegion : Allow user to set Region +func (_options *ValidateInstallOptions) SetRegion(region string) *ValidateInstallOptions { + _options.Region = core.StringPtr(region) + return _options +} + +// SetNamespace : Allow user to set Namespace +func (_options *ValidateInstallOptions) SetNamespace(namespace string) *ValidateInstallOptions { + _options.Namespace = core.StringPtr(namespace) + return _options +} + +// SetOverrideValues : Allow user to set OverrideValues +func (_options *ValidateInstallOptions) SetOverrideValues(overrideValues *DeployRequestBodyOverrideValues) *ValidateInstallOptions { + _options.OverrideValues = overrideValues + return _options +} + +// SetEnvironmentVariables : Allow user to set EnvironmentVariables +func (_options *ValidateInstallOptions) SetEnvironmentVariables(environmentVariables []DeployRequestBodyEnvironmentVariablesItem) *ValidateInstallOptions { + _options.EnvironmentVariables = environmentVariables + return _options +} + +// SetEntitlementApikey : Allow user to set EntitlementApikey +func (_options *ValidateInstallOptions) SetEntitlementApikey(entitlementApikey string) *ValidateInstallOptions { + _options.EntitlementApikey = core.StringPtr(entitlementApikey) + return _options +} + +// SetSchematics : Allow user to set Schematics +func (_options *ValidateInstallOptions) SetSchematics(schematics *DeployRequestBodySchematics) *ValidateInstallOptions { + _options.Schematics = schematics + return _options +} + +// SetScript : Allow user to set Script +func (_options *ValidateInstallOptions) SetScript(script string) *ValidateInstallOptions { + _options.Script = core.StringPtr(script) + return _options +} + +// SetScriptID : Allow user to set ScriptID +func (_options *ValidateInstallOptions) SetScriptID(scriptID string) *ValidateInstallOptions { + _options.ScriptID = core.StringPtr(scriptID) + return _options +} + +// SetVersionLocatorID : Allow user to set VersionLocatorID +func (_options *ValidateInstallOptions) SetVersionLocatorID(versionLocatorID string) *ValidateInstallOptions { + _options.VersionLocatorID = core.StringPtr(versionLocatorID) + return _options +} + +// SetVcenterID : Allow user to set VcenterID +func (_options *ValidateInstallOptions) SetVcenterID(vcenterID string) *ValidateInstallOptions { + _options.VcenterID = core.StringPtr(vcenterID) + return _options +} + +// SetVcenterLocation : Allow user to set VcenterLocation +func (_options *ValidateInstallOptions) SetVcenterLocation(vcenterLocation string) *ValidateInstallOptions { + _options.VcenterLocation = core.StringPtr(vcenterLocation) + return _options +} + +// SetVcenterUser : Allow user to set VcenterUser +func (_options *ValidateInstallOptions) SetVcenterUser(vcenterUser string) *ValidateInstallOptions { + _options.VcenterUser = core.StringPtr(vcenterUser) + return _options +} + +// SetVcenterPassword : Allow user to set VcenterPassword +func (_options *ValidateInstallOptions) SetVcenterPassword(vcenterPassword string) *ValidateInstallOptions { + _options.VcenterPassword = core.StringPtr(vcenterPassword) + return _options +} + +// SetVcenterDatastore : Allow user to set VcenterDatastore +func (_options *ValidateInstallOptions) SetVcenterDatastore(vcenterDatastore string) *ValidateInstallOptions { + _options.VcenterDatastore = core.StringPtr(vcenterDatastore) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ValidateInstallOptions) SetHeaders(param map[string]string) *ValidateInstallOptions { + options.Headers = param + return options +} + +// Validation : Validation response. +type Validation struct { + // Date and time of last successful validation. + Validated *strfmt.DateTime `json:"validated,omitempty"` + + // Date and time of last validation was requested. + Requested *strfmt.DateTime `json:"requested,omitempty"` + + // Current validation state - , in_progress, valid, invalid, expired. + State *string `json:"state,omitempty"` + + // Last operation (e.g. submit_deployment, generate_installer, install_offering. + LastOperation *string `json:"last_operation,omitempty"` + + // Validation target information (e.g. cluster_id, region, namespace, etc). Values will vary by Content type. + Target map[string]interface{} `json:"target,omitempty"` + + // Any message needing to be conveyed as part of the validation job. + Message *string `json:"message,omitempty"` +} + +// UnmarshalValidation unmarshals an instance of Validation from the specified map of raw messages. +func UnmarshalValidation(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Validation) + err = core.UnmarshalPrimitive(m, "validated", &obj.Validated) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "requested", &obj.Requested) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "state", &obj.State) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "last_operation", &obj.LastOperation) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "target", &obj.Target) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Version : Offering version information. +type Version struct { + // Unique ID. + ID *string `json:"id,omitempty"` + + // Cloudant revision. + Rev *string `json:"_rev,omitempty"` + + // Version's CRN. + CRN *string `json:"crn,omitempty"` + + // Version of content type. + Version *string `json:"version,omitempty"` + + // Version Flavor Information. Only supported for Product kind Solution. + Flavor *Flavor `json:"flavor,omitempty"` + + // hash of the content. + Sha *string `json:"sha,omitempty"` + + // The date and time this version was created. + Created *strfmt.DateTime `json:"created,omitempty"` + + // The date and time this version was last updated. + Updated *strfmt.DateTime `json:"updated,omitempty"` + + // Offering ID. + OfferingID *string `json:"offering_id,omitempty"` + + // Catalog ID. + CatalogID *string `json:"catalog_id,omitempty"` + + // Kind ID. + KindID *string `json:"kind_id,omitempty"` + + // List of tags associated with this catalog. + Tags []string `json:"tags,omitempty"` + + // Content's repo URL. + RepoURL *string `json:"repo_url,omitempty"` + + // Content's source URL (e.g git repo). + SourceURL *string `json:"source_url,omitempty"` + + // File used to on-board this version. + TgzURL *string `json:"tgz_url,omitempty"` + + // List of user solicited overrides. + Configuration []Configuration `json:"configuration,omitempty"` + + // List of output values for this version. + Outputs []Output `json:"outputs,omitempty"` + + // List of IAM permissions that are required to consume this version. + IamPermissions []IamPermission `json:"iam_permissions,omitempty"` + + // Open ended metadata information. + Metadata map[string]interface{} `json:"metadata,omitempty"` + + // Validation response. + Validation *Validation `json:"validation,omitempty"` + + // Resource requirments for installation. + RequiredResources []Resource `json:"required_resources,omitempty"` + + // Denotes if single instance can be deployed to a given cluster. + SingleInstance *bool `json:"single_instance,omitempty"` + + // Script information. + Install *Script `json:"install,omitempty"` + + // Optional pre-install instructions. + PreInstall []Script `json:"pre_install,omitempty"` + + // Entitlement license info. + Entitlement *VersionEntitlement `json:"entitlement,omitempty"` + + // List of licenses the product was built with. + Licenses []License `json:"licenses,omitempty"` + + // If set, denotes a url to a YAML file with list of container images used by this version. + ImageManifestURL *string `json:"image_manifest_url,omitempty"` + + // read only field, indicating if this version is deprecated. + Deprecated *bool `json:"deprecated,omitempty"` + + // Version of the package used to create this version. + PackageVersion *string `json:"package_version,omitempty"` + + // Offering state. + State *State `json:"state,omitempty"` + + // A dotted value of `catalogID`.`versionID`. + VersionLocator *string `json:"version_locator,omitempty"` + + // Long description for version. + LongDescription *string `json:"long_description,omitempty"` + + // A map of translated strings, by language code. + LongDescriptionI18n map[string]string `json:"long_description_i18n,omitempty"` + + // Whitelisted accounts for version. + WhitelistedAccounts []string `json:"whitelisted_accounts,omitempty"` + + // ID of the image pull key to use from Offering.ImagePullKeys. + ImagePullKeyName *string `json:"image_pull_key_name,omitempty"` + + // Deprecation information for an Offering. + DeprecatePending *DeprecatePending `json:"deprecate_pending,omitempty"` + + // Version Solution Information. Only supported for Product kind Solution. + SolutionInfo *SolutionInfo `json:"solution_info,omitempty"` + + // Is the version able to be shared. + IsConsumable *bool `json:"is_consumable,omitempty"` +} + +// UnmarshalVersion unmarshals an instance of Version from the specified map of raw messages. +func UnmarshalVersion(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Version) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "_rev", &obj.Rev) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "version", &obj.Version) + if err != nil { + return + } + err = core.UnmarshalModel(m, "flavor", &obj.Flavor, UnmarshalFlavor) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "sha", &obj.Sha) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created", &obj.Created) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated", &obj.Updated) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "offering_id", &obj.OfferingID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "catalog_id", &obj.CatalogID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "kind_id", &obj.KindID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "repo_url", &obj.RepoURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source_url", &obj.SourceURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "tgz_url", &obj.TgzURL) + if err != nil { + return + } + err = core.UnmarshalModel(m, "configuration", &obj.Configuration, UnmarshalConfiguration) + if err != nil { + return + } + err = core.UnmarshalModel(m, "outputs", &obj.Outputs, UnmarshalOutput) + if err != nil { + return + } + err = core.UnmarshalModel(m, "iam_permissions", &obj.IamPermissions, UnmarshalIamPermission) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "metadata", &obj.Metadata) + if err != nil { + return + } + err = core.UnmarshalModel(m, "validation", &obj.Validation, UnmarshalValidation) + if err != nil { + return + } + err = core.UnmarshalModel(m, "required_resources", &obj.RequiredResources, UnmarshalResource) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "single_instance", &obj.SingleInstance) + if err != nil { + return + } + err = core.UnmarshalModel(m, "install", &obj.Install, UnmarshalScript) + if err != nil { + return + } + err = core.UnmarshalModel(m, "pre_install", &obj.PreInstall, UnmarshalScript) + if err != nil { + return + } + err = core.UnmarshalModel(m, "entitlement", &obj.Entitlement, UnmarshalVersionEntitlement) + if err != nil { + return + } + err = core.UnmarshalModel(m, "licenses", &obj.Licenses, UnmarshalLicense) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "image_manifest_url", &obj.ImageManifestURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "deprecated", &obj.Deprecated) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "package_version", &obj.PackageVersion) + if err != nil { + return + } + err = core.UnmarshalModel(m, "state", &obj.State, UnmarshalState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "version_locator", &obj.VersionLocator) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "long_description", &obj.LongDescription) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "long_description_i18n", &obj.LongDescriptionI18n) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "whitelisted_accounts", &obj.WhitelistedAccounts) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "image_pull_key_name", &obj.ImagePullKeyName) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deprecate_pending", &obj.DeprecatePending, UnmarshalDeprecatePending) + if err != nil { + return + } + err = core.UnmarshalModel(m, "solution_info", &obj.SolutionInfo, UnmarshalSolutionInfo) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "is_consumable", &obj.IsConsumable) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VersionEntitlement : Entitlement license info. +type VersionEntitlement struct { + // Provider name. + ProviderName *string `json:"provider_name,omitempty"` - // Date and time of last validation was requested. - Requested *strfmt.DateTime `json:"requested,omitempty"` + // Provider ID. + ProviderID *string `json:"provider_id,omitempty"` - // Current validation state - , in_progress, valid, invalid, expired. - State *string `json:"state,omitempty"` + // Product ID. + ProductID *string `json:"product_id,omitempty"` - // Last operation (e.g. submit_deployment, generate_installer, install_offering. - LastOperation *string `json:"last_operation,omitempty"` + // list of license entitlement part numbers, eg. D1YGZLL,D1ZXILL. + PartNumbers []string `json:"part_numbers,omitempty"` - // Validation target information (e.g. cluster_id, region, namespace, etc). Values will vary by Content type. - Target map[string]interface{} `json:"target,omitempty"` + // Image repository name. + ImageRepoName *string `json:"image_repo_name,omitempty"` } -// UnmarshalValidation unmarshals an instance of Validation from the specified map of raw messages. -func UnmarshalValidation(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(Validation) - err = core.UnmarshalPrimitive(m, "validated", &obj.Validated) +// UnmarshalVersionEntitlement unmarshals an instance of VersionEntitlement from the specified map of raw messages. +func UnmarshalVersionEntitlement(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VersionEntitlement) + err = core.UnmarshalPrimitive(m, "provider_name", &obj.ProviderName) if err != nil { return } - err = core.UnmarshalPrimitive(m, "requested", &obj.Requested) + err = core.UnmarshalPrimitive(m, "provider_id", &obj.ProviderID) if err != nil { return } - err = core.UnmarshalPrimitive(m, "state", &obj.State) + err = core.UnmarshalPrimitive(m, "product_id", &obj.ProductID) if err != nil { return } - err = core.UnmarshalPrimitive(m, "last_operation", &obj.LastOperation) + err = core.UnmarshalPrimitive(m, "part_numbers", &obj.PartNumbers) if err != nil { return } - err = core.UnmarshalPrimitive(m, "target", &obj.Target) + err = core.UnmarshalPrimitive(m, "image_repo_name", &obj.ImageRepoName) if err != nil { return } @@ -13592,341 +19162,724 @@ func UnmarshalValidation(m map[string]json.RawMessage, result interface{}) (err return } -// Version : Offering version information. -type Version struct { - // Unique ID. - ID *string `json:"id,omitempty"` - - // Cloudant revision. - Rev *string `json:"_rev,omitempty"` - - // Version's CRN. - CRN *string `json:"crn,omitempty"` +// VersionUpdateDescriptor : Indicates if the current version can be upgraded to the version identified by the descriptor. +type VersionUpdateDescriptor struct { + // A dotted value of `catalogID`.`versionID`. + VersionLocator *string `json:"version_locator,omitempty"` - // Version of content type. + // the version number of this version. Version *string `json:"version,omitempty"` - // hash of the content. - Sha *string `json:"sha,omitempty"` - - // The date and time this version was created. - Created *strfmt.DateTime `json:"created,omitempty"` - - // The date and time this version was last updated. - Updated *strfmt.DateTime `json:"updated,omitempty"` - - // Offering ID. - OfferingID *string `json:"offering_id,omitempty"` - - // Catalog ID. - CatalogID *string `json:"catalog_id,omitempty"` - - // Kind ID. - KindID *string `json:"kind_id,omitempty"` - - // List of tags associated with this catalog. - Tags []string `json:"tags,omitempty"` - - // Content's repo URL. - RepoURL *string `json:"repo_url,omitempty"` - - // Content's source URL (e.g git repo). - SourceURL *string `json:"source_url,omitempty"` - - // File used to on-board this version. - TgzURL *string `json:"tgz_url,omitempty"` - - // List of user solicited overrides. - Configuration []Configuration `json:"configuration,omitempty"` - - // Open ended metadata information. - Metadata map[string]interface{} `json:"metadata,omitempty"` + // Version Flavor Information. Only supported for Product kind Solution. + Flavor *Flavor `json:"flavor,omitempty"` - // Validation response. - Validation *Validation `json:"validation,omitempty"` + // Offering state. + State *State `json:"state,omitempty"` // Resource requirments for installation. RequiredResources []Resource `json:"required_resources,omitempty"` - // Denotes if single instance can be deployed to a given cluster. - SingleInstance *bool `json:"single_instance,omitempty"` - - // Script information. - Install *Script `json:"install,omitempty"` - - // Optional pre-install instructions. - PreInstall []Script `json:"pre_install,omitempty"` - - // Entitlement license info. - Entitlement *VersionEntitlement `json:"entitlement,omitempty"` - - // List of licenses the product was built with. - Licenses []License `json:"licenses,omitempty"` - - // If set, denotes a url to a YAML file with list of container images used by this version. - ImageManifestURL *string `json:"image_manifest_url,omitempty"` - - // read only field, indicating if this version is deprecated. - Deprecated *bool `json:"deprecated,omitempty"` - - // Version of the package used to create this version. + // Version of package. PackageVersion *string `json:"package_version,omitempty"` - // Offering state. - State *State `json:"state,omitempty"` - - // A dotted value of `catalogID`.`versionID`. - VersionLocator *string `json:"version_locator,omitempty"` - - // Console URL. - ConsoleURL *string `json:"console_url,omitempty"` + // The SHA value of this version. + Sha *string `json:"sha,omitempty"` - // Long description for version. - LongDescription *string `json:"long_description,omitempty"` + // true if the current version can be upgraded to this version, false otherwise. + CanUpdate *bool `json:"can_update,omitempty"` - // Whitelisted accounts for version. - WhitelistedAccounts []string `json:"whitelisted_accounts,omitempty"` + // If can_update is false, this map will contain messages for each failed check, otherwise it will be omitted. + // Possible keys include nodes, cores, mem, disk, targetVersion, and install-permission-check. + Messages map[string]string `json:"messages,omitempty"` } -// UnmarshalVersion unmarshals an instance of Version from the specified map of raw messages. -func UnmarshalVersion(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(Version) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) +// UnmarshalVersionUpdateDescriptor unmarshals an instance of VersionUpdateDescriptor from the specified map of raw messages. +func UnmarshalVersionUpdateDescriptor(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VersionUpdateDescriptor) + err = core.UnmarshalPrimitive(m, "version_locator", &obj.VersionLocator) if err != nil { return } - err = core.UnmarshalPrimitive(m, "_rev", &obj.Rev) + err = core.UnmarshalPrimitive(m, "version", &obj.Version) if err != nil { return } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + err = core.UnmarshalModel(m, "flavor", &obj.Flavor, UnmarshalFlavor) if err != nil { return } - err = core.UnmarshalPrimitive(m, "version", &obj.Version) + err = core.UnmarshalModel(m, "state", &obj.State, UnmarshalState) if err != nil { return } - err = core.UnmarshalPrimitive(m, "sha", &obj.Sha) + err = core.UnmarshalModel(m, "required_resources", &obj.RequiredResources, UnmarshalResource) if err != nil { return } - err = core.UnmarshalPrimitive(m, "created", &obj.Created) + err = core.UnmarshalPrimitive(m, "package_version", &obj.PackageVersion) if err != nil { return } - err = core.UnmarshalPrimitive(m, "updated", &obj.Updated) + err = core.UnmarshalPrimitive(m, "sha", &obj.Sha) if err != nil { return } - err = core.UnmarshalPrimitive(m, "offering_id", &obj.OfferingID) + err = core.UnmarshalPrimitive(m, "can_update", &obj.CanUpdate) if err != nil { return } - err = core.UnmarshalPrimitive(m, "catalog_id", &obj.CatalogID) + err = core.UnmarshalPrimitive(m, "messages", &obj.Messages) if err != nil { return } - err = core.UnmarshalPrimitive(m, "kind_id", &obj.KindID) - if err != nil { - return + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// +// CatalogAccountAuditsPager can be used to simplify the use of the "ListCatalogAccountAudits" method. +// +type CatalogAccountAuditsPager struct { + hasNext bool + options *ListCatalogAccountAuditsOptions + client *CatalogManagementV1 + pageContext struct { + next *string } - err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) - if err != nil { +} + +// NewCatalogAccountAuditsPager returns a new CatalogAccountAuditsPager instance. +func (catalogManagement *CatalogManagementV1) NewCatalogAccountAuditsPager(options *ListCatalogAccountAuditsOptions) (pager *CatalogAccountAuditsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") return } - err = core.UnmarshalPrimitive(m, "repo_url", &obj.RepoURL) + + var optionsCopy ListCatalogAccountAuditsOptions = *options + pager = &CatalogAccountAuditsPager{ + hasNext: true, + options: &optionsCopy, + client: catalogManagement, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *CatalogAccountAuditsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *CatalogAccountAuditsPager) GetNextWithContext(ctx context.Context) (page []AuditLogDigest, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListCatalogAccountAuditsWithContext(ctx, pager.options) if err != nil { return } - err = core.UnmarshalPrimitive(m, "source_url", &obj.SourceURL) - if err != nil { + + var next *string + if result.Next != nil { + next = result.Next.Start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Audits + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *CatalogAccountAuditsPager) GetAllWithContext(ctx context.Context) (allItems []AuditLogDigest, err error) { + for pager.HasNext() { + var nextPage []AuditLogDigest + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *CatalogAccountAuditsPager) GetNext() (page []AuditLogDigest, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *CatalogAccountAuditsPager) GetAll() (allItems []AuditLogDigest, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// +// CatalogAuditsPager can be used to simplify the use of the "ListCatalogAudits" method. +// +type CatalogAuditsPager struct { + hasNext bool + options *ListCatalogAuditsOptions + client *CatalogManagementV1 + pageContext struct { + next *string + } +} + +// NewCatalogAuditsPager returns a new CatalogAuditsPager instance. +func (catalogManagement *CatalogManagementV1) NewCatalogAuditsPager(options *ListCatalogAuditsOptions) (pager *CatalogAuditsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") return } - err = core.UnmarshalPrimitive(m, "tgz_url", &obj.TgzURL) + + var optionsCopy ListCatalogAuditsOptions = *options + pager = &CatalogAuditsPager{ + hasNext: true, + options: &optionsCopy, + client: catalogManagement, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *CatalogAuditsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *CatalogAuditsPager) GetNextWithContext(ctx context.Context) (page []AuditLogDigest, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListCatalogAuditsWithContext(ctx, pager.options) if err != nil { return } - err = core.UnmarshalModel(m, "configuration", &obj.Configuration, UnmarshalConfiguration) - if err != nil { + + var next *string + if result.Next != nil { + next = result.Next.Start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Audits + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *CatalogAuditsPager) GetAllWithContext(ctx context.Context) (allItems []AuditLogDigest, err error) { + for pager.HasNext() { + var nextPage []AuditLogDigest + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *CatalogAuditsPager) GetNext() (page []AuditLogDigest, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *CatalogAuditsPager) GetAll() (allItems []AuditLogDigest, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// +// EnterpriseAuditsPager can be used to simplify the use of the "ListEnterpriseAudits" method. +// +type EnterpriseAuditsPager struct { + hasNext bool + options *ListEnterpriseAuditsOptions + client *CatalogManagementV1 + pageContext struct { + next *string + } +} + +// NewEnterpriseAuditsPager returns a new EnterpriseAuditsPager instance. +func (catalogManagement *CatalogManagementV1) NewEnterpriseAuditsPager(options *ListEnterpriseAuditsOptions) (pager *EnterpriseAuditsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") return } - err = core.UnmarshalPrimitive(m, "metadata", &obj.Metadata) + + var optionsCopy ListEnterpriseAuditsOptions = *options + pager = &EnterpriseAuditsPager{ + hasNext: true, + options: &optionsCopy, + client: catalogManagement, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *EnterpriseAuditsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *EnterpriseAuditsPager) GetNextWithContext(ctx context.Context) (page []AuditLogDigest, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListEnterpriseAuditsWithContext(ctx, pager.options) if err != nil { return } - err = core.UnmarshalModel(m, "validation", &obj.Validation, UnmarshalValidation) - if err != nil { - return + + var next *string + if result.Next != nil { + next = result.Next.Start } - err = core.UnmarshalModel(m, "required_resources", &obj.RequiredResources, UnmarshalResource) - if err != nil { - return + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Audits + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *EnterpriseAuditsPager) GetAllWithContext(ctx context.Context) (allItems []AuditLogDigest, err error) { + for pager.HasNext() { + var nextPage []AuditLogDigest + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) } - err = core.UnmarshalPrimitive(m, "single_instance", &obj.SingleInstance) - if err != nil { - return + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *EnterpriseAuditsPager) GetNext() (page []AuditLogDigest, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *EnterpriseAuditsPager) GetAll() (allItems []AuditLogDigest, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// +// OfferingAuditsPager can be used to simplify the use of the "ListOfferingAudits" method. +// +type OfferingAuditsPager struct { + hasNext bool + options *ListOfferingAuditsOptions + client *CatalogManagementV1 + pageContext struct { + next *string } - err = core.UnmarshalModel(m, "install", &obj.Install, UnmarshalScript) - if err != nil { +} + +// NewOfferingAuditsPager returns a new OfferingAuditsPager instance. +func (catalogManagement *CatalogManagementV1) NewOfferingAuditsPager(options *ListOfferingAuditsOptions) (pager *OfferingAuditsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") return } - err = core.UnmarshalModel(m, "pre_install", &obj.PreInstall, UnmarshalScript) - if err != nil { - return + + var optionsCopy ListOfferingAuditsOptions = *options + pager = &OfferingAuditsPager{ + hasNext: true, + options: &optionsCopy, + client: catalogManagement, } - err = core.UnmarshalModel(m, "entitlement", &obj.Entitlement, UnmarshalVersionEntitlement) - if err != nil { - return + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *OfferingAuditsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *OfferingAuditsPager) GetNextWithContext(ctx context.Context) (page []AuditLogDigest, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") } - err = core.UnmarshalModel(m, "licenses", &obj.Licenses, UnmarshalLicense) + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListOfferingAuditsWithContext(ctx, pager.options) if err != nil { return } - err = core.UnmarshalPrimitive(m, "image_manifest_url", &obj.ImageManifestURL) - if err != nil { - return + + var next *string + if result.Next != nil { + next = result.Next.Start } - err = core.UnmarshalPrimitive(m, "deprecated", &obj.Deprecated) - if err != nil { - return + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Audits + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *OfferingAuditsPager) GetAllWithContext(ctx context.Context) (allItems []AuditLogDigest, err error) { + for pager.HasNext() { + var nextPage []AuditLogDigest + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) } - err = core.UnmarshalPrimitive(m, "package_version", &obj.PackageVersion) - if err != nil { - return + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *OfferingAuditsPager) GetNext() (page []AuditLogDigest, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *OfferingAuditsPager) GetAll() (allItems []AuditLogDigest, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// +// GetOfferingAccessListPager can be used to simplify the use of the "GetOfferingAccessList" method. +// +type GetOfferingAccessListPager struct { + hasNext bool + options *GetOfferingAccessListOptions + client *CatalogManagementV1 + pageContext struct { + next *string } - err = core.UnmarshalModel(m, "state", &obj.State, UnmarshalState) - if err != nil { +} + +// NewGetOfferingAccessListPager returns a new GetOfferingAccessListPager instance. +func (catalogManagement *CatalogManagementV1) NewGetOfferingAccessListPager(options *GetOfferingAccessListOptions) (pager *GetOfferingAccessListPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") return } - err = core.UnmarshalPrimitive(m, "version_locator", &obj.VersionLocator) - if err != nil { - return + + var optionsCopy GetOfferingAccessListOptions = *options + pager = &GetOfferingAccessListPager{ + hasNext: true, + options: &optionsCopy, + client: catalogManagement, } - err = core.UnmarshalPrimitive(m, "console_url", &obj.ConsoleURL) - if err != nil { - return + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *GetOfferingAccessListPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *GetOfferingAccessListPager) GetNextWithContext(ctx context.Context) (page []Access, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") } - err = core.UnmarshalPrimitive(m, "long_description", &obj.LongDescription) + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.GetOfferingAccessListWithContext(ctx, pager.options) if err != nil { return } - err = core.UnmarshalPrimitive(m, "whitelisted_accounts", &obj.WhitelistedAccounts) - if err != nil { - return + + var next *string + if result.Next != nil { + next = result.Next.Start } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Resources + return } -// VersionEntitlement : Entitlement license info. -type VersionEntitlement struct { - // Provider name. - ProviderName *string `json:"provider_name,omitempty"` - - // Provider ID. - ProviderID *string `json:"provider_id,omitempty"` +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *GetOfferingAccessListPager) GetAllWithContext(ctx context.Context) (allItems []Access, err error) { + for pager.HasNext() { + var nextPage []Access + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} - // Product ID. - ProductID *string `json:"product_id,omitempty"` +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *GetOfferingAccessListPager) GetNext() (page []Access, err error) { + return pager.GetNextWithContext(context.Background()) +} - // list of license entitlement part numbers, eg. D1YGZLL,D1ZXILL. - PartNumbers []string `json:"part_numbers,omitempty"` +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *GetOfferingAccessListPager) GetAll() (allItems []Access, err error) { + return pager.GetAllWithContext(context.Background()) +} - // Image repository name. - ImageRepoName *string `json:"image_repo_name,omitempty"` +// +// ObjectAuditsPager can be used to simplify the use of the "ListObjectAudits" method. +// +type ObjectAuditsPager struct { + hasNext bool + options *ListObjectAuditsOptions + client *CatalogManagementV1 + pageContext struct { + next *string + } } -// UnmarshalVersionEntitlement unmarshals an instance of VersionEntitlement from the specified map of raw messages. -func UnmarshalVersionEntitlement(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VersionEntitlement) - err = core.UnmarshalPrimitive(m, "provider_name", &obj.ProviderName) - if err != nil { +// NewObjectAuditsPager returns a new ObjectAuditsPager instance. +func (catalogManagement *CatalogManagementV1) NewObjectAuditsPager(options *ListObjectAuditsOptions) (pager *ObjectAuditsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") return } - err = core.UnmarshalPrimitive(m, "provider_id", &obj.ProviderID) - if err != nil { - return + + var optionsCopy ListObjectAuditsOptions = *options + pager = &ObjectAuditsPager{ + hasNext: true, + options: &optionsCopy, + client: catalogManagement, } - err = core.UnmarshalPrimitive(m, "product_id", &obj.ProductID) - if err != nil { - return + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *ObjectAuditsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *ObjectAuditsPager) GetNextWithContext(ctx context.Context) (page []AuditLogDigest, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") } - err = core.UnmarshalPrimitive(m, "part_numbers", &obj.PartNumbers) + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListObjectAuditsWithContext(ctx, pager.options) if err != nil { return } - err = core.UnmarshalPrimitive(m, "image_repo_name", &obj.ImageRepoName) - if err != nil { - return + + var next *string + if result.Next != nil { + next = result.Next.Start } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Audits + return } -// VersionUpdateDescriptor : Indicates if the current version can be upgraded to the version identified by the descriptor. -type VersionUpdateDescriptor struct { - // A dotted value of `catalogID`.`versionID`. - VersionLocator *string `json:"version_locator,omitempty"` - - // the version number of this version. - Version *string `json:"version,omitempty"` +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *ObjectAuditsPager) GetAllWithContext(ctx context.Context) (allItems []AuditLogDigest, err error) { + for pager.HasNext() { + var nextPage []AuditLogDigest + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } + return +} - // Offering state. - State *State `json:"state,omitempty"` +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *ObjectAuditsPager) GetNext() (page []AuditLogDigest, err error) { + return pager.GetNextWithContext(context.Background()) +} - // Resource requirments for installation. - RequiredResources []Resource `json:"required_resources,omitempty"` +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *ObjectAuditsPager) GetAll() (allItems []AuditLogDigest, err error) { + return pager.GetAllWithContext(context.Background()) +} - // Version of package. - PackageVersion *string `json:"package_version,omitempty"` +// +// GetObjectAccessListPager can be used to simplify the use of the "GetObjectAccessList" method. +// +type GetObjectAccessListPager struct { + hasNext bool + options *GetObjectAccessListOptions + client *CatalogManagementV1 + pageContext struct { + next *string + } +} - // The SHA value of this version. - Sha *string `json:"sha,omitempty"` +// NewGetObjectAccessListPager returns a new GetObjectAccessListPager instance. +func (catalogManagement *CatalogManagementV1) NewGetObjectAccessListPager(options *GetObjectAccessListOptions) (pager *GetObjectAccessListPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") + return + } - // true if the current version can be upgraded to this version, false otherwise. - CanUpdate *bool `json:"can_update,omitempty"` + var optionsCopy GetObjectAccessListOptions = *options + pager = &GetObjectAccessListPager{ + hasNext: true, + options: &optionsCopy, + client: catalogManagement, + } + return +} - // If can_update is false, this map will contain messages for each failed check, otherwise it will be omitted. - // Possible keys include nodes, cores, mem, disk, targetVersion, and install-permission-check. - Messages map[string]string `json:"messages,omitempty"` +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *GetObjectAccessListPager) HasNext() bool { + return pager.hasNext } -// UnmarshalVersionUpdateDescriptor unmarshals an instance of VersionUpdateDescriptor from the specified map of raw messages. -func UnmarshalVersionUpdateDescriptor(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VersionUpdateDescriptor) - err = core.UnmarshalPrimitive(m, "version_locator", &obj.VersionLocator) - if err != nil { - return +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *GetObjectAccessListPager) GetNextWithContext(ctx context.Context) (page []Access, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") } - err = core.UnmarshalPrimitive(m, "version", &obj.Version) + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.GetObjectAccessListWithContext(ctx, pager.options) if err != nil { return } - err = core.UnmarshalModel(m, "state", &obj.State, UnmarshalState) - if err != nil { - return + + var next *string + if result.Next != nil { + next = result.Next.Start } - err = core.UnmarshalModel(m, "required_resources", &obj.RequiredResources, UnmarshalResource) - if err != nil { - return + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Resources + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *GetObjectAccessListPager) GetAllWithContext(ctx context.Context) (allItems []Access, err error) { + for pager.HasNext() { + var nextPage []Access + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) } - err = core.UnmarshalPrimitive(m, "package_version", &obj.PackageVersion) - if err != nil { - return + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *GetObjectAccessListPager) GetNext() (page []Access, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *GetObjectAccessListPager) GetAll() (allItems []Access, err error) { + return pager.GetAllWithContext(context.Background()) +} + +// +// OfferingInstanceAuditsPager can be used to simplify the use of the "ListOfferingInstanceAudits" method. +// +type OfferingInstanceAuditsPager struct { + hasNext bool + options *ListOfferingInstanceAuditsOptions + client *CatalogManagementV1 + pageContext struct { + next *string } - err = core.UnmarshalPrimitive(m, "sha", &obj.Sha) - if err != nil { +} + +// NewOfferingInstanceAuditsPager returns a new OfferingInstanceAuditsPager instance. +func (catalogManagement *CatalogManagementV1) NewOfferingInstanceAuditsPager(options *ListOfferingInstanceAuditsOptions) (pager *OfferingInstanceAuditsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = fmt.Errorf("the 'options.Start' field should not be set") return } - err = core.UnmarshalPrimitive(m, "can_update", &obj.CanUpdate) - if err != nil { - return + + var optionsCopy ListOfferingInstanceAuditsOptions = *options + pager = &OfferingInstanceAuditsPager{ + hasNext: true, + options: &optionsCopy, + client: catalogManagement, } - err = core.UnmarshalPrimitive(m, "messages", &obj.Messages) + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *OfferingInstanceAuditsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *OfferingInstanceAuditsPager) GetNextWithContext(ctx context.Context) (page []AuditLogDigest, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListOfferingInstanceAuditsWithContext(ctx, pager.options) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + + var next *string + if result.Next != nil { + next = result.Next.Start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Audits + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *OfferingInstanceAuditsPager) GetAllWithContext(ctx context.Context) (allItems []AuditLogDigest, err error) { + for pager.HasNext() { + var nextPage []AuditLogDigest + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + return + } + allItems = append(allItems, nextPage...) + } return } + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *OfferingInstanceAuditsPager) GetNext() (page []AuditLogDigest, err error) { + return pager.GetNextWithContext(context.Background()) +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *OfferingInstanceAuditsPager) GetAll() (allItems []AuditLogDigest, err error) { + return pager.GetAllWithContext(context.Background()) +} diff --git a/catalogmanagementv1/catalog_management_v1_examples_test.go b/catalogmanagementv1/catalog_management_v1_examples_test.go index 0f447645..22eb2606 100644 --- a/catalogmanagementv1/catalog_management_v1_examples_test.go +++ b/catalogmanagementv1/catalog_management_v1_examples_test.go @@ -22,7 +22,9 @@ package catalogmanagementv1_test import ( "encoding/json" "fmt" + "log" "os" + "time" "github.com/IBM/go-sdk-core/v5/core" "github.com/IBM/platform-services-go-sdk/catalogmanagementv1" @@ -51,13 +53,15 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() { const externalConfigFile = "../catalog_mgmt.env" var ( + err error catalogManagementService *catalogmanagementv1.CatalogManagementV1 + serviceURL string config map[string]string - configLoaded bool = false accountID string bearerToken string gitAuthTokenForPublicRepo string catalogID string + objectCatalogID string offeringID string clusterID string objectID string @@ -66,14 +70,11 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() { ) var shouldSkipTest = func() { - if !configLoaded { - Skip("External configuration is not available, skipping tests...") - } + Skip("External configuration is not available, skipping tests...") } Describe(`External configuration`, func() { It("Successfully load the configuration", func() { - var err error _, err = os.Stat(externalConfigFile) if err != nil { Skip("External configuration file not found, skipping tests: " + err.Error()) @@ -84,17 +85,16 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() { if err != nil { Skip("Error loading service properties, skipping tests: " + err.Error()) } - - configLoaded = len(config) > 0 + serviceURL = config["URL"] + if serviceURL == "" { + Skip("Unable to load service URL configuration property, skipping tests") + } accountID = config["ACCOUNT_ID"] - Expect(accountID).NotTo(BeEmpty()) - - clusterID = config["CLUSTER_ID"] - Expect(clusterID).NotTo(BeEmpty()) + Expect(accountID).NotTo(BeNil()) - gitAuthTokenForPublicRepo = config["GIT_TOKEN"] - Expect(gitAuthTokenForPublicRepo).NotTo(BeEmpty()) + fmt.Fprintf(GinkgoWriter, "Service URL: %v\n", serviceURL) + shouldSkipTest = func() {} }) }) @@ -103,23 +103,15 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() { shouldSkipTest() }) It("Successfully construct the service client instance", func() { - // begin-common - catalogManagementServiceOptions := &catalogmanagementv1.CatalogManagementV1Options{} - catalogManagementService, err := catalogmanagementv1.NewCatalogManagementV1UsingExternalConfig(catalogManagementServiceOptions) - - if err != nil { - panic(err) - } - - // end-common - + catalogManagementService, err = catalogmanagementv1.NewCatalogManagementV1UsingExternalConfig(catalogManagementServiceOptions) + Expect(err).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) + Expect(catalogManagementService.Service.Options.URL).To(Equal(serviceURL)) - bearerToken, err := catalogManagementService.Service.Options.Authenticator.(*core.IamAuthenticator).GetToken() - Expect(err).To(BeNil()) - Expect(bearerToken).NotTo(BeNil()) + core.SetLogger(core.NewLogger(core.LevelDebug, log.New(GinkgoWriter, "", log.LstdFlags), log.New(GinkgoWriter, "", log.LstdFlags))) + catalogManagementService.EnableRetries(4, 30*time.Second) }) }) @@ -128,14 +120,14 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() { shouldSkipTest() }) - It(`CreateCatalog request example`, func() { + It(`CreateCatalog for offerings request example`, func() { fmt.Println("\nCreateCatalog() result:") // begin-create_catalog createCatalogOptions := catalogManagementService.NewCreateCatalogOptions() createCatalogOptions.Label = core.StringPtr("Catalog Management Service") createCatalogOptions.Tags = []string{"go", "sdk"} - createCatalogOptions.Kind = core.StringPtr("vpe") + createCatalogOptions.Kind = core.StringPtr("offering") createCatalogOptions.OwningAccount = &accountID catalog, response, err := catalogManagementService.CreateCatalog(createCatalogOptions) @@ -154,6 +146,32 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() { catalogID = *catalog.ID }) + It(`CreateCatalog for objects request example`, func() { + fmt.Println("\nCreateCatalog() result:") + // begin-create_catalog + + createCatalogOptions := catalogManagementService.NewCreateCatalogOptions() + createCatalogOptions.Label = core.StringPtr("Catalog Management Service") + createCatalogOptions.Tags = []string{"go", "sdk"} + createCatalogOptions.Kind = core.StringPtr("vpe") + createCatalogOptions.OwningAccount = &accountID + + catalog, response, err := catalogManagementService.CreateCatalog(createCatalogOptions) + if err != nil { + panic(err) + } + b, _ := json.MarshalIndent(catalog, "", " ") + fmt.Println(string(b)) + + // end-create_catalog + + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(201)) + Expect(catalog).ToNot(BeNil()) + + objectCatalogID = *catalog.ID + }) + It(`GetCatalog request example`, func() { fmt.Println("\nGetCatalog() result:") // begin-get_catalog @@ -326,11 +344,11 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() { catalogID, ) importOfferingOptions.Tags = []string{"go", "sdk"} - importOfferingOptions.TargetKinds = []string{"roks"} - 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.TargetKinds = []string{"terraform"} + importOfferingOptions.Zipurl = core.StringPtr("https://github.com/IBM-Cloud/terraform-sample/archive/refs/tags/v1.1.0.tar.gz") 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) @@ -393,9 +411,9 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() { } createObjectOptions := catalogManagementService.NewCreateObjectOptions( - catalogID, + objectCatalogID, ) - createObjectOptions.CatalogID = &catalogID + createObjectOptions.CatalogID = &objectCatalogID createObjectOptions.Name = core.StringPtr("object_in_ibm_cloud") createObjectOptions.CRN = core.StringPtr("crn:v1:bluemix:public:iam-global-endpoint:global:::endpoint:private.iam.cloud.ibm.com") createObjectOptions.ParentID = core.StringPtr("us-south") @@ -419,29 +437,6 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() { objectID = *catalogObject.ID }) - It(`GetOfferingAudit request example`, func() { - fmt.Println("\nGetOfferingAudit() result:") - // begin-get_offering_audit - - getOfferingAuditOptions := catalogManagementService.NewGetOfferingAuditOptions( - catalogID, - offeringID, - ) - - auditLog, response, err := catalogManagementService.GetOfferingAudit(getOfferingAuditOptions) - if err != nil { - panic(err) - } - b, _ := json.MarshalIndent(auditLog, "", " ") - fmt.Println(string(b)) - - // end-get_offering_audit - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(auditLog).ToNot(BeNil()) - }) - It(`GetCatalogAccount request example`, func() { fmt.Println("\nGetCatalogAccount() result:") // begin-get_catalog_account @@ -473,7 +468,7 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() { updateCatalogAccountOptions.AccountFilters = includeAllFilter updateCatalogAccountOptions.ID = &accountID - response, err := catalogManagementService.UpdateCatalogAccount(updateCatalogAccountOptions) + _, response, err := catalogManagementService.UpdateCatalogAccount(updateCatalogAccountOptions) if err != nil { panic(err) } @@ -485,26 +480,6 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() { Expect(response.StatusCode).To(Equal(200)) }) - It(`GetCatalogAccountAudit request example`, func() { - fmt.Println("\nGetCatalogAccountAudit() result:") - // begin-get_catalog_account_audit - - getCatalogAccountAuditOptions := catalogManagementService.NewGetCatalogAccountAuditOptions() - - auditLog, response, err := catalogManagementService.GetCatalogAccountAudit(getCatalogAccountAuditOptions) - if err != nil { - panic(err) - } - b, _ := json.MarshalIndent(auditLog, "", " ") - fmt.Println(string(b)) - - // end-get_catalog_account_audit - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(auditLog).ToNot(BeNil()) - }) - It(`GetCatalogAccountFilters request example`, func() { fmt.Println("\nGetCatalogAccountFilters() result:") // begin-get_catalog_account_filters @@ -525,28 +500,6 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() { Expect(accumulatedFilters).ToNot(BeNil()) }) - It(`GetCatalogAudit request example`, func() { - fmt.Println("\nGetCatalogAudit() result:") - // begin-get_catalog_audit - - getCatalogAuditOptions := catalogManagementService.NewGetCatalogAuditOptions( - catalogID, - ) - - auditLog, response, err := catalogManagementService.GetCatalogAudit(getCatalogAuditOptions) - if err != nil { - panic(err) - } - b, _ := json.MarshalIndent(auditLog, "", " ") - fmt.Println(string(b)) - - // end-get_catalog_audit - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(auditLog).ToNot(BeNil()) - }) - It(`GetConsumptionOfferings request example`, func() { fmt.Println("\nGetConsumptionOfferings() result:") // begin-get_consumption_offerings @@ -578,7 +531,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 { @@ -594,59 +547,8 @@ 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.") + Skip("Skipped by design.") fmt.Println("\nGetOfferingUpdates() result:") // begin-get_offering_updates @@ -676,7 +578,7 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() { }) It(`GetOfferingAbout request example`, func() { - Skip("Skipped by desing.") + Skip("Skipped by design.") fmt.Println("\nGetOfferingAbout() result:") // begin-get_offering_about @@ -699,7 +601,7 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() { }) It(`GetOfferingLicense request example`, func() { - Skip("Skipped by desing.") + Skip("Skipped by design.") fmt.Println("\nGetOfferingLicense() result:") // begin-get_offering_license @@ -723,6 +625,7 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() { }) It(`GetOfferingContainerImages request example`, func() { + Skip("Skipped by design.") fmt.Println("\nGetOfferingContainerImages() result:") // begin-get_offering_container_images @@ -745,7 +648,7 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() { }) It(`DeprecateVersion request example`, func() { - Skip("Skipped by desing.") + Skip("Skipped by design.") // begin-deprecate_version deprecateVersionOptions := catalogManagementService.NewDeprecateVersionOptions( @@ -765,7 +668,7 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() { }) It(`AccountPublishVersion request example`, func() { - Skip("Skipped by desing.") + Skip("Skipped by design.") // begin-account_publish_version accountPublishVersionOptions := catalogManagementService.NewAccountPublishVersionOptions( @@ -785,7 +688,7 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() { }) It(`IBMPublishVersion request example`, func() { - Skip("Skipped by desing.") + Skip("Skipped by design.") // begin-ibm_publish_version ibmPublishVersionOptions := catalogManagementService.NewIBMPublishVersionOptions( @@ -805,7 +708,7 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() { }) It(`PublicPublishVersion request example`, func() { - Skip("Skipped by desing.") + Skip("Skipped by design.") // begin-public_publish_version publicPublishVersionOptions := catalogManagementService.NewPublicPublishVersionOptions( @@ -825,7 +728,7 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() { }) It(`CommitVersion request example`, func() { - Skip("Skipped by desing.") + Skip("Skipped by design.") // begin-commit_version commitVersionOptions := catalogManagementService.NewCommitVersionOptions( @@ -845,7 +748,7 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() { }) It(`CopyVersion request example`, func() { - Skip("Skipped by desing.") + Skip("Skipped by design.") // begin-copy_version copyVersionOptions := catalogManagementService.NewCopyVersionOptions( @@ -866,7 +769,7 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() { }) It(`GetOfferingWorkingCopy request example`, func() { - Skip("Skipped by desing.") + Skip("Skipped by design.") fmt.Println("\nGetOfferingWorkingCopy() result:") // begin-get_offering_working_copy @@ -911,7 +814,7 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() { }) It(`GetCluster request example`, func() { - Skip("Skipped by desing.") + Skip("Skipped by design.") fmt.Println("\nGetCluster() result:") // begin-get_cluster @@ -936,7 +839,7 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() { }) It(`GetNamespaces request example`, func() { - Skip("Skipped by desing.") + Skip("Skipped by design.") fmt.Println("\nGetNamespaces() result:") // begin-get_namespaces @@ -961,7 +864,7 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() { }) It(`DeployOperators request example`, func() { - Skip("Skipped by desing.") + Skip("Skipped by design.") fmt.Println("\nDeployOperators() result:") // begin-deploy_operators @@ -988,7 +891,7 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() { }) It(`ListOperators request example`, func() { - Skip("Skipped by desing.") + Skip("Skipped by design.") fmt.Println("\nListOperators() result:") // begin-list_operators @@ -1014,7 +917,7 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() { }) It(`ReplaceOperators request example`, func() { - Skip("Skipped by desing.") + Skip("Skipped by design.") fmt.Println("\nReplaceOperators() result:") // begin-replace_operators @@ -1041,7 +944,7 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() { }) It(`InstallVersion request example`, func() { - Skip("Skipped by desing.") + Skip("Skipped by design.") // begin-install_version installVersionOptions := catalogManagementService.NewInstallVersionOptions( @@ -1062,7 +965,7 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() { }) It(`PreinstallVersion request example`, func() { - Skip("Skipped by desing.") + Skip("Skipped by design.") // begin-preinstall_version preinstallVersionOptions := catalogManagementService.NewPreinstallVersionOptions( @@ -1083,7 +986,7 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() { }) It(`GetPreinstall request example`, func() { - Skip("Skipped by desing.") + Skip("Skipped by design.") fmt.Println("\nGetPreinstall() result:") // begin-get_preinstall @@ -1107,7 +1010,7 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() { }) It(`ValidateInstall request example`, func() { - Skip("Skipped by desing.") + Skip("Skipped by design.") // begin-validate_install validateInstallOptions := catalogManagementService.NewValidateInstallOptions( @@ -1128,6 +1031,7 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() { }) It(`GetValidationStatus request example`, func() { + Skip("Skipped by design.") fmt.Println("\nGetValidationStatus() result:") // begin-get_validation_status @@ -1151,7 +1055,7 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() { }) It(`GetOverrideValues request example`, func() { - Skip("Skipped by desing.") + Skip("Skipped by design.") fmt.Println("\nGetOverrideValues() result:") // begin-get_override_values @@ -1204,7 +1108,7 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() { // begin-list_objects listObjectsOptions := catalogManagementService.NewListObjectsOptions( - catalogID, + objectCatalogID, ) listObjectsOptions.Limit = core.Int64Ptr(100) listObjectsOptions.Offset = core.Int64Ptr(0) @@ -1224,19 +1128,19 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() { }) It(`ReplaceObject request example`, func() { - Skip("Skipped by desing.") + Skip("Skipped by design.") fmt.Println("\nReplaceObject() result:") // begin-replace_object replaceObjectOptions := catalogManagementService.NewReplaceObjectOptions( - catalogID, + objectCatalogID, objectID, ) replaceObjectOptions.ID = &objectID replaceObjectOptions.Name = core.StringPtr("updated-object-name") replaceObjectOptions.ParentID = core.StringPtr("us-south") replaceObjectOptions.Kind = core.StringPtr("vpe") - replaceObjectOptions.CatalogID = &catalogID + replaceObjectOptions.CatalogID = &objectCatalogID catalogObject, response, err := catalogManagementService.ReplaceObject(replaceObjectOptions) if err != nil { @@ -1257,7 +1161,7 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() { // begin-get_object getObjectOptions := catalogManagementService.NewGetObjectOptions( - catalogID, + objectCatalogID, objectID, ) @@ -1275,34 +1179,12 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() { Expect(catalogObject).ToNot(BeNil()) }) - It(`GetObjectAudit request example`, func() { - fmt.Println("\nGetObjectAudit() result:") - // begin-get_object_audit - - getObjectAuditOptions := catalogManagementService.NewGetObjectAuditOptions( - catalogID, - objectID, - ) - - auditLog, response, err := catalogManagementService.GetObjectAudit(getObjectAuditOptions) - if err != nil { - panic(err) - } - b, _ := json.MarshalIndent(auditLog, "", " ") - fmt.Println(string(b)) - - // end-get_object_audit - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(auditLog).ToNot(BeNil()) - }) - It(`AccountPublishObject request example`, func() { + Skip("Skipped by design.") // begin-account_publish_object accountPublishObjectOptions := catalogManagementService.NewAccountPublishObjectOptions( - catalogID, + objectCatalogID, objectID, ) @@ -1319,11 +1201,11 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() { }) It(`SharedPublishObject request example`, func() { - Skip("Skipped by desing.") + Skip("Skipped by design.") // begin-shared_publish_object sharedPublishObjectOptions := catalogManagementService.NewSharedPublishObjectOptions( - catalogID, + objectCatalogID, objectID, ) @@ -1340,11 +1222,11 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() { }) It(`IBMPublishObject request example`, func() { - Skip("Skipped by desing.") + Skip("Skipped by design.") // begin-ibm_publish_object ibmPublishObjectOptions := catalogManagementService.NewIBMPublishObjectOptions( - catalogID, + objectCatalogID, objectID, ) @@ -1361,11 +1243,11 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() { }) It(`PublicPublishObject request example`, func() { - Skip("Skipped by desing.") + Skip("Skipped by design.") // begin-public_publish_object publicPublishObjectOptions := catalogManagementService.NewPublicPublishObjectOptions( - catalogID, + objectCatalogID, objectID, ) @@ -1385,7 +1267,7 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() { // begin-create_object_access createObjectAccessOptions := catalogManagementService.NewCreateObjectAccessOptions( - catalogID, + objectCatalogID, objectID, accountID, ) @@ -1407,7 +1289,7 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() { // begin-get_object_access getObjectAccessOptions := catalogManagementService.NewGetObjectAccessOptions( - catalogID, + objectCatalogID, objectID, accountID, ) @@ -1431,7 +1313,7 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() { // begin-add_object_access_list addObjectAccessListOptions := catalogManagementService.NewAddObjectAccessListOptions( - catalogID, + objectCatalogID, objectID, []string{accountID}, ) @@ -1451,11 +1333,12 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() { }) It(`GetObjectAccessList request example`, func() { + Skip("Skipped by design.") fmt.Println("\nGetObjectAccessList() result:") // begin-get_object_access_list getObjectAccessListOptions := catalogManagementService.NewGetObjectAccessListOptions( - catalogID, + objectCatalogID, objectID, ) @@ -1474,7 +1357,7 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() { }) It(`CreateOfferingInstance request example`, func() { - Skip("Skipped by desing.") + Skip("Skipped by design.") fmt.Println("\nCreateOfferingInstance() result:") // begin-create_offering_instance @@ -1508,7 +1391,7 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() { It(`GetOfferingInstance request example`, func() { fmt.Println("\nGetOfferingInstance() result:") - Skip("Skipped by desing.") + Skip("Skipped by design.") // begin-get_offering_instance getOfferingInstanceOptions := catalogManagementService.NewGetOfferingInstanceOptions( @@ -1530,7 +1413,7 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() { }) It(`PutOfferingInstance request example`, func() { - Skip("Skipped by desing.") + Skip("Skipped by design.") fmt.Println("\nPutOfferingInstance() result:") // begin-put_offering_instance @@ -1581,7 +1464,7 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() { }) It(`DeleteOperators request example`, func() { - Skip("Skipped by desing.") + Skip("Skipped by design.") // begin-delete_operators deleteOperatorsOptions := catalogManagementService.NewDeleteOperatorsOptions( @@ -1604,7 +1487,7 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() { }) It(`DeleteOfferingInstance request example`, func() { - Skip("Skipped by desing.") + Skip("Skipped by design.") // begin-delete_offering_instance deleteOfferingInstanceOptions := catalogManagementService.NewDeleteOfferingInstanceOptions( @@ -1629,7 +1512,7 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() { // begin-delete_object_access_list deleteObjectAccessListOptions := catalogManagementService.NewDeleteObjectAccessListOptions( - catalogID, + objectCatalogID, objectID, []string{accountID}, ) @@ -1652,7 +1535,7 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() { // begin-delete_object_access deleteObjectAccessOptions := catalogManagementService.NewDeleteObjectAccessOptions( - catalogID, + objectCatalogID, objectID, accountID, ) @@ -1673,7 +1556,7 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() { // begin-delete_object deleteObjectOptions := catalogManagementService.NewDeleteObjectOptions( - catalogID, + objectCatalogID, objectID, ) @@ -1709,7 +1592,7 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() { Expect(response.StatusCode).To(Equal(200)) }) - It(`DeleteCatalog request example`, func() { + It(`DeleteCatalog for offerings request example`, func() { // begin-delete_catalog deleteCatalogOptions := catalogManagementService.NewDeleteCatalogOptions( @@ -1727,5 +1610,24 @@ var _ = Describe(`CatalogManagementV1 Examples Tests`, func() { Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) }) + + It(`DeleteCatalog for objects request example`, func() { + // begin-delete_catalog + + deleteCatalogOptions := catalogManagementService.NewDeleteCatalogOptions( + objectCatalogID, + ) + + response, err := catalogManagementService.DeleteCatalog(deleteCatalogOptions) + if err != nil { + panic(err) + } + + // end-delete_catalog + fmt.Printf("\nDeleteCatalog() response status code: %d\n", response.StatusCode) + + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + }) }) }) diff --git a/catalogmanagementv1/catalog_management_v1_integration_new_test.go b/catalogmanagementv1/catalog_management_v1_integration_new_test.go deleted file mode 100644 index 1459dcc0..00000000 --- a/catalogmanagementv1/catalog_management_v1_integration_new_test.go +++ /dev/null @@ -1,4718 +0,0 @@ -// +build integration - -/** - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package catalogmanagementv1_test - -import ( - "fmt" - "log" - "os" - "strconv" - - "github.com/IBM/go-sdk-core/v5/core" - "github.com/IBM/platform-services-go-sdk/catalogmanagementv1" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -/** - * This file contains an integration test for the catalogmanagementv1 package. - * - * Notes: - * - * The integration test will automatically skip tests if the required config file is not available. - */ - -var _ = Describe(`CatalogManagementV1 Integration Tests`, func() { - - const externalConfigFile = "../catalog_mgmt.env" - - var ( - err error - catalogManagementServiceAuthorized *catalogmanagementv1.CatalogManagementV1 - catalogManagementServiceNotAuthorized *catalogmanagementv1.CatalogManagementV1 - serviceURL string - config map[string]string - importOfferingZipUrl = "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" - labelGoSdk = "go-sdk" - kindVPE = "vpe" - kindRoks = "roks" - namespaceGoSDK = "java" - bogusRevision = "bogus-revision" - bogusVersionLocatorID = "bogus-version-locator-id" - repoTypeGitPublic = "git_public" - objectName = "object_created_by_go_sdk15" - regionUSSouth = "us-south" - objectCRN = "crn:v1:bluemix:public:iam-global-endpoint:global:::endpoint:private.iam.cloud.ibm.com" - accountID string - gitAuthToken string - catalogID string - createdOfferingIDs []string - offeringID string - versionLocatorID string - objectID string - createdObjectIDs []string - clusterID string - refreshTokenAuthorized string - refreshTokenNotAuthorized string - offeringInstanceID string - ) - - var shouldSkipTest = func() { - Skip("External configuration is not available, skipping tests...") - } - - Describe(`External configuration`, func() { - It("Successfully load the configuration", func() { - _, err = os.Stat(externalConfigFile) - if err != nil { - Skip("External configuration file not found, skipping tests: " + err.Error()) - } - - os.Setenv("IBM_CREDENTIALS_FILE", externalConfigFile) - config, err = core.GetServiceProperties(catalogmanagementv1.DefaultServiceName) - if err != nil { - Skip("Error loading service properties, skipping tests: " + err.Error()) - } - serviceURL = config["URL"] - if serviceURL == "" { - Skip("Unable to load service URL configuration property, skipping tests") - } - - accountID = config["ACCOUNT_ID"] - Expect(accountID).NotTo(BeNil()) - - gitAuthToken = config["GIT_TOKEN"] - Expect(gitAuthToken).NotTo(BeNil()) - - clusterID = config["CLUSTER_ID"] - Expect(clusterID).NotTo(BeNil()) - - fmt.Printf("Service URL: %s\n", serviceURL) - shouldSkipTest = func() {} - }) - }) - - Describe(`Client initialization`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It("Successfully construct the service client instance", func() { - - core.SetLogger( - core.NewLogger( - core.LevelDebug, - log.New(GinkgoWriter, "", log.LstdFlags), - log.New(GinkgoWriter, "", log.LstdFlags))) - - catalogManagementServiceOptions := &catalogmanagementv1.CatalogManagementV1Options{} - catalogManagementServiceAuthorized, err = catalogmanagementv1.NewCatalogManagementV1UsingExternalConfig( - catalogManagementServiceOptions) - - Expect(err).To(BeNil()) - Expect(catalogManagementServiceAuthorized).ToNot(BeNil()) - Expect(catalogManagementServiceAuthorized.Service.Options.URL).To(Equal(serviceURL)) - - tokenAuthorized, err := catalogManagementServiceAuthorized.Service.Options.Authenticator.(*core.IamAuthenticator).RequestToken() - Expect(err).To(BeNil()) - refreshTokenAuthorized = tokenAuthorized.RefreshToken - Expect(refreshTokenAuthorized).ToNot(BeNil()) - - catalogManagementUnauthorizedServiceOptions := &catalogmanagementv1.CatalogManagementV1Options{ - ServiceName: "NOT_AUTHORIZED", - } - catalogManagementServiceNotAuthorized, err = catalogmanagementv1.NewCatalogManagementV1UsingExternalConfig( - catalogManagementUnauthorizedServiceOptions) - Expect(err).To(BeNil()) - Expect(catalogManagementServiceNotAuthorized).ToNot(BeNil()) - Expect(catalogManagementServiceNotAuthorized.Service.Options.URL).To(Equal(serviceURL)) - - tokenNotAuthorized, err := catalogManagementServiceAuthorized.Service.Options.Authenticator.(*core.IamAuthenticator).RequestToken() - Expect(err).To(BeNil()) - refreshTokenNotAuthorized = tokenNotAuthorized.RefreshToken - Expect(refreshTokenNotAuthorized).ToNot(BeNil()) - }) - }) - - Describe(`CreateCatalog`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`Returns 400 when user is not authorized`, func() { - - createCatalogOptions := &catalogmanagementv1.CreateCatalogOptions{ - Label: &labelGoSdk, - Tags: []string{"go", "sdk"}, - OwningAccount: &accountID, - Kind: &kindVPE, - } - - _, response, err := catalogManagementServiceNotAuthorized.CreateCatalog(createCatalogOptions) - - Expect(err).ToNot(BeNil()) - Expect(response.StatusCode).To(Equal(400)) - }) - - It(`Returns 400 when backend input validation fails`, func() { - - Skip("It will not give 400 with required values set") - - createCatalogOptions := &catalogmanagementv1.CreateCatalogOptions{ - Label: &labelGoSdk, - Rev: &bogusRevision, - Tags: []string{"go", "sdk"}, - OwningAccount: &accountID, - Kind: &kindVPE, - } - - _, response, err := catalogManagementServiceAuthorized.CreateCatalog(createCatalogOptions) - - Expect(err).ToNot(BeNil()) - Expect(response.StatusCode).To(Equal(400)) - }) - - It(`Creates a catalog`, func() { - - createCatalogOptions := &catalogmanagementv1.CreateCatalogOptions{ - Label: &labelGoSdk, - Tags: []string{"go", "sdk"}, - OwningAccount: &accountID, - Kind: &kindVPE, - } - - result, response, err := catalogManagementServiceAuthorized.CreateCatalog(createCatalogOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(201)) - Expect(result).NotTo(BeNil()) - Expect(result.ID).NotTo(BeNil()) - catalogID = *result.ID - }) - }) - - Describe(`Get Catalog`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - - It(`Returns 404 when no such catalog`, func() { - Expect(catalogID).NotTo(BeNil()) - - invalidCatalogId := "invalid-" + catalogID - getCatalogOptions := &catalogmanagementv1.GetCatalogOptions{ - CatalogIdentifier: &invalidCatalogId, - } - - _, response, err := catalogManagementServiceAuthorized.GetCatalog(getCatalogOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(404)) - }) - - It(`Returns 403 when user is not authorized`, func() { - Expect(catalogID).NotTo(BeNil()) - - getCatalogOptions := &catalogmanagementv1.GetCatalogOptions{ - CatalogIdentifier: &catalogID, - } - - _, response, err := catalogManagementServiceNotAuthorized.GetCatalog(getCatalogOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - It(`Returns the catalog`, func() { - Expect(catalogID).NotTo(BeNil()) - - getCatalogOptions := &catalogmanagementv1.GetCatalogOptions{ - CatalogIdentifier: &catalogID, - } - - catalog, response, err := catalogManagementServiceAuthorized.GetCatalog(getCatalogOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(catalog).NotTo(BeNil()) - Expect(*catalog.ID).To(Equal(catalogID)) - }) - }) - - Describe(`Replace Catalog`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - - It(`Returns 403 when user is not authorized`, func() { - Expect(catalogID).NotTo(BeNil()) - - replaceCatalogOptions := &catalogmanagementv1.ReplaceCatalogOptions{ - CatalogIdentifier: &catalogID, - ID: &catalogID, - OwningAccount: &accountID, - Kind: &kindVPE, - } - - _, response, err := catalogManagementServiceNotAuthorized.ReplaceCatalog(replaceCatalogOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - It(`Returns 400 when backend input validation fails`, func() { - Expect(catalogID).NotTo(BeNil()) - - invalidCatalogID := "invalid-" + catalogID - replaceCatalogOptions := &catalogmanagementv1.ReplaceCatalogOptions{ - CatalogIdentifier: &catalogID, - ID: &invalidCatalogID, - OwningAccount: &accountID, - Kind: &kindVPE, - } - - _, response, err := catalogManagementServiceAuthorized.ReplaceCatalog(replaceCatalogOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(400)) - }) - - It(`Returns 404 when no such catalog`, func() { - Expect(catalogID).NotTo(BeNil()) - - invalidCatalogID := "invalid-" + catalogID - replaceCatalogOptions := &catalogmanagementv1.ReplaceCatalogOptions{ - CatalogIdentifier: &invalidCatalogID, - ID: &invalidCatalogID, - OwningAccount: &accountID, - Kind: &kindVPE, - } - - _, response, err := catalogManagementServiceAuthorized.ReplaceCatalog(replaceCatalogOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(404)) - }) - - It(`Replaces the catalog`, func() { - Expect(catalogID).NotTo(BeNil()) - - tags := []string{"go", "sdk", "update"} - replaceCatalogOptions := &catalogmanagementv1.ReplaceCatalogOptions{ - CatalogIdentifier: &catalogID, - ID: &catalogID, - Tags: tags, - OwningAccount: &accountID, - Kind: &kindVPE, - } - - catalog, response, err := catalogManagementServiceAuthorized.ReplaceCatalog(replaceCatalogOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(catalog).NotTo(BeNil()) - Expect(catalog.Tags).To(Equal(tags)) - }) - }) - - Describe(`List Catalogs`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`Lists Catalogs`, func() { - - listCatalogsOptions := &catalogmanagementv1.ListCatalogsOptions{} - - catalogSearchResult, response, err := catalogManagementServiceAuthorized.ListCatalogs(listCatalogsOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(catalogSearchResult.Resources).ToNot(BeNil()) - - contains := false - for _, ctl := range catalogSearchResult.Resources { - if *ctl.ID == catalogID { - contains = true - break - } - } - Expect(contains).To(BeTrue()) - }) - }) - - Describe(`Create Offering`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`Returns 404 when no such catalog`, func() { - Expect(catalogID).NotTo(BeNil()) - - invalidCatalogID := "invalid-" + catalogID - createOfferingOptions := &catalogmanagementv1.CreateOfferingOptions{ - CatalogIdentifier: &invalidCatalogID, - } - - _, response, err := catalogManagementServiceAuthorized.CreateOffering(createOfferingOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(404)) - }) - - It(`Returns 400 when backend input validation fails`, func() { - Expect(catalogID).NotTo(BeNil()) - - offeringName := "offering created by go sdk" - createOfferingOptions := &catalogmanagementv1.CreateOfferingOptions{ - CatalogIdentifier: &catalogID, - CatalogID: &catalogID, - Name: &offeringName, - } - - _, response, err := catalogManagementServiceAuthorized.CreateOffering(createOfferingOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(400)) - }) - - It(`Returns 403 when user is not authorized`, func() { - Expect(catalogID).NotTo(BeNil()) - - offeringName := "offering-created-by-go-sdk" - createOfferingOptions := &catalogmanagementv1.CreateOfferingOptions{ - CatalogIdentifier: &catalogID, - ID: &catalogID, - Name: &offeringName, - } - - _, response, err := catalogManagementServiceNotAuthorized.CreateOffering(createOfferingOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - It(`Creates an offering`, func() { - Expect(catalogID).NotTo(BeNil()) - - for i := 0; i < 2; i++ { - var name = fmt.Sprintf("offering-created-by-go-sdk-%d", i) - createOfferingOptions := &catalogmanagementv1.CreateOfferingOptions{ - CatalogIdentifier: &catalogID, - Name: &name, - } - - offering, response, err := catalogManagementServiceAuthorized.CreateOffering(createOfferingOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(201)) - Expect(offering).NotTo(BeNil()) - Expect(offering.ID).NotTo(BeNil()) - - if offeringID == "" { - offeringID = *offering.ID - } - createdOfferingIDs = append(createdOfferingIDs, *offering.ID) - } - }) - }) - - Describe(`Get Offering`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - - It(`Returns 404 when no such offering`, func() { - Expect(catalogID).NotTo(BeNil()) - Expect(offeringID).NotTo(BeNil()) - - invalidOfferingID := "invalid-" + offeringID - getOfferingOptions := &catalogmanagementv1.GetOfferingOptions{ - CatalogIdentifier: &catalogID, - OfferingID: &invalidOfferingID, - } - - _, response, err := catalogManagementServiceAuthorized.GetOffering(getOfferingOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(404)) - }) - - It(`Returns 403 when user is not authorized`, func() { - Expect(catalogID).NotTo(BeNil()) - Expect(offeringID).NotTo(BeNil()) - - getOfferingOptions := &catalogmanagementv1.GetOfferingOptions{ - CatalogIdentifier: &catalogID, - OfferingID: &offeringID, - } - - _, response, err := catalogManagementServiceNotAuthorized.GetOffering(getOfferingOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - It(`Returns the offering`, func() { - Expect(catalogID).NotTo(BeNil()) - Expect(offeringID).NotTo(BeNil()) - - getOfferingOptions := &catalogmanagementv1.GetOfferingOptions{ - CatalogIdentifier: &catalogID, - OfferingID: &offeringID, - } - - offering, response, err := catalogManagementServiceAuthorized.GetOffering(getOfferingOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(offering).NotTo(BeNil()) - Expect(*offering.ID).To(Equal(offeringID)) - Expect(*offering.CatalogID).To(Equal(catalogID)) - }) - }) - - Describe(`Replace Offering`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`Returns 404 when no such offering`, func() { - Expect(catalogID).NotTo(BeNil()) - Expect(offeringID).NotTo(BeNil()) - - invalidOfferingID := "invalid-" + offeringID - replaceOfferingOptions := &catalogmanagementv1.ReplaceOfferingOptions{ - CatalogIdentifier: &catalogID, - OfferingID: &invalidOfferingID, - ID: &invalidOfferingID, - Name: core.StringPtr("updated-offering-name-by-go-sdk"), - } - - _, response, err := catalogManagementServiceAuthorized.ReplaceOffering(replaceOfferingOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(404)) - }) - - It(`Returns 400 when backend input validation fails`, func() { - Expect(catalogID).NotTo(BeNil()) - Expect(offeringID).NotTo(BeNil()) - - updatedOfferingName := "updated offering name by go sdk" - replaceOfferingOptions := &catalogmanagementv1.ReplaceOfferingOptions{ - CatalogIdentifier: &catalogID, - OfferingID: &offeringID, - ID: &offeringID, - Name: &updatedOfferingName, - } - - _, response, err := catalogManagementServiceAuthorized.ReplaceOffering(replaceOfferingOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(400)) - }) - - It(`Returns 403 when user is not authorized`, func() { - Expect(catalogID).NotTo(BeNil()) - Expect(offeringID).NotTo(BeNil()) - - replaceOfferingOptions := &catalogmanagementv1.ReplaceOfferingOptions{ - CatalogIdentifier: &catalogID, - OfferingID: &offeringID, - ID: &offeringID, - Name: core.StringPtr("updated-offering-name-by-go-sdk"), - } - - _, response, err := catalogManagementServiceNotAuthorized.ReplaceOffering(replaceOfferingOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - // once the version related conflict is resolved this test requires a conflict case - It(`Returns 409 when conflict occurs`, func() { - Expect(catalogID).NotTo(BeNil()) - Expect(offeringID).NotTo(BeNil()) - - replaceOfferingOptions := &catalogmanagementv1.ReplaceOfferingOptions{ - CatalogIdentifier: &catalogID, - OfferingID: &offeringID, - ID: &offeringID, - Name: core.StringPtr("updated-offering-name-by-go-sdk"), - } - - _, response, err := catalogManagementServiceAuthorized.ReplaceOffering(replaceOfferingOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(409)) - }) - - It(`Updates the offering`, func() { - Skip("Revision conflict.") - - Expect(catalogID).NotTo(BeNil()) - Expect(offeringID).NotTo(BeNil()) - - updatedOfferingName := "updated-offering-name-by-go-sdk" - replaceOfferingOptions := &catalogmanagementv1.ReplaceOfferingOptions{ - CatalogIdentifier: &catalogID, - OfferingID: &offeringID, - ID: &offeringID, - Name: &updatedOfferingName, - } - - offering, response, err := catalogManagementServiceAuthorized.ReplaceOffering(replaceOfferingOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(offering).NotTo(BeNil()) - - Expect(*offering.ID).To(Equal(offeringID)) - Expect(*offering.CatalogID).To(Equal(catalogID)) - Expect(*offering.Name).To(Equal(updatedOfferingName)) - }) - }) - - Describe(`Update Offering`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - - It(`Updates the offering`, func() { - - Expect(catalogID).NotTo(BeNil()) - Expect(offeringID).NotTo(BeNil()) - - // Get offering to use the _rev - getOfferingOptions := &catalogmanagementv1.GetOfferingOptions{ - CatalogIdentifier: &catalogID, - OfferingID: &offeringID, - } - - offering, response, err := catalogManagementServiceAuthorized.GetOffering(getOfferingOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(offering).NotTo(BeNil()) - Expect(*offering.ID).To(Equal(offeringID)) - Expect(*offering.CatalogID).To(Equal(catalogID)) - - updatedOfferingName := "updated-offering-name-by-go-sdk-patch" - updatedOffering := &catalogmanagementv1.Offering{ - Name: &updatedOfferingName, - } - - patchDocuments := catalogManagementServiceAuthorized.NewOfferingPatch(updatedOffering) - - ifMatch := "\"" + *offering.Rev + "\"" - - updateOfferingOptions := &catalogmanagementv1.UpdateOfferingOptions{ - CatalogIdentifier: &catalogID, - OfferingID: &offeringID, - IfMatch: &ifMatch, - Updates: patchDocuments, - } - - offering, response, err = catalogManagementServiceAuthorized.UpdateOffering(updateOfferingOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(offering).NotTo(BeNil()) - - Expect(*offering.ID).To(Equal(offeringID)) - Expect(*offering.CatalogID).To(Equal(catalogID)) - - Expect(*offering.Name).To(Equal(updatedOfferingName)) - }) - - It(`Returns 412 on bad request`, func() { - ifMatch := bogusRevision - op := "replace" - path := "/name" - updatedOfferingName := "updated-offering-name-by-go-sdk-patch" - patchDocument := &catalogmanagementv1.JSONPatchOperation{ - Op: &op, - Path: &path, - Value: &updatedOfferingName, - } - updates := []catalogmanagementv1.JSONPatchOperation{ - *patchDocument, - } - updateOfferingOptions := &catalogmanagementv1.UpdateOfferingOptions{ - CatalogIdentifier: &catalogID, - OfferingID: &offeringID, - IfMatch: &ifMatch, - Updates: updates, - } - - _, response, err := catalogManagementServiceAuthorized.UpdateOffering(updateOfferingOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(412)) - }) - }) - - Describe(`List Offerings`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`Returns 403 when user is not authorized`, func() { - Expect(catalogID).NotTo(BeNil()) - - listOfferingsOptions := &catalogmanagementv1.ListOfferingsOptions{ - CatalogIdentifier: &catalogID, - } - - _, response, err := catalogManagementServiceNotAuthorized.ListOfferings(listOfferingsOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - It(`Returns 400 when backend input validation fails`, func() { - Expect(catalogID).NotTo(BeNil()) - - listOfferingsOptions := &catalogmanagementv1.ListOfferingsOptions{ - CatalogIdentifier: &catalogID, - Digest: core.BoolPtr(true), - Sort: core.StringPtr("bogus-sort-value"), - } - - _, response, err := catalogManagementServiceAuthorized.ListOfferings(listOfferingsOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(400)) - }) - - It(`Returns 404 when no such catalog`, func() { - Expect(catalogID).NotTo(BeNil()) - - invalidCatalogId := "invalid-" + catalogID - listOfferingsOptions := &catalogmanagementv1.ListOfferingsOptions{ - CatalogIdentifier: &invalidCatalogId, - } - - _, response, err := catalogManagementServiceAuthorized.ListOfferings(listOfferingsOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(404)) - }) - - It(`Returns list of offerings`, func() { - Expect(catalogID).NotTo(BeNil()) - - var offset int64 = 0 - var limit int64 = 1 - amountOfOfferings := 0 - fetchMore := true - - for fetchMore { - listOfferingsOptions := &catalogmanagementv1.ListOfferingsOptions{ - CatalogIdentifier: &catalogID, - Offset: &offset, - Limit: &limit, - } - - offeringList, response, err := catalogManagementServiceAuthorized.ListOfferings(listOfferingsOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(offeringList).NotTo(BeNil()) - - if offeringList.Next != nil { - offsetValue, err := core.GetQueryParam(offeringList.Next, "offset") - Expect(err).To(BeNil()) - - if *offsetValue != "" { - offsetVal, errOffset := strconv.ParseInt(*offsetValue, 10, 64) - Expect(errOffset).To(BeNil()) - offset = offsetVal - } - - } else { - fetchMore = false - } - - if *offeringList.ResourceCount > 0 { - amountOfOfferings += int(*offeringList.ResourceCount) - } - } - - fmt.Printf("Amount of Offerings: %d", amountOfOfferings) - }) - }) - - Describe(`ImportOffering - Import offering`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - - It(`Returns 403 when user is not authorized`, func() { - Expect(catalogID).NotTo(BeNil()) - Expect(offeringID).NotTo(BeNil()) - - importOfferingOptions := &catalogmanagementv1.ImportOfferingOptions{ - CatalogIdentifier: &catalogID, - Tags: []string{"go", "sdk"}, - TargetKinds: []string{kindVPE}, - Zipurl: &importOfferingZipUrl, - OfferingID: &offeringID, - TargetVersion: core.StringPtr("0.0.3"), - RepoType: &repoTypeGitPublic, - XAuthToken: &gitAuthToken, - } - - _, response, err := catalogManagementServiceNotAuthorized.ImportOffering(importOfferingOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - It(`Returns 400 when backend input validation fails`, func() { - Expect(catalogID).NotTo(BeNil()) - Expect(offeringID).NotTo(BeNil()) - - importOfferingOptions := &catalogmanagementv1.ImportOfferingOptions{ - CatalogIdentifier: &catalogID, - Tags: []string{"go", "sdk"}, - TargetKinds: []string{"rocks"}, - Zipurl: &importOfferingZipUrl, - OfferingID: &offeringID, - TargetVersion: core.StringPtr("0.0.2-patch"), - RepoType: &repoTypeGitPublic, - XAuthToken: &gitAuthToken, - } - - _, response, err := catalogManagementServiceAuthorized.ImportOffering(importOfferingOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(400)) - }) - - It(`Returns 404 when no such catalog`, func() { - Expect(catalogID).NotTo(BeNil()) - Expect(offeringID).NotTo(BeNil()) - - invalidCatalogId := "invalid-" + catalogID - importOfferingOptions := &catalogmanagementv1.ImportOfferingOptions{ - CatalogIdentifier: &invalidCatalogId, - Tags: []string{"go", "sdk"}, - TargetKinds: []string{kindRoks}, - Zipurl: &importOfferingZipUrl, - OfferingID: &offeringID, - TargetVersion: core.StringPtr("0.0.2"), - RepoType: &repoTypeGitPublic, - XAuthToken: &gitAuthToken, - } - - _, response, err := catalogManagementServiceAuthorized.ImportOffering(importOfferingOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(404)) - }) - - It(`Imports the offering`, func() { - Expect(catalogID).NotTo(BeNil()) - Expect(offeringID).NotTo(BeNil()) - - importOfferingOptions := &catalogmanagementv1.ImportOfferingOptions{ - CatalogIdentifier: &catalogID, - Tags: []string{"go", "sdk"}, - TargetKinds: []string{kindRoks}, - Zipurl: &importOfferingZipUrl, - OfferingID: &offeringID, - TargetVersion: core.StringPtr("0.0.2"), - RepoType: &repoTypeGitPublic, - XAuthToken: &gitAuthToken, - } - - offering, response, err := catalogManagementServiceAuthorized.ImportOffering(importOfferingOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(201)) - Expect(offering).NotTo(BeNil()) - Expect(offering.Kinds[0].Versions[0].VersionLocator).NotTo(BeNil()) - versionLocatorID = *offering.Kinds[0].Versions[0].VersionLocator - }) - - It(`Returns 409 when conflict occurs`, func() { - Expect(catalogID).NotTo(BeNil()) - Expect(offeringID).NotTo(BeNil()) - - importOfferingOptions := &catalogmanagementv1.ImportOfferingOptions{ - CatalogIdentifier: &catalogID, - Tags: []string{"go", "sdk"}, - TargetKinds: []string{kindRoks}, - Zipurl: &importOfferingZipUrl, - OfferingID: &offeringID, - TargetVersion: core.StringPtr("0.0.2"), - RepoType: &repoTypeGitPublic, - XAuthToken: &gitAuthToken, - } - - _, response, err := catalogManagementServiceAuthorized.ImportOffering(importOfferingOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(409)) - }) - }) - - Describe(`Reload Offering`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - - It(`Returns 404 when no such offering`, func() { - Expect(catalogID).NotTo(BeNil()) - Expect(offeringID).NotTo(BeNil()) - - invalidOfferingId := "invalid-" + offeringID - reloadOfferingOptions := &catalogmanagementv1.ReloadOfferingOptions{ - CatalogIdentifier: &catalogID, - OfferingID: &invalidOfferingId, - TargetVersion: core.StringPtr("0.0.2"), - TargetKinds: []string{kindRoks}, - Zipurl: &importOfferingZipUrl, - RepoType: &repoTypeGitPublic, - } - - _, response, err := catalogManagementServiceAuthorized.ReloadOffering(reloadOfferingOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(404)) - }) - - It(`Returns 403 when user is not authorized`, func() { - Expect(catalogID).NotTo(BeNil()) - Expect(offeringID).NotTo(BeNil()) - - reloadOfferingOptions := &catalogmanagementv1.ReloadOfferingOptions{ - CatalogIdentifier: &catalogID, - OfferingID: &offeringID, - TargetVersion: core.StringPtr("0.0.2"), - Zipurl: &importOfferingZipUrl, - TargetKinds: []string{kindVPE}, - RepoType: &repoTypeGitPublic, - } - - _, response, err := catalogManagementServiceNotAuthorized.ReloadOffering(reloadOfferingOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - // Error: Could not find a kind with a target/format value of roks:operator for the current offering, Code: 400 - It(`Reloads the offering`, func() { - Skip("Could not find kind.") - - Expect(catalogID).NotTo(BeNil()) - Expect(offeringID).NotTo(BeNil()) - - reloadOfferingOptions := &catalogmanagementv1.ReloadOfferingOptions{ - CatalogIdentifier: &catalogID, - OfferingID: &offeringID, - TargetVersion: core.StringPtr("0.0.2"), - TargetKinds: []string{kindRoks}, - Zipurl: &importOfferingZipUrl, - RepoType: &repoTypeGitPublic, - } - - offering, response, err := catalogManagementServiceNotAuthorized.ReloadOffering(reloadOfferingOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(201)) - Expect(offering).NotTo(BeNil()) - }) - }) - - Describe(`Create Object`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - - It(`Returns 400 when backend input validation fails`, func() { - Expect(catalogID).NotTo(BeNil()) - - publishObjectModel := &catalogmanagementv1.PublishObject{ - PermitIBMPublicPublish: core.BoolPtr(true), - IBMApproved: core.BoolPtr(true), - PublicApproved: core.BoolPtr(true), - } - - stateModel := &catalogmanagementv1.State{ - Current: core.StringPtr("new"), - } - - bogusRegionName := "bogus region name" - createObjectOptions := &catalogmanagementv1.CreateObjectOptions{ - CatalogIdentifier: &catalogID, - CatalogID: &catalogID, - Name: &objectName, - CRN: &objectCRN, - ParentID: &bogusRegionName, - Kind: core.StringPtr(kindVPE), - Publish: publishObjectModel, - State: stateModel, - } - - _, response, err := catalogManagementServiceAuthorized.CreateObject(createObjectOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(400)) - }) - - It(`Returns 403 when user is not authorized`, func() { - Expect(catalogID).NotTo(BeNil()) - - publishObjectModel := &catalogmanagementv1.PublishObject{ - PermitIBMPublicPublish: core.BoolPtr(true), - IBMApproved: core.BoolPtr(true), - PublicApproved: core.BoolPtr(true), - } - - stateModel := &catalogmanagementv1.State{ - Current: core.StringPtr("new"), - } - - createObjectOptions := &catalogmanagementv1.CreateObjectOptions{ - CatalogIdentifier: &catalogID, - CatalogID: &catalogID, - Name: &objectName, - CRN: &objectCRN, - ParentID: ®ionUSSouth, - Kind: core.StringPtr(kindVPE), - Publish: publishObjectModel, - State: stateModel, - } - - _, response, err := catalogManagementServiceNotAuthorized.CreateObject(createObjectOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - It(`Returns 404 when no such catalog`, func() { - Expect(catalogID).NotTo(BeNil()) - - publishObjectModel := &catalogmanagementv1.PublishObject{ - PermitIBMPublicPublish: core.BoolPtr(true), - IBMApproved: core.BoolPtr(true), - PublicApproved: core.BoolPtr(true), - } - - stateModel := &catalogmanagementv1.State{ - Current: core.StringPtr("new"), - } - - invalidCatalogID := "invalid-" + catalogID - createObjectOptions := &catalogmanagementv1.CreateObjectOptions{ - CatalogIdentifier: &invalidCatalogID, - CatalogID: &invalidCatalogID, - Name: &objectName, - CRN: &objectCRN, - ParentID: ®ionUSSouth, - Kind: core.StringPtr(kindVPE), - Publish: publishObjectModel, - State: stateModel, - } - - _, response, err := catalogManagementServiceAuthorized.CreateObject(createObjectOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(404)) - }) - - It(`Creates an object`, func() { - Expect(catalogID).NotTo(BeNil()) - - for i := 0; i < 2; i++ { - publishObjectModel := &catalogmanagementv1.PublishObject{ - PermitIBMPublicPublish: core.BoolPtr(true), - IBMApproved: core.BoolPtr(true), - PublicApproved: core.BoolPtr(true), - } - - stateModel := &catalogmanagementv1.State{ - Current: core.StringPtr("new"), - } - - var name = fmt.Sprintf("%s_%d", objectName, i) - createObjectOptions := &catalogmanagementv1.CreateObjectOptions{ - CatalogIdentifier: &catalogID, - CatalogID: &catalogID, - Name: &name, - CRN: &objectCRN, - ParentID: ®ionUSSouth, - Kind: core.StringPtr(kindVPE), - Publish: publishObjectModel, - State: stateModel, - } - - catalogObject, response, err := catalogManagementServiceAuthorized.CreateObject(createObjectOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(201)) - Expect(catalogObject).NotTo(BeNil()) - Expect(catalogObject.ID).NotTo(BeNil()) - - if objectID == "" { - objectID = *catalogObject.ID - } - createdObjectIDs = append(createdObjectIDs, *catalogObject.ID) - } - }) - }) - - Describe(`Get Offering Audit`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - - It(`Returns 200 when no such offering`, func() { - Expect(catalogID).NotTo(BeNil()) - Expect(offeringID).NotTo(BeNil()) - - invalidOfferingId := "invalid-" + offeringID - getOfferingAuditOptions := &catalogmanagementv1.GetOfferingAuditOptions{ - CatalogIdentifier: &catalogID, - OfferingID: &invalidOfferingId, - } - - _, response, err := catalogManagementServiceAuthorized.GetOfferingAudit(getOfferingAuditOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - }) - - It(`Returns 403 when user is not authorized`, func() { - Expect(catalogID).NotTo(BeNil()) - Expect(offeringID).NotTo(BeNil()) - - getOfferingAuditOptions := &catalogmanagementv1.GetOfferingAuditOptions{ - CatalogIdentifier: &catalogID, - OfferingID: &offeringID, - } - - _, response, err := catalogManagementServiceNotAuthorized.GetOfferingAudit(getOfferingAuditOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - It(`Returns offering audit logs`, func() { - Expect(catalogID).NotTo(BeNil()) - Expect(offeringID).NotTo(BeNil()) - - getOfferingAuditOptions := &catalogmanagementv1.GetOfferingAuditOptions{ - CatalogIdentifier: &catalogID, - OfferingID: &offeringID, - } - - auditLog, response, err := catalogManagementServiceAuthorized.GetOfferingAudit(getOfferingAuditOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(auditLog).NotTo(BeNil()) - }) - }) - - Describe(`Get Catalog Account`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`Returns the catalog account`, func() { - - getCatalogAccountOptions := &catalogmanagementv1.GetCatalogAccountOptions{} - - account, response, err := catalogManagementServiceAuthorized.GetCatalogAccount(getCatalogAccountOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(account).ToNot(BeNil()) - Expect(*account.ID).To(Equal(accountID)) - }) - }) - - Describe(`Update Catalog Account`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`Returns 400 when no such account`, func() { - Expect(accountID).NotTo(BeNil()) - - invalidAccountID := "invalid-" + accountID - updateCatalogAccountOptions := &catalogmanagementv1.UpdateCatalogAccountOptions{ - ID: &invalidAccountID, - } - - response, err := catalogManagementServiceAuthorized.UpdateCatalogAccount(updateCatalogAccountOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(400)) - }) - - It(`Returns 403 when user is not authorized`, func() { - Expect(accountID).NotTo(BeNil()) - - updateCatalogAccountOptions := &catalogmanagementv1.UpdateCatalogAccountOptions{ - ID: &accountID, - } - - response, err := catalogManagementServiceNotAuthorized.UpdateCatalogAccount(updateCatalogAccountOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - It(`Returns 400 when backend input validation fails`, func() { - Skip("User is not granted.") - Expect(accountID).NotTo(BeNil()) - - // a body with failing data comes here - - updateCatalogAccountOptions := &catalogmanagementv1.UpdateCatalogAccountOptions{ - ID: &accountID, - } - - response, err := catalogManagementServiceNotAuthorized.UpdateCatalogAccount(updateCatalogAccountOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(400)) - }) - - It(`Updates catalog account`, func() { - Skip("User is not granted.") - Expect(accountID).NotTo(BeNil()) - - // data - - updateCatalogAccountOptions := &catalogmanagementv1.UpdateCatalogAccountOptions{ - ID: &accountID, - } - - response, err := catalogManagementServiceNotAuthorized.UpdateCatalogAccount(updateCatalogAccountOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(response.Result).NotTo(BeNil()) - }) - }) - - Describe(`Get Catalog Account Audit`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`Returns 403 when user is not authorized`, func() { - - getCatalogAccountAuditOptions := &catalogmanagementv1.GetCatalogAccountAuditOptions{} - - _, response, err := catalogManagementServiceNotAuthorized.GetCatalogAccountAudit(getCatalogAccountAuditOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - It(`Returns catalog account audit logs`, func() { - - getCatalogAccountAuditOptions := &catalogmanagementv1.GetCatalogAccountAuditOptions{} - - catalogAccountAuditLogs, response, err := catalogManagementServiceAuthorized.GetCatalogAccountAudit(getCatalogAccountAuditOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(catalogAccountAuditLogs).NotTo(BeNil()) - }) - }) - - Describe(`Get Catalog Account Filters`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - - It(`Returns 403 when user is not authorized`, func() { - Expect(catalogID).ToNot(BeNil()) - - getCatalogAccountFiltersOptions := &catalogmanagementv1.GetCatalogAccountFiltersOptions{ - Catalog: &catalogID, - } - - _, response, err := catalogManagementServiceNotAuthorized.GetCatalogAccountFilters(getCatalogAccountFiltersOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - It(`Returns 404 when no such catalog`, func() { - Expect(catalogID).ToNot(BeNil()) - - invalidCatalogID := "invalid-" + catalogID - getCatalogAccountFiltersOptions := &catalogmanagementv1.GetCatalogAccountFiltersOptions{ - Catalog: &invalidCatalogID, - } - - _, response, err := catalogManagementServiceAuthorized.GetCatalogAccountFilters(getCatalogAccountFiltersOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(404)) - }) - - It(`Returns the account filters`, func() { - Expect(catalogID).ToNot(BeNil()) - - getCatalogAccountFiltersOptions := &catalogmanagementv1.GetCatalogAccountFiltersOptions{ - Catalog: &catalogID, - } - - accumulatedFilters, response, err := catalogManagementServiceAuthorized.GetCatalogAccountFilters(getCatalogAccountFiltersOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(accumulatedFilters).NotTo(BeNil()) - }) - }) - - Describe(`Get Catalog Audit - Get catalog audit log`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`Returns 404 when no such catalog`, func() { - Expect(catalogID).ToNot(BeNil()) - - invalidCatalogID := "invalid-" + catalogID - getCatalogAuditOptions := &catalogmanagementv1.GetCatalogAuditOptions{ - CatalogIdentifier: &invalidCatalogID, - } - - _, response, err := catalogManagementServiceAuthorized.GetCatalogAudit(getCatalogAuditOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(404)) - }) - - It(`Returns 403 when user is not authorized`, func() { - Expect(catalogID).ToNot(BeNil()) - - getCatalogAuditOptions := &catalogmanagementv1.GetCatalogAuditOptions{ - CatalogIdentifier: &catalogID, - } - - _, response, err := catalogManagementServiceNotAuthorized.GetCatalogAudit(getCatalogAuditOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - It(`Returns the catalog audit logs`, func() { - Expect(catalogID).ToNot(BeNil()) - - getCatalogAuditOptions := &catalogmanagementv1.GetCatalogAuditOptions{ - CatalogIdentifier: &catalogID, - } - - catalogAuditLogs, response, err := catalogManagementServiceAuthorized.GetCatalogAudit(getCatalogAuditOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(catalogAuditLogs).NotTo(BeNil()) - }) - }) - - Describe(`Get Consumption Offerings`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`Returns 403 when user is not authorized`, func() { - Expect(catalogID).ToNot(BeNil()) - - getConsumptionOfferingsOptions := &catalogmanagementv1.GetConsumptionOfferingsOptions{ - Catalog: &catalogID, - Select: core.StringPtr("all"), - } - - _, response, err := catalogManagementServiceNotAuthorized.GetConsumptionOfferings(getConsumptionOfferingsOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - It(`Returns 404 when no such catalog`, func() { - Expect(catalogID).ToNot(BeNil()) - - invalidCatalogID := "invalid-" + catalogID - getConsumptionOfferingsOptions := &catalogmanagementv1.GetConsumptionOfferingsOptions{ - Catalog: &invalidCatalogID, - Select: core.StringPtr("all"), - } - - _, response, err := catalogManagementServiceNotAuthorized.GetConsumptionOfferings(getConsumptionOfferingsOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(404)) - }) - - It(`Returns the catalog consumption offerings`, func() { - Expect(catalogID).ToNot(BeNil()) - - getConsumptionOfferingsOptions := &catalogmanagementv1.GetConsumptionOfferingsOptions{ - Catalog: &catalogID, - Select: core.StringPtr("all"), - } - - _, response, err := catalogManagementServiceAuthorized.GetConsumptionOfferings(getConsumptionOfferingsOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(response.Result).ToNot(BeNil()) - }) - }) - - Describe(`Import Offering Version`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`Returns 400 when backend input validation fails`, func() { - Expect(catalogID).ToNot(BeNil()) - Expect(offeringID).ToNot(BeNil()) - - importOfferingVersionOptions := &catalogmanagementv1.ImportOfferingVersionOptions{ - CatalogIdentifier: &catalogID, - OfferingID: &offeringID, - TargetKinds: []string{"rocks"}, - Zipurl: &importOfferingZipUrl, - TargetVersion: core.StringPtr("0.0.3"), - RepoType: &repoTypeGitPublic, - } - - _, response, err := catalogManagementServiceAuthorized.ImportOfferingVersion(importOfferingVersionOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(400)) - }) - - It(`Returns 404 when no such offering`, func() { - Expect(catalogID).ToNot(BeNil()) - Expect(offeringID).ToNot(BeNil()) - - invalidOfferingID := "invalid-" + offeringID - importOfferingVersionOptions := &catalogmanagementv1.ImportOfferingVersionOptions{ - CatalogIdentifier: &catalogID, - OfferingID: &invalidOfferingID, - TargetKinds: []string{kindRoks}, - Zipurl: &importOfferingZipUrl, - TargetVersion: core.StringPtr("0.0.3"), - RepoType: &repoTypeGitPublic, - } - - _, response, err := catalogManagementServiceAuthorized.ImportOfferingVersion(importOfferingVersionOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(404)) - }) - - It(`Returns 403 when user is not authorized`, func() { - Expect(catalogID).ToNot(BeNil()) - Expect(offeringID).ToNot(BeNil()) - - importOfferingVersionOptions := &catalogmanagementv1.ImportOfferingVersionOptions{ - CatalogIdentifier: &catalogID, - OfferingID: &offeringID, - TargetKinds: []string{kindRoks}, - Zipurl: &importOfferingZipUrl, - TargetVersion: core.StringPtr("0.0.3"), - RepoType: &repoTypeGitPublic, - } - - _, response, err := catalogManagementServiceNotAuthorized.ImportOfferingVersion(importOfferingVersionOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - It(`Returns imported offering version`, func() { - Expect(catalogID).ToNot(BeNil()) - Expect(offeringID).ToNot(BeNil()) - - importOfferingVersionOptions := &catalogmanagementv1.ImportOfferingVersionOptions{ - CatalogIdentifier: &catalogID, - OfferingID: &offeringID, - TargetKinds: []string{kindRoks}, - Zipurl: &importOfferingZipUrl, - TargetVersion: core.StringPtr("0.0.3"), - RepoType: &repoTypeGitPublic, - } - - offeringResult, response, err := catalogManagementServiceAuthorized.ImportOfferingVersion(importOfferingVersionOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(201)) - Expect(offeringResult).NotTo(BeNil()) - }) - }) - - Describe(`Replace Offering Icon`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`Returns 404 when no such offerings`, func() { - Skip("This functionality is disabled.") - - Expect(catalogID).ToNot(BeNil()) - Expect(offeringID).ToNot(BeNil()) - - invalidOfferingID := "invalid-" + offeringID - replaceOfferingIconOptions := &catalogmanagementv1.ReplaceOfferingIconOptions{ - CatalogIdentifier: &catalogID, - OfferingID: &invalidOfferingID, - FileName: core.StringPtr("filename.jpg"), - } - - _, response, err := catalogManagementServiceAuthorized.ReplaceOfferingIcon(replaceOfferingIconOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(404)) - }) - - It(`Returns 403 when user is not authorized`, func() { - Skip("This functionality is disabled.") - - Expect(catalogID).ToNot(BeNil()) - Expect(offeringID).ToNot(BeNil()) - - replaceOfferingIconOptions := &catalogmanagementv1.ReplaceOfferingIconOptions{ - CatalogIdentifier: &catalogID, - OfferingID: &offeringID, - FileName: core.StringPtr("filename.jpg"), - } - - _, response, err := catalogManagementServiceNotAuthorized.ReplaceOfferingIcon(replaceOfferingIconOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - It(`Replaces the Offerings Icon`, func() { - Skip("This functionality is disabled.") - - Expect(catalogID).ToNot(BeNil()) - Expect(offeringID).ToNot(BeNil()) - - replaceOfferingIconOptions := &catalogmanagementv1.ReplaceOfferingIconOptions{ - CatalogIdentifier: &catalogID, - OfferingID: &offeringID, - FileName: core.StringPtr("filename.jpg"), - } - - offering, response, err := catalogManagementServiceAuthorized.ReplaceOfferingIcon(replaceOfferingIconOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(offering).NotTo(BeNil()) - }) - }) - - Describe(`Update Offering IBM`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`Returns 400 when backend input validation fails`, func() { - Skip("Once the user is granted for this operation this test can be executed.") - - Expect(catalogID).ToNot(BeNil()) - Expect(offeringID).ToNot(BeNil()) - - updateOfferingIBMOptions := &catalogmanagementv1.UpdateOfferingIBMOptions{ - CatalogIdentifier: &catalogID, - OfferingID: &offeringID, - ApprovalType: core.StringPtr("fake approval type"), - Approved: core.StringPtr("true"), - } - - _, response, err := catalogManagementServiceAuthorized.UpdateOfferingIBM(updateOfferingIBMOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(400)) - }) - - It(`Returns 404 when no such offering`, func() { - Skip("Once the user is granted for this operation this test can be executed.") - - Expect(catalogID).ToNot(BeNil()) - Expect(offeringID).ToNot(BeNil()) - - invalidOfferingID := "invalid-" + offeringID - updateOfferingIBMOptions := &catalogmanagementv1.UpdateOfferingIBMOptions{ - CatalogIdentifier: &catalogID, - OfferingID: &invalidOfferingID, - ApprovalType: core.StringPtr("allow_request"), - Approved: core.StringPtr("true"), - } - - _, response, err := catalogManagementServiceAuthorized.UpdateOfferingIBM(updateOfferingIBMOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(404)) - }) - - It(`Returns 403 when user is not authorized`, func() { - - Expect(catalogID).ToNot(BeNil()) - Expect(offeringID).ToNot(BeNil()) - - updateOfferingIBMOptions := &catalogmanagementv1.UpdateOfferingIBMOptions{ - CatalogIdentifier: &catalogID, - OfferingID: &offeringID, - ApprovalType: core.StringPtr("allow_request"), - Approved: core.StringPtr("true"), - } - - _, response, err := catalogManagementServiceNotAuthorized.UpdateOfferingIBM(updateOfferingIBMOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - It(`Updates offering IBM`, func() { - Skip("This user is not permitted to execute this operation.") - - Expect(catalogID).ToNot(BeNil()) - Expect(offeringID).ToNot(BeNil()) - - updateOfferingIBMOptions := &catalogmanagementv1.UpdateOfferingIBMOptions{ - CatalogIdentifier: &catalogID, - OfferingID: &offeringID, - ApprovalType: core.StringPtr("allow_request"), - Approved: core.StringPtr("true"), - } - - approvalResult, response, err := catalogManagementServiceAuthorized.UpdateOfferingIBM(updateOfferingIBMOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(approvalResult).NotTo(BeNil()) - }) - }) - - Describe(`Get Offering Updates`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`Returns 400 when backend input validation fails`, func() { - - Skip("It will not give 400 with required values set") - - Expect(catalogID).ToNot(BeNil()) - Expect(offeringID).ToNot(BeNil()) - - getOfferingUpdatesOptions := &catalogmanagementv1.GetOfferingUpdatesOptions{ - CatalogIdentifier: &catalogID, - OfferingID: &offeringID, - Kind: core.StringPtr("rocks"), - Version: core.StringPtr("0.0.2"), - ClusterID: &clusterID, - Region: ®ionUSSouth, - XAuthRefreshToken: &refreshTokenAuthorized, - } - - _, response, err := catalogManagementServiceAuthorized.GetOfferingUpdates(getOfferingUpdatesOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(400)) - }) - - It(`Returns 404 when no such offerings`, func() { - - Skip("It requires some special offering type.") - - Expect(catalogID).ToNot(BeNil()) - Expect(offeringID).ToNot(BeNil()) - - // it always complaining about offering types which is somehow related to create/import offerings - // once this is resolved there is a chance we can squeeze a 404 out from the service - - invalidOfferingID := "invalid-" + offeringID - getOfferingUpdatesOptions := &catalogmanagementv1.GetOfferingUpdatesOptions{ - CatalogIdentifier: &catalogID, - OfferingID: &invalidOfferingID, - Kind: core.StringPtr(kindVPE), - Version: core.StringPtr("0.0.2"), - ClusterID: &clusterID, - Region: ®ionUSSouth, - Namespace: &namespaceGoSDK, - } - - _, response, err := catalogManagementServiceAuthorized.GetOfferingUpdates(getOfferingUpdatesOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(404)) - }) - - It(`Returns 403 when user is not authorized`, func() { - - Expect(catalogID).ToNot(BeNil()) - Expect(offeringID).ToNot(BeNil()) - - getOfferingUpdatesOptions := &catalogmanagementv1.GetOfferingUpdatesOptions{ - CatalogIdentifier: &catalogID, - OfferingID: &offeringID, - Kind: core.StringPtr(kindRoks), - Version: core.StringPtr("0.0.2"), - ClusterID: &clusterID, - Region: ®ionUSSouth, - Namespace: &namespaceGoSDK, - XAuthRefreshToken: &refreshTokenNotAuthorized, - } - - _, response, err := catalogManagementServiceNotAuthorized.GetOfferingUpdates(getOfferingUpdatesOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - It(`Returns offering updates`, func() { - Skip("Requires an offering type different than helm, roks or vpe") - - Expect(catalogID).ToNot(BeNil()) - Expect(offeringID).ToNot(BeNil()) - - getOfferingUpdatesOptions := &catalogmanagementv1.GetOfferingUpdatesOptions{ - CatalogIdentifier: &catalogID, - OfferingID: &offeringID, - Kind: core.StringPtr(kindVPE), - Version: core.StringPtr("0.0.2"), - ClusterID: &clusterID, - Region: ®ionUSSouth, - Namespace: &namespaceGoSDK, - } - - versionUpdateDescriptor, response, err := catalogManagementServiceAuthorized.GetOfferingUpdates(getOfferingUpdatesOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(versionUpdateDescriptor).NotTo(BeNil()) - }) - }) - - Describe(`Get Offering About`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - - It(`Returns 400 when backend input validation fails`, func() { - - getOfferingAboutOptions := &catalogmanagementv1.GetOfferingAboutOptions{ - VersionLocID: &bogusVersionLocatorID, - } - - _, response, err := catalogManagementServiceAuthorized.GetOfferingAbout(getOfferingAboutOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(400)) - }) - - It(`Returns 404 when no such version`, func() { - Expect(versionLocatorID).ToNot(BeNil()) - - invalidVersionLocatorID := "invalid-" + versionLocatorID - getOfferingAboutOptions := &catalogmanagementv1.GetOfferingAboutOptions{ - VersionLocID: &invalidVersionLocatorID, - } - - _, response, err := catalogManagementServiceAuthorized.GetOfferingAbout(getOfferingAboutOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(404)) - }) - - It(`Returns 403 when user is not authorized`, func() { - Expect(versionLocatorID).ToNot(BeNil()) - - getOfferingAboutOptions := &catalogmanagementv1.GetOfferingAboutOptions{ - VersionLocID: &versionLocatorID, - } - - _, response, err := catalogManagementServiceNotAuthorized.GetOfferingAbout(getOfferingAboutOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - It(`Returns Offering About`, func() { - - Expect(versionLocatorID).ToNot(BeNil()) - - getOfferingAboutOptions := &catalogmanagementv1.GetOfferingAboutOptions{ - VersionLocID: &versionLocatorID, - } - - offeringAbout, response, err := catalogManagementServiceAuthorized.GetOfferingAbout(getOfferingAboutOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(offeringAbout).NotTo(BeNil()) - }) - }) - - Describe(`Get Offering License`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`Returns 400 when backend input validation fails`, func() { - - getOfferingLicenseOptions := &catalogmanagementv1.GetOfferingLicenseOptions{ - VersionLocID: &bogusVersionLocatorID, - LicenseID: core.StringPtr("license-id-is-needed"), - } - - _, response, err := catalogManagementServiceAuthorized.GetOfferingLicense(getOfferingLicenseOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(400)) - }) - - It(`Returns 404 when no such version`, func() { - - Expect(versionLocatorID).NotTo(BeNil()) - - invalidVersionLocatorID := "invalid-" + versionLocatorID - getOfferingLicenseOptions := &catalogmanagementv1.GetOfferingLicenseOptions{ - VersionLocID: &invalidVersionLocatorID, - LicenseID: core.StringPtr("license-id-is-needed"), - } - - _, response, err := catalogManagementServiceAuthorized.GetOfferingLicense(getOfferingLicenseOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(404)) - }) - - It(`Returns 403 when user is not authorized`, func() { - Skip("No license.") - - getOfferingLicenseOptions := &catalogmanagementv1.GetOfferingLicenseOptions{ - VersionLocID: &versionLocatorID, - LicenseID: core.StringPtr("license-id-is-needed"), - } - - _, response, err := catalogManagementServiceNotAuthorized.GetOfferingLicense(getOfferingLicenseOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - It(`Returns the offering license`, func() { - Skip("No license.") - - Expect(versionLocatorID).NotTo(BeNil()) - - getOfferingLicenseOptions := &catalogmanagementv1.GetOfferingLicenseOptions{ - VersionLocID: &versionLocatorID, - LicenseID: core.StringPtr("license-id-is-needed"), - } - - offeringLicense, response, err := catalogManagementServiceAuthorized.GetOfferingLicense(getOfferingLicenseOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(offeringLicense).NotTo(BeNil()) - }) - }) - - Describe(`Get Offering Container Images`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - - It(`Returns 400 when backend input validation fails`, func() { - - getOfferingContainerImagesOptions := &catalogmanagementv1.GetOfferingContainerImagesOptions{ - VersionLocID: &bogusVersionLocatorID, - } - - _, response, err := catalogManagementServiceAuthorized.GetOfferingContainerImages(getOfferingContainerImagesOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(400)) - }) - - It(`Returns 404 when no such version`, func() { - Expect(versionLocatorID).NotTo(BeNil()) - - invalidVersionLocatorID := "invalid-" + versionLocatorID - getOfferingContainerImagesOptions := &catalogmanagementv1.GetOfferingContainerImagesOptions{ - VersionLocID: &invalidVersionLocatorID, - } - - _, response, err := catalogManagementServiceAuthorized.GetOfferingContainerImages(getOfferingContainerImagesOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(404)) - }) - - It(`Returns 403 when user is not authorized`, func() { - Expect(versionLocatorID).NotTo(BeNil()) - - getOfferingContainerImagesOptions := &catalogmanagementv1.GetOfferingContainerImagesOptions{ - VersionLocID: &versionLocatorID, - } - - _, response, err := catalogManagementServiceNotAuthorized.GetOfferingContainerImages(getOfferingContainerImagesOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - It(`Returns offering container images`, func() { - Expect(versionLocatorID).NotTo(BeNil()) - - getOfferingContainerImagesOptions := &catalogmanagementv1.GetOfferingContainerImagesOptions{ - VersionLocID: &versionLocatorID, - } - - containerImageManifest, response, err := catalogManagementServiceAuthorized.GetOfferingContainerImages(getOfferingContainerImagesOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(containerImageManifest).NotTo(BeNil()) - }) - }) - - Describe(`Deprecate Version`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`Returns 404 when no such version`, func() { - Expect(versionLocatorID).NotTo(BeNil()) - - invalidVersionLocatorID := "invalid-" + versionLocatorID - deprecateVersionOptions := &catalogmanagementv1.DeprecateVersionOptions{ - VersionLocID: &invalidVersionLocatorID, - } - - response, err := catalogManagementServiceAuthorized.DeprecateVersion(deprecateVersionOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(404)) - }) - - It(`Returns 400 when backend input validation fails`, func() { - - deprecateVersionOptions := &catalogmanagementv1.DeprecateVersionOptions{ - VersionLocID: &bogusVersionLocatorID, - } - - response, err := catalogManagementServiceAuthorized.DeprecateVersion(deprecateVersionOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(400)) - }) - - It(`Returns 403 when user is not authorized`, func() { - Expect(versionLocatorID).NotTo(BeNil()) - - deprecateVersionOptions := &catalogmanagementv1.DeprecateVersionOptions{ - VersionLocID: &versionLocatorID, - } - - response, err := catalogManagementServiceNotAuthorized.DeprecateVersion(deprecateVersionOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - It(`Deprecates the version`, func() { - Skip("Order of states is needed") - - Expect(versionLocatorID).NotTo(BeNil()) - - deprecateVersionOptions := &catalogmanagementv1.DeprecateVersionOptions{ - VersionLocID: &versionLocatorID, - } - - response, err := catalogManagementServiceAuthorized.DeprecateVersion(deprecateVersionOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(202)) - }) - }) - - Describe(`Account Publish Version`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`Returns 400 when backend input validation fails`, func() { - - accountPublishVersionOptions := &catalogmanagementv1.AccountPublishVersionOptions{ - VersionLocID: &bogusVersionLocatorID, - } - - response, err := catalogManagementServiceAuthorized.AccountPublishVersion(accountPublishVersionOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(400)) - }) - - It(`Returns 404 when no such version`, func() { - Expect(versionLocatorID).NotTo(BeNil()) - - invalidVersionLocatorID := "invalid-" + versionLocatorID - accountPublishVersionOptions := &catalogmanagementv1.AccountPublishVersionOptions{ - VersionLocID: &invalidVersionLocatorID, - } - - response, err := catalogManagementServiceAuthorized.AccountPublishVersion(accountPublishVersionOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(404)) - }) - - It(`Returns 403 when user is not authorized`, func() { - Expect(versionLocatorID).NotTo(BeNil()) - - accountPublishVersionOptions := &catalogmanagementv1.AccountPublishVersionOptions{ - VersionLocID: &versionLocatorID, - } - - response, err := catalogManagementServiceNotAuthorized.AccountPublishVersion(accountPublishVersionOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - It(`Publishes version`, func() { - Skip("Order of states is needed") - Expect(versionLocatorID).NotTo(BeNil()) - - accountPublishVersionOptions := &catalogmanagementv1.AccountPublishVersionOptions{ - VersionLocID: &versionLocatorID, - } - - response, err := catalogManagementServiceAuthorized.AccountPublishVersion(accountPublishVersionOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(202)) - }) - }) - - Describe(`IBM Publish Version`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`Returns 400 when backend input validation fails`, func() { - - ibmPublishVersionOptions := &catalogmanagementv1.IBMPublishVersionOptions{ - VersionLocID: &bogusVersionLocatorID, - } - - response, err := catalogManagementServiceAuthorized.IBMPublishVersion(ibmPublishVersionOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(400)) - }) - - It(`Returns 404 when no such version`, func() { - Expect(versionLocatorID).NotTo(BeNil()) - - invalidVersionLocatorID := "invalid-" + versionLocatorID - ibmPublishVersionOptions := &catalogmanagementv1.IBMPublishVersionOptions{ - VersionLocID: &invalidVersionLocatorID, - } - - response, err := catalogManagementServiceAuthorized.IBMPublishVersion(ibmPublishVersionOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(404)) - }) - - It(`Returns 403 when user is not authorized`, func() { - Expect(versionLocatorID).NotTo(BeNil()) - - ibmPublishVersionOptions := &catalogmanagementv1.IBMPublishVersionOptions{ - VersionLocID: &versionLocatorID, - } - - response, err := catalogManagementServiceNotAuthorized.IBMPublishVersion(ibmPublishVersionOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - It(`Publishes the version`, func() { - Skip("User is not granted.") - Expect(versionLocatorID).NotTo(BeNil()) - - ibmPublishVersionOptions := &catalogmanagementv1.IBMPublishVersionOptions{ - VersionLocID: &versionLocatorID, - } - - response, err := catalogManagementServiceAuthorized.IBMPublishVersion(ibmPublishVersionOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(202)) - }) - }) - - Describe(`Public Publish Version`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`Returns 400 when backend input validation fails`, func() { - - publicPublishVersionOptions := &catalogmanagementv1.PublicPublishVersionOptions{ - VersionLocID: &bogusVersionLocatorID, - } - - response, err := catalogManagementServiceAuthorized.PublicPublishVersion(publicPublishVersionOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(400)) - }) - - It(`Returns 404 when no such version`, func() { - Expect(versionLocatorID).NotTo(BeNil()) - - invalidVersionLocatorID := "invalid-" + versionLocatorID - publicPublishVersionOptions := &catalogmanagementv1.PublicPublishVersionOptions{ - VersionLocID: &invalidVersionLocatorID, - } - - response, err := catalogManagementServiceAuthorized.PublicPublishVersion(publicPublishVersionOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(404)) - }) - - It(`Returns 403 when user is not authorized`, func() { - Expect(versionLocatorID).NotTo(BeNil()) - - publicPublishVersionOptions := &catalogmanagementv1.PublicPublishVersionOptions{ - VersionLocID: &versionLocatorID, - } - - response, err := catalogManagementServiceNotAuthorized.PublicPublishVersion(publicPublishVersionOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - It(`Publishes the version`, func() { - Skip("User is not granted.") - Expect(versionLocatorID).NotTo(BeNil()) - - publicPublishVersionOptions := &catalogmanagementv1.PublicPublishVersionOptions{ - VersionLocID: &versionLocatorID, - } - - response, err := catalogManagementServiceAuthorized.PublicPublishVersion(publicPublishVersionOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(202)) - }) - }) - - Describe(`Commit Version`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`Returns 400 when backend input validation fails`, func() { - - commitVersionOptions := &catalogmanagementv1.CommitVersionOptions{ - VersionLocID: &bogusVersionLocatorID, - } - - response, err := catalogManagementServiceAuthorized.CommitVersion(commitVersionOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(400)) - }) - - It(`Returns 404 when no such version`, func() { - Expect(versionLocatorID).NotTo(BeNil()) - - invalidVersionLocatorID := "invalid-" + versionLocatorID - commitVersionOptions := &catalogmanagementv1.CommitVersionOptions{ - VersionLocID: &invalidVersionLocatorID, - } - - response, err := catalogManagementServiceAuthorized.CommitVersion(commitVersionOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(404)) - }) - - It(`Returns 403 when user is not authorized`, func() { - Expect(versionLocatorID).NotTo(BeNil()) - - commitVersionOptions := &catalogmanagementv1.CommitVersionOptions{ - VersionLocID: &versionLocatorID, - } - - response, err := catalogManagementServiceNotAuthorized.CommitVersion(commitVersionOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - It(`Commits version`, func() { - Skip("Workflow of versions") - - Expect(versionLocatorID).NotTo(BeNil()) - - commitVersionOptions := &catalogmanagementv1.CommitVersionOptions{ - VersionLocID: &versionLocatorID, - } - - response, err := catalogManagementServiceAuthorized.CommitVersion(commitVersionOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - }) - }) - - Describe(`Copy Version`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`Returns 403 when user is not authorized`, func() { - Expect(versionLocatorID).NotTo(BeNil()) - - copyVersionOptions := &catalogmanagementv1.CopyVersionOptions{ - VersionLocID: &versionLocatorID, - TargetKinds: []string{kindRoks}, - } - - response, err := catalogManagementServiceNotAuthorized.CopyVersion(copyVersionOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - It(`Returns 404 when no such version`, func() { - Expect(versionLocatorID).NotTo(BeNil()) - - invalidVersionLocatorId := "invalid-" + versionLocatorID - copyVersionOptions := &catalogmanagementv1.CopyVersionOptions{ - VersionLocID: &invalidVersionLocatorId, - TargetKinds: []string{kindRoks}, - } - - response, err := catalogManagementServiceAuthorized.CopyVersion(copyVersionOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(404)) - }) - - It(`Returns 400 when backend validation fails`, func() { - - copyVersionOptions := &catalogmanagementv1.CopyVersionOptions{ - VersionLocID: &bogusVersionLocatorID, - TargetKinds: []string{kindRoks}, - } - - response, err := catalogManagementServiceAuthorized.CopyVersion(copyVersionOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(400)) - }) - - It(`Copies a version`, func() { - Skip("Only for helm, but helm is not supported.") - Expect(versionLocatorID).NotTo(BeNil()) - - copyVersionOptions := &catalogmanagementv1.CopyVersionOptions{ - VersionLocID: &versionLocatorID, - TargetKinds: []string{kindRoks}, - } - - response, err := catalogManagementServiceAuthorized.CopyVersion(copyVersionOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - }) - }) - - Describe(`Get Offering Working Copy`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`Returns 400 when backend input validation fails`, func() { - - getOfferingWorkingCopyOptions := &catalogmanagementv1.GetOfferingWorkingCopyOptions{ - VersionLocID: &bogusVersionLocatorID, - } - - _, response, err := catalogManagementServiceAuthorized.GetOfferingWorkingCopy(getOfferingWorkingCopyOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(400)) - }) - - It(`Returns 403 when user is not authorized`, func() { - Expect(versionLocatorID).NotTo(BeNil()) - - getOfferingWorkingCopyOptions := &catalogmanagementv1.GetOfferingWorkingCopyOptions{ - VersionLocID: &versionLocatorID, - } - - _, response, err := catalogManagementServiceNotAuthorized.GetOfferingWorkingCopy(getOfferingWorkingCopyOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - It(`Returns 404 when no such version`, func() { - Expect(versionLocatorID).NotTo(BeNil()) - - invalidVersionLocatorID := "invalid-" + versionLocatorID - getOfferingWorkingCopyOptions := &catalogmanagementv1.GetOfferingWorkingCopyOptions{ - VersionLocID: &invalidVersionLocatorID, - } - - _, response, err := catalogManagementServiceAuthorized.GetOfferingWorkingCopy(getOfferingWorkingCopyOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(404)) - }) - - It(`Returns the offering working copy`, func() { - Skip("requires published state which this user cannot create") - Expect(versionLocatorID).ToNot(BeNil()) - - getOfferingWorkingCopyOptions := &catalogmanagementv1.GetOfferingWorkingCopyOptions{ - VersionLocID: &versionLocatorID, - } - - version, response, err := catalogManagementServiceAuthorized.GetOfferingWorkingCopy(getOfferingWorkingCopyOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(version).ToNot(BeNil()) - }) - }) - - Describe(`Get Version`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`Returns 400 when backend input validation fails`, func() { - - getVersionOptions := &catalogmanagementv1.GetVersionOptions{ - VersionLocID: &bogusVersionLocatorID, - } - - _, response, err := catalogManagementServiceAuthorized.GetVersion(getVersionOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(400)) - }) - - It(`Returns 404 when no such version`, func() { - Expect(versionLocatorID).NotTo(BeNil()) - - invalidVersionLocatorID := "invalid-" + versionLocatorID - getVersionOptions := &catalogmanagementv1.GetVersionOptions{ - VersionLocID: &invalidVersionLocatorID, - } - - _, response, err := catalogManagementServiceAuthorized.GetVersion(getVersionOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(404)) - }) - - It(`Returns 403 when user is not authorized`, func() { - Expect(versionLocatorID).NotTo(BeNil()) - - getVersionOptions := &catalogmanagementv1.GetVersionOptions{ - VersionLocID: &versionLocatorID, - } - - _, response, err := catalogManagementServiceNotAuthorized.GetVersion(getVersionOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - It(`Returns the offering version`, func() { - Expect(versionLocatorID).NotTo(BeNil()) - - getVersionOptions := &catalogmanagementv1.GetVersionOptions{ - VersionLocID: &versionLocatorID, - } - - offeringVersion, response, err := catalogManagementServiceAuthorized.GetVersion(getVersionOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(offeringVersion).NotTo(BeNil()) - }) - }) - - Describe(`Get Cluster`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`Returns 403 when user is not authorized`, func() { - - Skip("possibly this user doesn't have right to execute this operation") - - getClusterOptions := &catalogmanagementv1.GetClusterOptions{ - ClusterID: &clusterID, - Region: ®ionUSSouth, - XAuthRefreshToken: &refreshTokenNotAuthorized, - } - - _, response, err := catalogManagementServiceNotAuthorized.GetCluster(getClusterOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - It(`Returns 404 when no such cluster`, func() { - - invalidClusterID := "invalid-" + clusterID - getClusterOptions := &catalogmanagementv1.GetClusterOptions{ - ClusterID: &invalidClusterID, - Region: ®ionUSSouth, - XAuthRefreshToken: &refreshTokenAuthorized, - } - - _, response, err := catalogManagementServiceAuthorized.GetCluster(getClusterOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(404)) - }) - - It(`Returns the cluster details`, func() { - - Skip("possibly this user doesn't have right to execute this operation") - - getClusterOptions := &catalogmanagementv1.GetClusterOptions{ - ClusterID: &clusterID, - Region: ®ionUSSouth, - XAuthRefreshToken: &refreshTokenAuthorized, - } - - clusterInfo, response, err := catalogManagementServiceAuthorized.GetCluster(getClusterOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(clusterInfo).NotTo(BeNil()) - }) - }) - - Describe(`Get Namespaces`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`Returns 404 when no such cluster`, func() { - - invalidClusterID := "invalid-" + clusterID - getNamespacesOptions := &catalogmanagementv1.GetNamespacesOptions{ - ClusterID: &invalidClusterID, - Region: ®ionUSSouth, - XAuthRefreshToken: &refreshTokenAuthorized, - } - - _, response, err := catalogManagementServiceAuthorized.GetNamespaces(getNamespacesOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(404)) - }) - - It(`Returns 401 when user is not authorized`, func() { - - Skip("It returns randomly either 401 and 404, so it is skipped.") - - getNamespacesOptions := &catalogmanagementv1.GetNamespacesOptions{ - ClusterID: &clusterID, - Region: ®ionUSSouth, - XAuthRefreshToken: &refreshTokenNotAuthorized, - } - - _, response, err := catalogManagementServiceNotAuthorized.GetNamespaces(getNamespacesOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(404)) - }) - - It(`Returns namespaces`, func() { - Skip("Possibly the user is not granted.") - - getNamespacesOptions := &catalogmanagementv1.GetNamespacesOptions{ - ClusterID: &clusterID, - Region: ®ionUSSouth, - XAuthRefreshToken: &refreshTokenAuthorized, - } - - namespacesResult, response, err := catalogManagementServiceAuthorized.GetNamespaces(getNamespacesOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(namespacesResult).NotTo(BeNil()) - }) - }) - - Describe(`Deploy Operators`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`Returns 403 when user is not authorized`, func() { - Expect(versionLocatorID).NotTo(BeNil()) - - deployOperatorsOptions := &catalogmanagementv1.DeployOperatorsOptions{ - XAuthRefreshToken: &refreshTokenNotAuthorized, - ClusterID: &clusterID, - Region: ®ionUSSouth, - AllNamespaces: core.BoolPtr(true), - VersionLocatorID: &versionLocatorID, - } - - _, response, err := catalogManagementServiceNotAuthorized.DeployOperators(deployOperatorsOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - It(`Returns 404 when no such cluster`, func() { - - invalidClusterID := "invalid-" + clusterID - deployOperatorsOptions := &catalogmanagementv1.DeployOperatorsOptions{ - XAuthRefreshToken: &refreshTokenAuthorized, - ClusterID: &invalidClusterID, - Region: ®ionUSSouth, - AllNamespaces: core.BoolPtr(true), - VersionLocatorID: &versionLocatorID, - } - - _, response, err := catalogManagementServiceAuthorized.DeployOperators(deployOperatorsOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(404)) - }) - - It(`Returns 400 when backend input validation fails`, func() { - - deployOperatorsOptions := &catalogmanagementv1.DeployOperatorsOptions{ - XAuthRefreshToken: &refreshTokenAuthorized, - ClusterID: &clusterID, - Region: ®ionUSSouth, - AllNamespaces: core.BoolPtr(true), - VersionLocatorID: &bogusVersionLocatorID, - } - - _, response, err := catalogManagementServiceAuthorized.DeployOperators(deployOperatorsOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(400)) - }) - - It(`Deploys operator`, func() { - Skip("Possibly the user is not granted.") - Expect(versionLocatorID).NotTo(BeNil()) - - deployOperatorsOptions := &catalogmanagementv1.DeployOperatorsOptions{ - XAuthRefreshToken: &refreshTokenAuthorized, - ClusterID: &clusterID, - Region: ®ionUSSouth, - AllNamespaces: core.BoolPtr(true), - VersionLocatorID: &versionLocatorID, - } - - operatorDeployResult, response, err := catalogManagementServiceAuthorized.DeployOperators(deployOperatorsOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(operatorDeployResult).NotTo(BeNil()) - }) - }) - - Describe(`List Operators`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`Returns 403 when user is not authorized`, func() { - Expect(versionLocatorID).NotTo(BeNil()) - - listOperatorsOptions := &catalogmanagementv1.ListOperatorsOptions{ - XAuthRefreshToken: &refreshTokenNotAuthorized, - ClusterID: &clusterID, - Region: ®ionUSSouth, - VersionLocatorID: &versionLocatorID, - } - - _, response, err := catalogManagementServiceNotAuthorized.ListOperators(listOperatorsOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - It(`Returns 400 when backend input validation fails`, func() { - - listOperatorsOptions := &catalogmanagementv1.ListOperatorsOptions{ - XAuthRefreshToken: &refreshTokenAuthorized, - ClusterID: &clusterID, - Region: ®ionUSSouth, - VersionLocatorID: &bogusVersionLocatorID, - } - - _, response, err := catalogManagementServiceAuthorized.ListOperators(listOperatorsOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(400)) - }) - - It(`Returns 404 when no such cluster`, func() { - - Expect(versionLocatorID).NotTo(BeNil()) - - invalidClusterID := "invalid-" + clusterID - listOperatorsOptions := &catalogmanagementv1.ListOperatorsOptions{ - XAuthRefreshToken: &refreshTokenAuthorized, - ClusterID: &invalidClusterID, - Region: ®ionUSSouth, - VersionLocatorID: &versionLocatorID, - } - - _, response, err := catalogManagementServiceAuthorized.ListOperators(listOperatorsOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(404)) - }) - - It(`Returns list of operators`, func() { - Skip("Possibly this user is not granted.") - - Expect(versionLocatorID).NotTo(BeNil()) - - listOperatorsOptions := &catalogmanagementv1.ListOperatorsOptions{ - XAuthRefreshToken: &refreshTokenAuthorized, - ClusterID: &clusterID, - Region: ®ionUSSouth, - VersionLocatorID: &versionLocatorID, - } - - listOperatorsResult, response, err := catalogManagementServiceAuthorized.ListOperators(listOperatorsOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(listOperatorsResult).NotTo(BeNil()) - }) - }) - - Describe(`Replace Operators`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`Returns 403 when user is not authorized`, func() { - - Expect(versionLocatorID).NotTo(BeNil()) - - replaceOperatorsOptions := &catalogmanagementv1.ReplaceOperatorsOptions{ - XAuthRefreshToken: &refreshTokenNotAuthorized, - ClusterID: &clusterID, - Region: ®ionUSSouth, - AllNamespaces: core.BoolPtr(true), - VersionLocatorID: &versionLocatorID, - } - - _, response, err := catalogManagementServiceNotAuthorized.ReplaceOperators(replaceOperatorsOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - It(`Returns 404 when no such cluster`, func() { - Expect(versionLocatorID).NotTo(BeNil()) - - invalidClusterID := "invalid-" + clusterID - replaceOperatorsOptions := &catalogmanagementv1.ReplaceOperatorsOptions{ - XAuthRefreshToken: &refreshTokenAuthorized, - ClusterID: &invalidClusterID, - Region: ®ionUSSouth, - AllNamespaces: core.BoolPtr(true), - VersionLocatorID: &versionLocatorID, - } - - _, response, err := catalogManagementServiceAuthorized.ReplaceOperators(replaceOperatorsOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(404)) - }) - - It(`Returns 400 when backend input validation fails`, func() { - - replaceOperatorsOptions := &catalogmanagementv1.ReplaceOperatorsOptions{ - XAuthRefreshToken: &refreshTokenAuthorized, - ClusterID: &clusterID, - Region: ®ionUSSouth, - AllNamespaces: core.BoolPtr(true), - VersionLocatorID: &bogusVersionLocatorID, - } - - _, response, err := catalogManagementServiceAuthorized.ReplaceOperators(replaceOperatorsOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(400)) - }) - - It(`Replaces operator`, func() { - Skip("Possibly this user is not granted.") - - Expect(versionLocatorID).NotTo(BeNil()) - - replaceOperatorsOptions := &catalogmanagementv1.ReplaceOperatorsOptions{ - XAuthRefreshToken: &refreshTokenAuthorized, - ClusterID: &clusterID, - Region: ®ionUSSouth, - AllNamespaces: core.BoolPtr(true), - VersionLocatorID: &versionLocatorID, - } - - operatorDeployResult, response, err := catalogManagementServiceAuthorized.ReplaceOperators(replaceOperatorsOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(operatorDeployResult).NotTo(BeNil()) - }) - }) - - Describe(`Install Version`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`Returns 403 when user is not authorized`, func() { - - Expect(versionLocatorID).NotTo(BeNil()) - - installVersionOptions := &catalogmanagementv1.InstallVersionOptions{ - VersionLocID: &versionLocatorID, - XAuthRefreshToken: &refreshTokenNotAuthorized, - ClusterID: &clusterID, - Region: ®ionUSSouth, - VersionLocatorID: &versionLocatorID, - } - - response, err := catalogManagementServiceNotAuthorized.InstallVersion(installVersionOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - It(`Returns 404 when no such cluster`, func() { - Expect(versionLocatorID).NotTo(BeNil()) - - invalidClusterId := "invalid-" + clusterID - installVersionOptions := &catalogmanagementv1.InstallVersionOptions{ - VersionLocID: &versionLocatorID, - XAuthRefreshToken: &refreshTokenAuthorized, - ClusterID: &invalidClusterId, - Region: ®ionUSSouth, - VersionLocatorID: &versionLocatorID, - } - - response, err := catalogManagementServiceAuthorized.InstallVersion(installVersionOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(404)) - }) - - It(`Returns 400 when backend input validation fails`, func() { - - installVersionOptions := &catalogmanagementv1.InstallVersionOptions{ - VersionLocID: &bogusVersionLocatorID, - XAuthRefreshToken: &refreshTokenAuthorized, - ClusterID: &clusterID, - Region: ®ionUSSouth, - VersionLocatorID: &bogusVersionLocatorID, - } - - response, err := catalogManagementServiceAuthorized.InstallVersion(installVersionOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(400)) - }) - - It(`Installs the version`, func() { - Skip("Possibly this user is not granted.") - - Expect(versionLocatorID).NotTo(BeNil()) - - installVersionOptions := &catalogmanagementv1.InstallVersionOptions{ - VersionLocID: &versionLocatorID, - XAuthRefreshToken: &refreshTokenAuthorized, - ClusterID: &clusterID, - Region: ®ionUSSouth, - VersionLocatorID: &versionLocatorID, - } - - response, err := catalogManagementServiceAuthorized.InstallVersion(installVersionOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(202)) - }) - }) - - Describe(`Preinstall Version`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`Returns 403 when user is not authorized`, func() { - - Expect(versionLocatorID).NotTo(BeNil()) - - preinstallVersionOptions := &catalogmanagementv1.PreinstallVersionOptions{ - VersionLocID: &versionLocatorID, - XAuthRefreshToken: &refreshTokenNotAuthorized, - ClusterID: &clusterID, - Region: ®ionUSSouth, - VersionLocatorID: &versionLocatorID, - } - - response, err := catalogManagementServiceNotAuthorized.PreinstallVersion(preinstallVersionOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - It(`Returns 404 when no such cluster`, func() { - Skip("Requires preinstall script.") - - Expect(versionLocatorID).NotTo(BeNil()) - - // it requires a version where preinstall script is installed - // but I don't know how to do it - // one it is done possible to squeeze a 404 from the cluster - // until then it checks 400 - - invalidClusterID := "invalid-" + clusterID - preinstallVersionOptions := &catalogmanagementv1.PreinstallVersionOptions{ - VersionLocID: &versionLocatorID, - XAuthRefreshToken: &refreshTokenAuthorized, - ClusterID: &invalidClusterID, - Region: ®ionUSSouth, - VersionLocatorID: &versionLocatorID, - } - - response, err := catalogManagementServiceAuthorized.PreinstallVersion(preinstallVersionOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(404)) - }) - - It(`Returns 400 when backend input validation fails`, func() { - - preinstallVersionOptions := &catalogmanagementv1.PreinstallVersionOptions{ - VersionLocID: &bogusVersionLocatorID, - XAuthRefreshToken: &refreshTokenAuthorized, - ClusterID: &clusterID, - Region: ®ionUSSouth, - VersionLocatorID: &bogusVersionLocatorID, - } - - response, err := catalogManagementServiceAuthorized.PreinstallVersion(preinstallVersionOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(400)) - }) - - It(`Preinstalls the version`, func() { - - Skip("Requires pre-install script.") - - Expect(versionLocatorID).NotTo(BeNil()) - - preinstallVersionOptions := &catalogmanagementv1.PreinstallVersionOptions{ - VersionLocID: &versionLocatorID, - XAuthRefreshToken: &refreshTokenAuthorized, - ClusterID: &clusterID, - Region: ®ionUSSouth, - VersionLocatorID: &versionLocatorID, - } - - response, err := catalogManagementServiceAuthorized.PreinstallVersion(preinstallVersionOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(202)) - }) - }) - - Describe(`Get Preinstall`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`Returns 403 when user is not authorized`, func() { - - Expect(versionLocatorID).NotTo(BeNil()) - - getPreinstallOptions := &catalogmanagementv1.GetPreinstallOptions{ - VersionLocID: &versionLocatorID, - XAuthRefreshToken: &refreshTokenNotAuthorized, - ClusterID: &clusterID, - Region: ®ionUSSouth, - } - - _, response, err := catalogManagementServiceNotAuthorized.GetPreinstall(getPreinstallOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - It(`Returns 404 when no such version`, func() { - - Expect(versionLocatorID).NotTo(BeNil()) - - invalidVersionLocatorID := "invalid-" + versionLocatorID - getPreinstallOptions := &catalogmanagementv1.GetPreinstallOptions{ - VersionLocID: &invalidVersionLocatorID, - XAuthRefreshToken: &refreshTokenAuthorized, - ClusterID: &clusterID, - Region: ®ionUSSouth, - } - - _, response, err := catalogManagementServiceAuthorized.GetPreinstall(getPreinstallOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(404)) - }) - - It(`Returns 400 when backend input validation fails`, func() { - - getPreinstallOptions := &catalogmanagementv1.GetPreinstallOptions{ - VersionLocID: &bogusVersionLocatorID, - XAuthRefreshToken: &refreshTokenAuthorized, - ClusterID: &clusterID, - Region: ®ionUSSouth, - } - - _, response, err := catalogManagementServiceAuthorized.GetPreinstall(getPreinstallOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(400)) - }) - - It(`Returns preinstall`, func() { - Skip("Pre-install script is required.") - - Expect(versionLocatorID).NotTo(BeNil()) - - getPreinstallOptions := &catalogmanagementv1.GetPreinstallOptions{ - VersionLocID: &versionLocatorID, - XAuthRefreshToken: &refreshTokenAuthorized, - ClusterID: &clusterID, - Region: ®ionUSSouth, - } - - installStatusResult, response, err := catalogManagementServiceAuthorized.GetPreinstall(getPreinstallOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(installStatusResult).NotTo(BeNil()) - }) - }) - - Describe(`Validate Install`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`Returns 403 when user is not authorized`, func() { - - Expect(versionLocatorID).NotTo(BeNil()) - - validateInstallOptions := &catalogmanagementv1.ValidateInstallOptions{ - VersionLocID: &versionLocatorID, - XAuthRefreshToken: &refreshTokenNotAuthorized, - ClusterID: &clusterID, - Region: ®ionUSSouth, - VersionLocatorID: &versionLocatorID, - } - - response, err := catalogManagementServiceNotAuthorized.ValidateInstall(validateInstallOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - It(`Returns 404 when no such version`, func() { - - Expect(versionLocatorID).NotTo(BeNil()) - - invalidVersionLocatorID := "invalid-" + versionLocatorID - validateInstallOptions := &catalogmanagementv1.ValidateInstallOptions{ - VersionLocID: &invalidVersionLocatorID, - XAuthRefreshToken: &refreshTokenAuthorized, - ClusterID: &clusterID, - Region: ®ionUSSouth, - VersionLocatorID: &invalidVersionLocatorID, - } - - response, err := catalogManagementServiceAuthorized.ValidateInstall(validateInstallOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(404)) - }) - - It(`Returns 400 when backend input validation fails`, func() { - - validateInstallOptions := &catalogmanagementv1.ValidateInstallOptions{ - VersionLocID: &bogusVersionLocatorID, - XAuthRefreshToken: &refreshTokenAuthorized, - ClusterID: &clusterID, - Region: ®ionUSSouth, - VersionLocatorID: &bogusVersionLocatorID, - } - - response, err := catalogManagementServiceAuthorized.ValidateInstall(validateInstallOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(400)) - }) - - It(`Validates install`, func() { - Skip("Possibly this user is not granted.") - - Expect(versionLocatorID).NotTo(BeNil()) - - validateInstallOptions := &catalogmanagementv1.ValidateInstallOptions{ - VersionLocID: &versionLocatorID, - XAuthRefreshToken: &refreshTokenAuthorized, - ClusterID: &clusterID, - Region: ®ionUSSouth, - VersionLocatorID: &versionLocatorID, - } - - response, err := catalogManagementServiceAuthorized.ValidateInstall(validateInstallOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(202)) - }) - }) - - Describe(`Get Validation Status`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`Returns 403 when user is not authorized`, func() { - - Expect(versionLocatorID).NotTo(BeNil()) - - getValidationStatusOptions := &catalogmanagementv1.GetValidationStatusOptions{ - VersionLocID: &versionLocatorID, - XAuthRefreshToken: &refreshTokenNotAuthorized, - } - - _, response, err := catalogManagementServiceNotAuthorized.GetValidationStatus(getValidationStatusOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - It(`Returns 404 when no such version`, func() { - - Expect(versionLocatorID).NotTo(BeNil()) - - invalidVersionLocatorID := "invalid-" + versionLocatorID - getValidationStatusOptions := &catalogmanagementv1.GetValidationStatusOptions{ - VersionLocID: &invalidVersionLocatorID, - XAuthRefreshToken: &refreshTokenAuthorized, - } - - _, response, err := catalogManagementServiceAuthorized.GetValidationStatus(getValidationStatusOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(404)) - }) - - It(`Returns 400 when backend input validation fails`, func() { - - getValidationStatusOptions := &catalogmanagementv1.GetValidationStatusOptions{ - VersionLocID: &bogusVersionLocatorID, - XAuthRefreshToken: &refreshTokenAuthorized, - } - - _, response, err := catalogManagementServiceAuthorized.GetValidationStatus(getValidationStatusOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(400)) - }) - - It(`Returns validation status`, func() { - - Expect(versionLocatorID).NotTo(BeNil()) - - getValidationStatusOptions := &catalogmanagementv1.GetValidationStatusOptions{ - VersionLocID: &versionLocatorID, - XAuthRefreshToken: &refreshTokenAuthorized, - } - - validationStatus, response, err := catalogManagementServiceAuthorized.GetValidationStatus(getValidationStatusOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(validationStatus).NotTo(BeNil()) - }) - }) - - Describe(`Get Override Values`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`Returns 403 when user is not authorized`, func() { - - Expect(versionLocatorID).NotTo(BeNil()) - - getOverrideValuesOptions := &catalogmanagementv1.GetOverrideValuesOptions{ - VersionLocID: &versionLocatorID, - } - - _, response, err := catalogManagementServiceNotAuthorized.GetOverrideValues(getOverrideValuesOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - It(`Returns 404 when no such version`, func() { - - Expect(versionLocatorID).NotTo(BeNil()) - - invalidVersionLocatorID := "invalid-" + versionLocatorID - getOverrideValuesOptions := &catalogmanagementv1.GetOverrideValuesOptions{ - VersionLocID: &invalidVersionLocatorID, - } - - _, response, err := catalogManagementServiceAuthorized.GetOverrideValues(getOverrideValuesOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(404)) - }) - - It(`Returns 400 when backend input validation fails`, func() { - - getOverrideValuesOptions := &catalogmanagementv1.GetOverrideValuesOptions{ - VersionLocID: &bogusVersionLocatorID, - } - - _, response, err := catalogManagementServiceAuthorized.GetOverrideValues(getOverrideValuesOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(400)) - }) - - It(`Returns override values`, func() { - Skip("requires validation run before this operation") - - Expect(versionLocatorID).NotTo(BeNil()) - - getOverrideValuesOptions := &catalogmanagementv1.GetOverrideValuesOptions{ - VersionLocID: &versionLocatorID, - } - - result, response, err := catalogManagementServiceAuthorized.GetOverrideValues(getOverrideValuesOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(result).NotTo(BeNil()) - }) - }) - - Describe(`Search Objects`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`Returns 400 when backend input validation fails`, func() { - - searchObjectsOptions := &catalogmanagementv1.SearchObjectsOptions{ - Query: core.StringPtr(""), - Collapse: core.BoolPtr(true), - Digest: core.BoolPtr(true), - } - - _, response, err := catalogManagementServiceAuthorized.SearchObjects(searchObjectsOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(400)) - }) - - It(`Returns 200 when user is not authorized`, func() { - - searchObjectsOptions := &catalogmanagementv1.SearchObjectsOptions{ - Query: core.StringPtr("name: " + objectName), - Collapse: core.BoolPtr(true), - Digest: core.BoolPtr(true), - } - - searchResult, response, err := catalogManagementServiceNotAuthorized.SearchObjects(searchObjectsOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(searchResult).NotTo(BeNil()) - }) - - It(`Returns objects`, func() { - - var offset int64 = 0 - var limit int64 = 0 - fetch := true - amountOfObjects := 0 - - for fetch { - searchObjectsOptions := &catalogmanagementv1.SearchObjectsOptions{ - Query: core.StringPtr("name: object*"), - Collapse: core.BoolPtr(true), - Digest: core.BoolPtr(true), - Limit: &limit, - Offset: &offset, - } - - searchResult, response, err := catalogManagementServiceAuthorized.SearchObjects(searchObjectsOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(searchResult).NotTo(BeNil()) - - if searchResult.Next != nil { - offsetValue, err := core.GetQueryParam(searchResult.Next, "offset") - Expect(err).To(BeNil()) - - if *offsetValue != "" { - offsetVal, errOffsetVal := strconv.ParseInt(*offsetValue, 10, 64) - Expect(errOffsetVal).To(BeNil()) - offset = offsetVal - } - } else { - fetch = false - } - - if *searchResult.ResourceCount > 0 { - amountOfObjects += int(*searchResult.ResourceCount) - } - - } - - fmt.Printf("Amount of objects: %d", amountOfObjects) - }) - }) - - Describe(`List Objects`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`Returns 400 when backend input validation fails`, func() { - - Expect(catalogID).NotTo(BeNil()) - - listObjectsOptions := &catalogmanagementv1.ListObjectsOptions{ - CatalogIdentifier: &catalogID, - Name: core.StringPtr(""), - Sort: core.StringPtr(""), - } - - _, response, err := catalogManagementServiceAuthorized.ListObjects(listObjectsOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(400)) - }) - - It(`Returns 403 when user is not authorized`, func() { - - Skip("It returns the result for some reason, however python doesn't. Skipped.") - Expect(catalogID).NotTo(BeNil()) - - listObjectsOptions := &catalogmanagementv1.ListObjectsOptions{ - CatalogIdentifier: &catalogID, - } - - _, response, err := catalogManagementServiceAuthorized.ListObjects(listObjectsOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - It(`Returns list of objects`, func() { - - Expect(catalogID).NotTo(BeNil()) - - var limit int64 = 1 - var offset int64 = 0 - amountOfObjects := 0 - fetch := true - - for fetch { - - listObjectsOptions := &catalogmanagementv1.ListObjectsOptions{ - CatalogIdentifier: &catalogID, - Offset: &offset, - Limit: &limit, - } - - searchResult, response, err := catalogManagementServiceAuthorized.ListObjects(listObjectsOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(searchResult).NotTo(BeNil()) - - if searchResult.Next != nil { - offsetValue, errOffset := core.GetQueryParam(searchResult.Next, "offset") - Expect(errOffset).To(BeNil()) - - if *offsetValue != "" { - offsetVal, errOffsetVal := strconv.ParseInt(*offsetValue, 10, 64) - Expect(errOffsetVal).To(BeNil()) - offset = offsetVal - } - } else { - fetch = false - } - - if *searchResult.ResourceCount > 0 { - amountOfObjects += int(*searchResult.ResourceCount) - } - } - fmt.Printf("Amount of objects: %d", amountOfObjects) - }) - }) - - Describe(`Replace Object`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`Returns 403 when user is not authorized`, func() { - - Expect(objectID).ToNot(BeNil()) - Expect(catalogID).ToNot(BeNil()) - - replaceObjectOptions := &catalogmanagementv1.ReplaceObjectOptions{ - CatalogIdentifier: &catalogID, - ObjectIdentifier: &objectID, - ID: &objectID, - Name: core.StringPtr("updated-object-name-by-go-sdk"), - ParentID: ®ionUSSouth, - Kind: core.StringPtr(kindVPE), - CatalogID: &catalogID, - Data: make(map[string]interface{}), - } - - _, response, err := catalogManagementServiceNotAuthorized.ReplaceObject(replaceObjectOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - It(`Returns 404 when no such object`, func() { - - Expect(objectID).ToNot(BeNil()) - Expect(catalogID).ToNot(BeNil()) - - invalidObjectID := "invalid-" + objectID - replaceObjectOptions := &catalogmanagementv1.ReplaceObjectOptions{ - CatalogIdentifier: &catalogID, - ObjectIdentifier: &invalidObjectID, - ID: &invalidObjectID, - Name: core.StringPtr("updated-object-name-by-go-sdk"), - ParentID: ®ionUSSouth, - Kind: core.StringPtr(kindVPE), - CatalogID: &catalogID, - Data: make(map[string]interface{}), - } - - _, response, err := catalogManagementServiceAuthorized.ReplaceObject(replaceObjectOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(404)) - }) - - It(`Returns 400 when backend input validation fails`, func() { - - Expect(objectID).ToNot(BeNil()) - Expect(catalogID).ToNot(BeNil()) - - replaceObjectOptions := &catalogmanagementv1.ReplaceObjectOptions{ - CatalogIdentifier: &catalogID, - ObjectIdentifier: &objectID, - ID: &objectID, - Name: core.StringPtr("updated object name by go sdk"), - ParentID: ®ionUSSouth, - Kind: core.StringPtr(kindVPE), - CatalogID: &catalogID, - Data: make(map[string]interface{}), - } - - _, response, err := catalogManagementServiceAuthorized.ReplaceObject(replaceObjectOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(400)) - }) - - It(`Replaces object`, func() { - - Skip("Cannot change the name of the object.") - - Expect(objectID).ToNot(BeNil()) - Expect(catalogID).ToNot(BeNil()) - - replaceObjectOptions := &catalogmanagementv1.ReplaceObjectOptions{ - CatalogIdentifier: &catalogID, - ObjectIdentifier: &objectID, - ID: &objectID, - Name: core.StringPtr("updated-object-name-by-go-sdk"), - ParentID: ®ionUSSouth, - Kind: core.StringPtr(kindVPE), - CatalogID: &catalogID, - Data: make(map[string]interface{}), - } - - replaceObjectResult, response, err := catalogManagementServiceAuthorized.ReplaceObject(replaceObjectOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(replaceObjectResult).NotTo(BeNil()) - }) - }) - - Describe(`Get Object`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`Returns 403 when user is not authorized`, func() { - - Expect(objectID).ToNot(BeNil()) - Expect(catalogID).ToNot(BeNil()) - - getObjectOptions := &catalogmanagementv1.GetObjectOptions{ - CatalogIdentifier: &catalogID, - ObjectIdentifier: &objectID, - } - - _, response, err := catalogManagementServiceNotAuthorized.GetObject(getObjectOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - It(`Returns 404 when no such object`, func() { - - Expect(objectID).ToNot(BeNil()) - Expect(catalogID).ToNot(BeNil()) - - invalidObjectID := "invalid-" + objectID - getObjectOptions := &catalogmanagementv1.GetObjectOptions{ - CatalogIdentifier: &catalogID, - ObjectIdentifier: &invalidObjectID, - } - - _, response, err := catalogManagementServiceAuthorized.GetObject(getObjectOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(404)) - }) - - It(`Returns the object`, func() { - - Expect(objectID).ToNot(BeNil()) - Expect(catalogID).ToNot(BeNil()) - - getObjectOptions := &catalogmanagementv1.GetObjectOptions{ - CatalogIdentifier: &catalogID, - ObjectIdentifier: &objectID, - } - - requestedObject, response, err := catalogManagementServiceAuthorized.GetObject(getObjectOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(requestedObject).NotTo(BeNil()) - }) - }) - - Describe(`Get Object Audit`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`Returns 403 when user is not authorized`, func() { - - Expect(objectID).ToNot(BeNil()) - Expect(catalogID).ToNot(BeNil()) - - getObjectAuditOptions := &catalogmanagementv1.GetObjectAuditOptions{ - CatalogIdentifier: &catalogID, - ObjectIdentifier: &objectID, - } - - _, response, err := catalogManagementServiceNotAuthorized.GetObjectAudit(getObjectAuditOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - It(`Returns 200 when no such object`, func() { - - Expect(objectID).ToNot(BeNil()) - Expect(catalogID).ToNot(BeNil()) - - invalidObjectID := "invalid-" + objectID - getObjectAuditOptions := &catalogmanagementv1.GetObjectAuditOptions{ - CatalogIdentifier: &catalogID, - ObjectIdentifier: &invalidObjectID, - } - - _, response, err := catalogManagementServiceAuthorized.GetObjectAudit(getObjectAuditOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - }) - - It(`Returns the object's audit log`, func() { - - Expect(objectID).ToNot(BeNil()) - Expect(catalogID).ToNot(BeNil()) - - getObjectAuditOptions := &catalogmanagementv1.GetObjectAuditOptions{ - CatalogIdentifier: &catalogID, - ObjectIdentifier: &objectID, - } - - auditLog, response, err := catalogManagementServiceAuthorized.GetObjectAudit(getObjectAuditOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(auditLog).NotTo(BeNil()) - }) - }) - - Describe(`Account Publish Object`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`Returns 403 when user is not authorized`, func() { - - Expect(objectID).ToNot(BeNil()) - Expect(catalogID).ToNot(BeNil()) - - accountPublishObjectOptions := &catalogmanagementv1.AccountPublishObjectOptions{ - CatalogIdentifier: &catalogID, - ObjectIdentifier: &objectID, - } - - response, err := catalogManagementServiceNotAuthorized.AccountPublishObject(accountPublishObjectOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - It(`Returns 404 when no such object`, func() { - - Expect(objectID).ToNot(BeNil()) - Expect(catalogID).ToNot(BeNil()) - - invalidObjectID := "invalid-" + objectID - accountPublishObjectOptions := &catalogmanagementv1.AccountPublishObjectOptions{ - CatalogIdentifier: &catalogID, - ObjectIdentifier: &invalidObjectID, - } - - response, err := catalogManagementServiceAuthorized.AccountPublishObject(accountPublishObjectOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(404)) - }) - - It(`Publishes object`, func() { - - Expect(objectID).ToNot(BeNil()) - Expect(catalogID).ToNot(BeNil()) - - accountPublishObjectOptions := &catalogmanagementv1.AccountPublishObjectOptions{ - CatalogIdentifier: &catalogID, - ObjectIdentifier: &objectID, - } - - response, err := catalogManagementServiceAuthorized.AccountPublishObject(accountPublishObjectOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(202)) - }) - }) - - Describe(`Shared Publish Object`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`Returns 403 when user is not authorized`, func() { - - Expect(objectID).ToNot(BeNil()) - Expect(catalogID).ToNot(BeNil()) - - sharedPublishObjectOptions := &catalogmanagementv1.SharedPublishObjectOptions{ - CatalogIdentifier: &catalogID, - ObjectIdentifier: &objectID, - } - - response, err := catalogManagementServiceNotAuthorized.SharedPublishObject(sharedPublishObjectOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - It(`Returns 404 when no such object`, func() { - - Expect(objectID).ToNot(BeNil()) - Expect(catalogID).ToNot(BeNil()) - - invalidObjectID := "invalid-" + objectID - sharedPublishObjectOptions := &catalogmanagementv1.SharedPublishObjectOptions{ - CatalogIdentifier: &catalogID, - ObjectIdentifier: &invalidObjectID, - } - - response, err := catalogManagementServiceAuthorized.SharedPublishObject(sharedPublishObjectOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(404)) - }) - - It(`Publishes object`, func() { - Skip("Invalid catalog object.") - - Expect(objectID).ToNot(BeNil()) - Expect(catalogID).ToNot(BeNil()) - - sharedPublishObjectOptions := &catalogmanagementv1.SharedPublishObjectOptions{ - CatalogIdentifier: &catalogID, - ObjectIdentifier: &objectID, - } - - response, err := catalogManagementServiceAuthorized.SharedPublishObject(sharedPublishObjectOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(202)) - }) - }) - - Describe(`IBM Publish Object`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`Returns 403 when user is not authorized`, func() { - - Expect(objectID).ToNot(BeNil()) - Expect(catalogID).ToNot(BeNil()) - - ibmPublishObjectOptions := &catalogmanagementv1.IBMPublishObjectOptions{ - CatalogIdentifier: &catalogID, - ObjectIdentifier: &objectID, - } - - response, err := catalogManagementServiceNotAuthorized.IBMPublishObject(ibmPublishObjectOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - It(`Returns 404 when no such object`, func() { - - Expect(objectID).ToNot(BeNil()) - Expect(catalogID).ToNot(BeNil()) - - invalidObjectID := "invalid-" + objectID - ibmPublishObjectOptions := &catalogmanagementv1.IBMPublishObjectOptions{ - CatalogIdentifier: &catalogID, - ObjectIdentifier: &invalidObjectID, - } - - response, err := catalogManagementServiceAuthorized.IBMPublishObject(ibmPublishObjectOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(404)) - }) - - It(`Publishes object`, func() { - Skip("This user is not granted.") - - Expect(objectID).ToNot(BeNil()) - Expect(catalogID).ToNot(BeNil()) - - ibmPublishObjectOptions := &catalogmanagementv1.IBMPublishObjectOptions{ - CatalogIdentifier: &catalogID, - ObjectIdentifier: &objectID, - } - - response, err := catalogManagementServiceAuthorized.IBMPublishObject(ibmPublishObjectOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(202)) - }) - }) - - Describe(`Public Publish Object`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`Returns 403 when user is not authorized`, func() { - - Expect(objectID).ToNot(BeNil()) - Expect(catalogID).ToNot(BeNil()) - - publicPublishObjectOptions := &catalogmanagementv1.PublicPublishObjectOptions{ - CatalogIdentifier: &catalogID, - ObjectIdentifier: &objectID, - } - - response, err := catalogManagementServiceNotAuthorized.PublicPublishObject(publicPublishObjectOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - It(`Returns 404 when no such object`, func() { - - Expect(objectID).ToNot(BeNil()) - Expect(catalogID).ToNot(BeNil()) - - invalidObjectID := "invalid-" + objectID - publicPublishObjectOptions := &catalogmanagementv1.PublicPublishObjectOptions{ - CatalogIdentifier: &catalogID, - ObjectIdentifier: &invalidObjectID, - } - - response, err := catalogManagementServiceAuthorized.PublicPublishObject(publicPublishObjectOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(404)) - }) - - It(`Publishes object`, func() { - Skip("This user is not granted.") - - Expect(objectID).ToNot(BeNil()) - Expect(catalogID).ToNot(BeNil()) - - publicPublishObjectOptions := &catalogmanagementv1.PublicPublishObjectOptions{ - CatalogIdentifier: &catalogID, - ObjectIdentifier: &objectID, - } - - response, err := catalogManagementServiceAuthorized.PublicPublishObject(publicPublishObjectOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(202)) - }) - }) - - Describe(`Create Object Access`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`Returns 403 when user is not authorized`, func() { - - Expect(objectID).ToNot(BeNil()) - Expect(catalogID).ToNot(BeNil()) - - createObjectAccessOptions := &catalogmanagementv1.CreateObjectAccessOptions{ - CatalogIdentifier: &catalogID, - ObjectIdentifier: &objectID, - AccountIdentifier: &accountID, - } - - response, err := catalogManagementServiceNotAuthorized.CreateObjectAccess(createObjectAccessOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - It(`Returns 404 when no such object`, func() { - - Expect(objectID).ToNot(BeNil()) - Expect(catalogID).ToNot(BeNil()) - - invalidObjectID := "invalid-" + objectID - createObjectAccessOptions := &catalogmanagementv1.CreateObjectAccessOptions{ - CatalogIdentifier: &catalogID, - ObjectIdentifier: &invalidObjectID, - AccountIdentifier: &accountID, - } - - response, err := catalogManagementServiceAuthorized.CreateObjectAccess(createObjectAccessOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(404)) - }) - - It(`Creates object access`, func() { - - Expect(objectID).ToNot(BeNil()) - Expect(catalogID).ToNot(BeNil()) - - createObjectAccessOptions := &catalogmanagementv1.CreateObjectAccessOptions{ - CatalogIdentifier: &catalogID, - ObjectIdentifier: &objectID, - AccountIdentifier: &accountID, - } - - response, err := catalogManagementServiceAuthorized.CreateObjectAccess(createObjectAccessOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(201)) - }) - }) - - Describe(`Get Object Access List`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`Returns 403 when user is not authorized`, func() { - - Expect(objectID).ToNot(BeNil()) - Expect(catalogID).ToNot(BeNil()) - - getObjectAccessListOptions := &catalogmanagementv1.GetObjectAccessListOptions{ - CatalogIdentifier: &catalogID, - ObjectIdentifier: &objectID, - } - - _, response, err := catalogManagementServiceNotAuthorized.GetObjectAccessList(getObjectAccessListOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - It(`Returns 200 when no such object`, func() { - - Expect(objectID).ToNot(BeNil()) - Expect(catalogID).ToNot(BeNil()) - - invalidObjectID := "invalid-" + objectID - getObjectAccessListOptions := &catalogmanagementv1.GetObjectAccessListOptions{ - CatalogIdentifier: &catalogID, - ObjectIdentifier: &invalidObjectID, - } - - _, response, err := catalogManagementServiceAuthorized.GetObjectAccessList(getObjectAccessListOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - }) - - It(`Returns object's access list`, func() { - - Expect(objectID).ToNot(BeNil()) - Expect(catalogID).ToNot(BeNil()) - - getObjectAccessListOptions := &catalogmanagementv1.GetObjectAccessListOptions{ - CatalogIdentifier: &catalogID, - ObjectIdentifier: &objectID, - } - - objectAccessList, response, err := catalogManagementServiceAuthorized.GetObjectAccessList(getObjectAccessListOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(objectAccessList).NotTo(BeNil()) - }) - }) - - Describe(`Get Object Access`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`Returns 403 when user is not authorized`, func() { - - Expect(objectID).ToNot(BeNil()) - Expect(catalogID).ToNot(BeNil()) - - getObjectAccessOptions := &catalogmanagementv1.GetObjectAccessOptions{ - CatalogIdentifier: &catalogID, - ObjectIdentifier: &objectID, - AccountIdentifier: &accountID, - } - - _, response, err := catalogManagementServiceNotAuthorized.GetObjectAccess(getObjectAccessOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - It(`Returns 200 when no such object`, func() { - - Expect(objectID).ToNot(BeNil()) - Expect(catalogID).ToNot(BeNil()) - - invalidObjectID := "invalid-" + objectID - getObjectAccessOptions := &catalogmanagementv1.GetObjectAccessOptions{ - CatalogIdentifier: &catalogID, - ObjectIdentifier: &invalidObjectID, - AccountIdentifier: &accountID, - } - - _, response, err := catalogManagementServiceAuthorized.GetObjectAccess(getObjectAccessOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(404)) - }) - - It(`Returns object's access`, func() { - - Skip("Strange not found error see comments.") - // Error: Error loading version with id: 6e263640-4805-471d-a30c-d7667325581c. - // e59ad442-d113-49e4-bcd4-5431990135fd: Error[404 Not Found] - - Expect(objectID).ToNot(BeNil()) - Expect(catalogID).ToNot(BeNil()) - - getObjectAccessOptions := &catalogmanagementv1.GetObjectAccessOptions{ - CatalogIdentifier: &catalogID, - ObjectIdentifier: &objectID, - AccountIdentifier: &accountID, - } - - objectAccessList, response, err := catalogManagementServiceAuthorized.GetObjectAccess(getObjectAccessOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(objectAccessList).NotTo(BeNil()) - }) - }) - - Describe(`Add Object Access List`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`Returns 403 when user is not authorized`, func() { - - Expect(objectID).ToNot(BeNil()) - Expect(catalogID).ToNot(BeNil()) - - addObjectAccessListOptions := &catalogmanagementv1.AddObjectAccessListOptions{ - CatalogIdentifier: &catalogID, - ObjectIdentifier: &objectID, - Accounts: []string{accountID}, - } - - _, response, err := catalogManagementServiceNotAuthorized.AddObjectAccessList(addObjectAccessListOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - It(`Returns 404 when no such object`, func() { - - Expect(objectID).ToNot(BeNil()) - Expect(catalogID).ToNot(BeNil()) - - invalidObjectID := "invalid-" + objectID - addObjectAccessListOptions := &catalogmanagementv1.AddObjectAccessListOptions{ - CatalogIdentifier: &catalogID, - ObjectIdentifier: &invalidObjectID, - Accounts: []string{accountID}, - } - - _, response, err := catalogManagementServiceAuthorized.AddObjectAccessList(addObjectAccessListOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(404)) - }) - - It(`Adds object access list`, func() { - - Expect(objectID).ToNot(BeNil()) - Expect(catalogID).ToNot(BeNil()) - - addObjectAccessListOptions := &catalogmanagementv1.AddObjectAccessListOptions{ - CatalogIdentifier: &catalogID, - ObjectIdentifier: &objectID, - Accounts: []string{accountID}, - } - - accessListResponse, response, err := catalogManagementServiceAuthorized.AddObjectAccessList(addObjectAccessListOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(201)) - Expect(accessListResponse).NotTo(BeNil()) - }) - }) - - Describe(`Create Offering Instance`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`Returns 404 when no such catalog`, func() { - - Skip("None of the known kinds work") - - Expect(offeringID).ToNot(BeNil()) - Expect(catalogID).ToNot(BeNil()) - - invalidCatalogID := "invalid-" + catalogID - createOfferingInstanceOptions := &catalogmanagementv1.CreateOfferingInstanceOptions{ - XAuthRefreshToken: &refreshTokenAuthorized, - ID: &offeringID, - CatalogID: &invalidCatalogID, - OfferingID: &offeringID, - KindFormat: core.StringPtr(kindVPE), - Version: core.StringPtr("0.0.2"), - ClusterID: &clusterID, - ClusterRegion: ®ionUSSouth, - ClusterAllNamespaces: core.BoolPtr(true), - } - - _, response, err := catalogManagementServiceAuthorized.CreateOfferingInstance(createOfferingInstanceOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(404)) - }) - - It(`Returns 403 when user is not authorized`, func() { - - Skip("None of the known kinds work") - - Expect(offeringID).ToNot(BeNil()) - Expect(catalogID).ToNot(BeNil()) - - createOfferingInstanceOptions := &catalogmanagementv1.CreateOfferingInstanceOptions{ - XAuthRefreshToken: &refreshTokenNotAuthorized, - ID: &offeringID, - CatalogID: &catalogID, - OfferingID: &offeringID, - KindFormat: core.StringPtr(kindVPE), - Version: core.StringPtr("0.0.2"), - ClusterID: &clusterID, - ClusterRegion: ®ionUSSouth, - ClusterAllNamespaces: core.BoolPtr(true), - } - - _, response, err := catalogManagementServiceNotAuthorized.CreateOfferingInstance(createOfferingInstanceOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - It(`Returns 400 when backend input validation fails`, func() { - - Expect(offeringID).ToNot(BeNil()) - Expect(catalogID).ToNot(BeNil()) - - createOfferingInstanceOptions := &catalogmanagementv1.CreateOfferingInstanceOptions{ - XAuthRefreshToken: &refreshTokenAuthorized, - ID: &offeringID, - CatalogID: &catalogID, - OfferingID: &offeringID, - KindFormat: core.StringPtr("bogus kind"), - Version: core.StringPtr("0.0.2"), - ClusterID: &clusterID, - ClusterRegion: ®ionUSSouth, - ClusterAllNamespaces: core.BoolPtr(true), - } - - _, response, err := catalogManagementServiceAuthorized.CreateOfferingInstance(createOfferingInstanceOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(400)) - }) - - It(`Creates Offering Instance`, func() { - - Skip("None of the known kinds work") - - Expect(offeringID).ToNot(BeNil()) - Expect(catalogID).ToNot(BeNil()) - - createOfferingInstanceOptions := &catalogmanagementv1.CreateOfferingInstanceOptions{ - XAuthRefreshToken: &refreshTokenAuthorized, - ID: &offeringID, - CatalogID: &catalogID, - OfferingID: &offeringID, - KindFormat: core.StringPtr(kindVPE), - Version: core.StringPtr("0.0.2"), - ClusterID: &clusterID, - ClusterRegion: ®ionUSSouth, - ClusterAllNamespaces: core.BoolPtr(true), - } - - createdOfferingInstance, response, err := catalogManagementServiceAuthorized.CreateOfferingInstance(createOfferingInstanceOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(201)) - Expect(createdOfferingInstance).NotTo(BeNil()) - Expect(createdOfferingInstance.ID).NotTo(BeNil()) - offeringInstanceID = *createdOfferingInstance.ID - }) - }) - - Describe(`Get Offering Instance - Get Offering Instance`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`Returns 403 when user is not authorized`, func() { - Skip("No offering instance id.") - - Expect(offeringInstanceID).ToNot(BeNil()) - - getOfferingInstanceOptions := &catalogmanagementv1.GetOfferingInstanceOptions{ - InstanceIdentifier: &offeringInstanceID, - } - - _, response, err := catalogManagementServiceNotAuthorized.GetOfferingInstance(getOfferingInstanceOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - It(`Returns 404 when no such offering instance`, func() { - - Skip("No offering instance id.") - - Expect(offeringInstanceID).ToNot(BeNil()) - - invalidOfferingInstanceID := "invalid-" + offeringInstanceID - getOfferingInstanceOptions := &catalogmanagementv1.GetOfferingInstanceOptions{ - InstanceIdentifier: &invalidOfferingInstanceID, - } - - _, response, err := catalogManagementServiceAuthorized.GetOfferingInstance(getOfferingInstanceOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(404)) - }) - - It(`Returns the offering instance`, func() { - Skip("No offering instance id.") - - Expect(offeringInstanceID).ToNot(BeNil()) - - getOfferingInstanceOptions := &catalogmanagementv1.GetOfferingInstanceOptions{ - InstanceIdentifier: &offeringInstanceID, - } - - offeringInstance, response, err := catalogManagementServiceAuthorized.GetOfferingInstance(getOfferingInstanceOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(offeringInstance).NotTo(BeNil()) - }) - }) - - Describe(`Put Offering Instance`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`Returns 403 when user is not authorized`, func() { - - Skip("No offering instance id.") - - Expect(offeringInstanceID).ToNot(BeNil()) - Expect(catalogID).ToNot(BeNil()) - Expect(offeringID).ToNot(BeNil()) - - putOfferingInstanceOptions := &catalogmanagementv1.PutOfferingInstanceOptions{ - InstanceIdentifier: &offeringInstanceID, - XAuthRefreshToken: &refreshTokenNotAuthorized, - ID: &offeringInstanceID, - CatalogID: &catalogID, - OfferingID: &offeringID, - KindFormat: core.StringPtr(kindVPE), - Version: core.StringPtr("0.0.3"), - ClusterID: &clusterID, - ClusterRegion: ®ionUSSouth, - ClusterAllNamespaces: core.BoolPtr(true), - } - - _, response, err := catalogManagementServiceNotAuthorized.PutOfferingInstance(putOfferingInstanceOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - It(`Returns 404 when no such catalog`, func() { - - Skip("No offering instance id.") - - Expect(offeringInstanceID).ToNot(BeNil()) - Expect(catalogID).ToNot(BeNil()) - Expect(offeringID).ToNot(BeNil()) - - invalidCatalogID := "invalid-" + catalogID - putOfferingInstanceOptions := &catalogmanagementv1.PutOfferingInstanceOptions{ - InstanceIdentifier: &offeringInstanceID, - XAuthRefreshToken: &refreshTokenAuthorized, - ID: &offeringInstanceID, - CatalogID: &invalidCatalogID, - OfferingID: &offeringID, - KindFormat: core.StringPtr(kindVPE), - Version: core.StringPtr("0.0.3"), - ClusterID: &clusterID, - ClusterRegion: ®ionUSSouth, - ClusterAllNamespaces: core.BoolPtr(true), - } - - _, response, err := catalogManagementServiceAuthorized.PutOfferingInstance(putOfferingInstanceOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(404)) - }) - - It(`Returns 400 when backend input validation fails`, func() { - - Skip("No offering instance id.") - - Expect(offeringInstanceID).ToNot(BeNil()) - Expect(catalogID).ToNot(BeNil()) - Expect(offeringID).ToNot(BeNil()) - - putOfferingInstanceOptions := &catalogmanagementv1.PutOfferingInstanceOptions{ - InstanceIdentifier: &offeringInstanceID, - XAuthRefreshToken: &refreshTokenAuthorized, - ID: &offeringInstanceID, - CatalogID: &catalogID, - OfferingID: &offeringID, - KindFormat: core.StringPtr("bogus kind"), - Version: core.StringPtr("0.0.3"), - ClusterID: &clusterID, - ClusterRegion: ®ionUSSouth, - ClusterAllNamespaces: core.BoolPtr(true), - } - - _, response, err := catalogManagementServiceAuthorized.PutOfferingInstance(putOfferingInstanceOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(400)) - }) - - It(`Updates the offering instance`, func() { - - Skip("No offering instance id.") - - Expect(offeringInstanceID).ToNot(BeNil()) - Expect(catalogID).ToNot(BeNil()) - Expect(offeringID).ToNot(BeNil()) - - putOfferingInstanceOptions := &catalogmanagementv1.PutOfferingInstanceOptions{ - InstanceIdentifier: &offeringInstanceID, - XAuthRefreshToken: &refreshTokenAuthorized, - ID: &offeringInstanceID, - CatalogID: &catalogID, - OfferingID: &offeringID, - KindFormat: core.StringPtr(kindVPE), - Version: core.StringPtr("0.0.3"), - ClusterID: &clusterID, - ClusterRegion: ®ionUSSouth, - ClusterAllNamespaces: core.BoolPtr(true), - } - - offeringInstance, response, err := catalogManagementServiceAuthorized.PutOfferingInstance(putOfferingInstanceOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(offeringInstance).NotTo(BeNil()) - }) - }) - - Describe(`Delete Version`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`Returns 400 when backend input validation fails`, func() { - - deleteVersionOptions := &catalogmanagementv1.DeleteVersionOptions{ - VersionLocID: &bogusVersionLocatorID, - } - - response, err := catalogManagementServiceAuthorized.DeleteVersion(deleteVersionOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(400)) - }) - - It(`Returns 404 when no such version`, func() { - - Expect(versionLocatorID).ToNot(BeNil()) - - invalidVersionLocatorID := "invalid-" + versionLocatorID - deleteVersionOptions := &catalogmanagementv1.DeleteVersionOptions{ - VersionLocID: &invalidVersionLocatorID, - } - - response, err := catalogManagementServiceAuthorized.DeleteVersion(deleteVersionOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(404)) - }) - - It(`Returns 403 when user is not authorized`, func() { - - Expect(versionLocatorID).ToNot(BeNil()) - - deleteVersionOptions := &catalogmanagementv1.DeleteVersionOptions{ - VersionLocID: &versionLocatorID, - } - - response, err := catalogManagementServiceNotAuthorized.DeleteVersion(deleteVersionOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - It(`Deletes the version`, func() { - - Expect(versionLocatorID).ToNot(BeNil()) - - deleteVersionOptions := &catalogmanagementv1.DeleteVersionOptions{ - VersionLocID: &versionLocatorID, - } - - response, err := catalogManagementServiceAuthorized.DeleteVersion(deleteVersionOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - }) - }) - - Describe(`Delete Operators`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`Returns 403 when user is not authorized`, func() { - - Expect(versionLocatorID).ToNot(BeNil()) - - deleteOperatorsOptions := &catalogmanagementv1.DeleteOperatorsOptions{ - XAuthRefreshToken: &refreshTokenNotAuthorized, - ClusterID: &clusterID, - Region: ®ionUSSouth, - VersionLocatorID: &versionLocatorID, - } - - response, err := catalogManagementServiceNotAuthorized.DeleteOperators(deleteOperatorsOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - It(`Returns 404 when no such version`, func() { - - Expect(versionLocatorID).ToNot(BeNil()) - - invalidVersionLocatorID := "invalid-" + versionLocatorID - deleteOperatorsOptions := &catalogmanagementv1.DeleteOperatorsOptions{ - XAuthRefreshToken: &refreshTokenAuthorized, - ClusterID: &clusterID, - Region: ®ionUSSouth, - VersionLocatorID: &invalidVersionLocatorID, - } - - response, err := catalogManagementServiceAuthorized.DeleteOperators(deleteOperatorsOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(404)) - }) - - It(`Returns 400 when backend input validation fails`, func() { - - deleteOperatorsOptions := &catalogmanagementv1.DeleteOperatorsOptions{ - XAuthRefreshToken: &refreshTokenAuthorized, - ClusterID: &clusterID, - Region: ®ionUSSouth, - VersionLocatorID: &bogusVersionLocatorID, - } - - response, err := catalogManagementServiceAuthorized.DeleteOperators(deleteOperatorsOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(400)) - }) - - It(`Deletes the operator`, func() { - Skip("Strange not found error, see comments.") - // Error: Error loading version with id: fdeefb18-57aa-4390-a9e0-b66b551db803. - // 2c187aa6-5009-4a2f-8f57-86533d2d3a18: Error[404 Not Found] - - // Version not found: Catalog[fdeefb18-57aa-4390-a9e0-b66b551db803]:Version[2c187aa6-5009-4a2f-8f57-86533d2d3a18] - - Expect(versionLocatorID).ToNot(BeNil()) - - deleteOperatorsOptions := &catalogmanagementv1.DeleteOperatorsOptions{ - XAuthRefreshToken: &refreshTokenAuthorized, - ClusterID: &clusterID, - Region: ®ionUSSouth, - VersionLocatorID: &versionLocatorID, - } - - response, err := catalogManagementServiceAuthorized.DeleteOperators(deleteOperatorsOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - }) - }) - - Describe(`Delete Offering Instance`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`Returns 403 when user is not authorized`, func() { - Skip("No Offering instance id.") - - Expect(offeringInstanceID).ToNot(BeNil()) - - deleteOfferingInstanceOptions := &catalogmanagementv1.DeleteOfferingInstanceOptions{ - InstanceIdentifier: &offeringInstanceID, - XAuthRefreshToken: &refreshTokenNotAuthorized, - } - - response, err := catalogManagementServiceNotAuthorized.DeleteOfferingInstance(deleteOfferingInstanceOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - It(`Returns 404 when no such offering instance`, func() { - Skip("No Offering instance id.") - - Expect(offeringInstanceID).ToNot(BeNil()) - - invalidOfferingInstanceID := "invalid-" + offeringInstanceID - deleteOfferingInstanceOptions := &catalogmanagementv1.DeleteOfferingInstanceOptions{ - InstanceIdentifier: &invalidOfferingInstanceID, - XAuthRefreshToken: &refreshTokenAuthorized, - } - - response, err := catalogManagementServiceAuthorized.DeleteOfferingInstance(deleteOfferingInstanceOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(404)) - }) - - It(`Deletes the offering instance`, func() { - Skip("No offering instance.") - - Expect(offeringInstanceID).ToNot(BeNil()) - - deleteOfferingInstanceOptions := &catalogmanagementv1.DeleteOfferingInstanceOptions{ - InstanceIdentifier: &offeringInstanceID, - XAuthRefreshToken: &refreshTokenAuthorized, - } - - response, err := catalogManagementServiceAuthorized.DeleteOfferingInstance(deleteOfferingInstanceOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - }) - }) - - Describe(`Delete Object Access List`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`Returns 403 when user is not authorized`, func() { - - Expect(objectID).ToNot(BeNil()) - Expect(catalogID).ToNot(BeNil()) - - deleteObjectAccessListOptions := &catalogmanagementv1.DeleteObjectAccessListOptions{ - CatalogIdentifier: &catalogID, - ObjectIdentifier: &objectID, - Accounts: []string{accountID}, - } - - _, response, err := catalogManagementServiceNotAuthorized.DeleteObjectAccessList(deleteObjectAccessListOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - It(`Returns 404 when no such catalog`, func() { - - Expect(objectID).ToNot(BeNil()) - Expect(catalogID).ToNot(BeNil()) - - invalidCatalogID := "invalid-" + catalogID - deleteObjectAccessListOptions := &catalogmanagementv1.DeleteObjectAccessListOptions{ - CatalogIdentifier: &invalidCatalogID, - ObjectIdentifier: &objectID, - Accounts: []string{accountID}, - } - - _, response, err := catalogManagementServiceAuthorized.DeleteObjectAccessList(deleteObjectAccessListOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(404)) - }) - - It(`Deletes object access list`, func() { - - Expect(objectID).ToNot(BeNil()) - Expect(catalogID).ToNot(BeNil()) - - deleteObjectAccessListOptions := &catalogmanagementv1.DeleteObjectAccessListOptions{ - CatalogIdentifier: &catalogID, - ObjectIdentifier: &objectID, - Accounts: []string{accountID}, - } - - result, response, err := catalogManagementServiceAuthorized.DeleteObjectAccessList(deleteObjectAccessListOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(result).NotTo(BeNil()) - }) - }) - - Describe(`Delete Object Access`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`Returns 403 when user is not authorized`, func() { - - Expect(objectID).ToNot(BeNil()) - Expect(catalogID).ToNot(BeNil()) - - deleteObjectAccessOptions := &catalogmanagementv1.DeleteObjectAccessOptions{ - CatalogIdentifier: &catalogID, - ObjectIdentifier: &objectID, - AccountIdentifier: &accountID, - } - - response, err := catalogManagementServiceNotAuthorized.DeleteObjectAccess(deleteObjectAccessOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - It(`Returns 404 when no such catalog`, func() { - - Expect(objectID).ToNot(BeNil()) - Expect(catalogID).ToNot(BeNil()) - - invalidCatalogID := "invalid-" + catalogID - deleteObjectAccessOptions := &catalogmanagementv1.DeleteObjectAccessOptions{ - CatalogIdentifier: &invalidCatalogID, - ObjectIdentifier: &objectID, - AccountIdentifier: &accountID, - } - - response, err := catalogManagementServiceAuthorized.DeleteObjectAccess(deleteObjectAccessOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(404)) - }) - - It(`Deletes object access`, func() { - - Expect(objectID).ToNot(BeNil()) - Expect(catalogID).ToNot(BeNil()) - - deleteObjectAccessOptions := &catalogmanagementv1.DeleteObjectAccessOptions{ - CatalogIdentifier: &catalogID, - ObjectIdentifier: &objectID, - AccountIdentifier: &accountID, - } - - response, err := catalogManagementServiceAuthorized.DeleteObjectAccess(deleteObjectAccessOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - }) - }) - - Describe(`Delete Object`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`Returns 403 when user is not authorized`, func() { - - Expect(objectID).ToNot(BeNil()) - Expect(catalogID).ToNot(BeNil()) - - deleteObjectOptions := &catalogmanagementv1.DeleteObjectOptions{ - CatalogIdentifier: &catalogID, - ObjectIdentifier: &objectID, - } - - response, err := catalogManagementServiceNotAuthorized.DeleteObject(deleteObjectOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - It(`Returns 200 when no such object`, func() { - - Expect(objectID).ToNot(BeNil()) - Expect(catalogID).ToNot(BeNil()) - - invalidObjectID := "invalid-" + objectID - deleteObjectOptions := &catalogmanagementv1.DeleteObjectOptions{ - CatalogIdentifier: &catalogID, - ObjectIdentifier: &invalidObjectID, - } - - response, err := catalogManagementServiceAuthorized.DeleteObject(deleteObjectOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - }) - - It(`Deletes object`, func() { - - Expect(catalogID).ToNot(BeNil()) - - for _, id := range createdObjectIDs { - deleteObjectOptions := &catalogmanagementv1.DeleteObjectOptions{ - CatalogIdentifier: &catalogID, - ObjectIdentifier: &id, - } - - response, err := catalogManagementServiceAuthorized.DeleteObject(deleteObjectOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - } - }) - }) - - Describe(`Delete Offering`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - - It(`Returns 200 when no such offering`, func() { - - Expect(offeringID).ToNot(BeNil()) - Expect(catalogID).ToNot(BeNil()) - - invalidOfferingID := "invalid-" + offeringID - deleteOfferingOptions := &catalogmanagementv1.DeleteOfferingOptions{ - CatalogIdentifier: &catalogID, - OfferingID: &invalidOfferingID, - } - - response, err := catalogManagementServiceAuthorized.DeleteOffering(deleteOfferingOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - }) - - It(`Returns 403 when user is not authorized`, func() { - - Expect(offeringID).ToNot(BeNil()) - Expect(catalogID).ToNot(BeNil()) - - deleteOfferingOptions := &catalogmanagementv1.DeleteOfferingOptions{ - CatalogIdentifier: &catalogID, - OfferingID: &offeringID, - } - - response, err := catalogManagementServiceNotAuthorized.DeleteOffering(deleteOfferingOptions) - - Expect(err).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - It(`Deletes offering`, func() { - - Expect(catalogID).ToNot(BeNil()) - - for _, id := range createdOfferingIDs { - deleteOfferingOptions := &catalogmanagementv1.DeleteOfferingOptions{ - CatalogIdentifier: &catalogID, - OfferingID: &id, - } - - response, err := catalogManagementServiceAuthorized.DeleteOffering(deleteOfferingOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - } - }) - }) - - Describe(`Delete Catalog`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - - It(`Returns 200 when no such catalog`, func() { - Expect(catalogID).NotTo(BeNil()) - - invalidCatalogId := "invalid-" + catalogID - deleteCatalogOptions := &catalogmanagementv1.DeleteCatalogOptions{ - CatalogIdentifier: &invalidCatalogId, - } - - response, err := catalogManagementServiceAuthorized.DeleteCatalog(deleteCatalogOptions) - - Expect(err).To(BeNil()) - Expect(response).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - }) - - It(`Returns 403 when user is not authorized`, func() { - Expect(catalogID).NotTo(BeNil()) - - deleteCatalogOptions := &catalogmanagementv1.DeleteCatalogOptions{ - CatalogIdentifier: &catalogID, - } - - response, err := catalogManagementServiceNotAuthorized.DeleteCatalog(deleteCatalogOptions) - - Expect(err).NotTo(BeNil()) - Expect(response).NotTo(BeNil()) - Expect(response.StatusCode).To(Equal(403)) - }) - - It(`Deletes catalog`, func() { - Expect(catalogID).NotTo(BeNil()) - - deleteCatalogOptions := &catalogmanagementv1.DeleteCatalogOptions{ - CatalogIdentifier: &catalogID, - } - - response, err := catalogManagementServiceAuthorized.DeleteCatalog(deleteCatalogOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - }) - }) - - AfterSuite(func() { - - for _, createdObjectID := range createdObjectIDs { - deleteObjectOptions := &catalogmanagementv1.DeleteObjectOptions{ - CatalogIdentifier: &catalogID, - ObjectIdentifier: &createdObjectID, - } - - _, err = catalogManagementServiceAuthorized.DeleteObject(deleteObjectOptions) - if err != nil { - fmt.Println("Object is already deleted.") - } - } - - for _, createdOfferingID := range createdOfferingIDs { - deleteOfferingOptions := &catalogmanagementv1.DeleteOfferingOptions{ - CatalogIdentifier: &catalogID, - OfferingID: &createdOfferingID, - } - - _, err = catalogManagementServiceAuthorized.DeleteOffering(deleteOfferingOptions) - if err != nil { - fmt.Println("Offering is already deleted.") - } - } - - deleteCatalogOptions := &catalogmanagementv1.DeleteCatalogOptions{ - CatalogIdentifier: &catalogID, - } - - _, err = catalogManagementServiceAuthorized.DeleteCatalog(deleteCatalogOptions) - if err != nil { - fmt.Println("Catalog is already deleted.") - } - }) -}) diff --git a/catalogmanagementv1/catalog_management_v1_integration_test.go b/catalogmanagementv1/catalog_management_v1_integration_test.go index 757dd98e..2eac512c 100644 --- a/catalogmanagementv1/catalog_management_v1_integration_test.go +++ b/catalogmanagementv1/catalog_management_v1_integration_test.go @@ -1,7 +1,8 @@ +//go:build integration // +build integration /** - * (C) Copyright IBM Corp. 2021. + * (C) Copyright IBM Corp. 2022. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,12 +21,12 @@ package catalogmanagementv1_test import ( "fmt" + "log" "os" "time" "github.com/IBM/go-sdk-core/v5/core" "github.com/IBM/platform-services-go-sdk/catalogmanagementv1" - common "github.com/IBM/platform-services-go-sdk/common" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) @@ -38,36 +39,37 @@ import ( * The integration test will automatically skip tests if the required config file is not available. */ -var _ = Describe(`CatalogManagementV1 Integration Tests (New)`, func() { - +var _ = Describe(`CatalogManagementV1 Integration Tests`, func() { const ( externalConfigFile = "../catalog_mgmt.env" - expectedShortDesc = "test" - expectedURL = "https://cm.globalcatalog.test.cloud.ibm.com/api/v1-beta/catalogs/%s" - expectedOfferingsURL = "https://cm.globalcatalog.test.cloud.ibm.com/api/v1-beta/catalogs/%s/offerings" + formatKindTerraform = "terraform" + installKindTerraform = "terraform" + targetKindTerraform = "terraform" + tgzURL = "https://github.com/IBM-Cloud/terraform-sample/archive/refs/tags/v1.1.0.tar.gz" ) var ( err error catalogManagementService *catalogmanagementv1.CatalogManagementV1 - configLoaded bool = false serviceURL string config map[string]string - testCatalogID string - testOfferingID string - expectedLabel = fmt.Sprintf("integration-test-%d", time.Now().Unix()) - gitToken string - refreshToken string - testOfferingInstanceID string - testOfferingInstanceRev string - targetAccountID string - targetClusterID string + accountID string + + // Variables to hold link values + accountRevLink string + catalogIDLink string + catalogRevLink string + objectIDLink string + objectRevLink string + offeringIDLink string + offeringRevLink string + versionIDLink string + versionLocatorLink string + versionRevLink string ) var shouldSkipTest = func() { - if !configLoaded { - Skip("External configuration is not available, skipping...") - } + Skip("External configuration is not available, skipping tests...") } Describe(`External configuration`, func() { @@ -79,7 +81,6 @@ var _ = Describe(`CatalogManagementV1 Integration Tests (New)`, func() { os.Setenv("IBM_CREDENTIALS_FILE", externalConfigFile) config, err = core.GetServiceProperties(catalogmanagementv1.DefaultServiceName) - if err != nil { Skip("Error loading service properties, skipping tests: " + err.Error()) } @@ -87,36 +88,12 @@ var _ = Describe(`CatalogManagementV1 Integration Tests (New)`, func() { if serviceURL == "" { Skip("Unable to load service URL configuration property, skipping tests") } - gitToken = config["GIT_TOKEN"] - if serviceURL == "" { - Skip("Unable to load service URL configuration property, skipping tests") - } - targetAccountID = config["ACCOUNT_ID"] - if targetAccountID == "" { - Skip("Unable to load account ID configuration property, skipping tests") - } - targetClusterID = config["CLUSTER_ID"] - if targetClusterID == "" { - Skip("Unable to load cluster ID configuration property, skipping tests") - } - - fmt.Fprintf(GinkgoWriter, "Service URL: %s\n", serviceURL) - shouldSkipTest = func() {} - }) - }) - - Describe(`Get Refresh Token`, func() { - It("successfully creates a refresh token", func() { - authenticator, err := core.GetAuthenticatorFromEnvironment("catalog_management") - iamAuthenticator := authenticator.(*core.IamAuthenticator) - Expect(err).To(BeNil()) - - tokenServerResponse, err := iamAuthenticator.RequestToken() - refreshToken = tokenServerResponse.RefreshToken + accountID = config["ACCOUNT_ID"] + Expect(accountID).NotTo(BeNil()) - Expect(err).To(BeNil()) - Expect(refreshToken).ToNot(BeNil()) + fmt.Fprintf(GinkgoWriter, "Service URL: %v\n", serviceURL) + shouldSkipTest = func() {} }) }) @@ -125,2209 +102,3569 @@ var _ = Describe(`CatalogManagementV1 Integration Tests (New)`, func() { shouldSkipTest() }) It("Successfully construct the service client instance", func() { - catalogManagementServiceOptions := &catalogmanagementv1.CatalogManagementV1Options{} catalogManagementService, err = catalogmanagementv1.NewCatalogManagementV1UsingExternalConfig(catalogManagementServiceOptions) - Expect(err).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) Expect(catalogManagementService.Service.Options.URL).To(Equal(serviceURL)) + core.SetLogger(core.NewLogger(core.LevelDebug, log.New(GinkgoWriter, "", log.LstdFlags), log.New(GinkgoWriter, "", log.LstdFlags))) + catalogManagementService.EnableRetries(4, 30*time.Second) }) }) - /* - Describe(`GetCatalogAccount - Get catalog account settings`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`GetCatalogAccount(getCatalogAccountOptions *GetCatalogAccountOptions)`, func() { - - getCatalogAccountOptions := &catalogmanagementv1.GetCatalogAccountOptions{ - } - - account, response, err := catalogManagementService.GetCatalogAccount(getCatalogAccountOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(account).ToNot(BeNil()) - }) + Describe(`GetCatalogAccount - Get catalog account settings`, func() { + BeforeEach(func() { + shouldSkipTest() }) + It(`GetCatalogAccount(getCatalogAccountOptions *GetCatalogAccountOptions)`, func() { + getCatalogAccountOptions := &catalogmanagementv1.GetCatalogAccountOptions{} - Describe(`UpdateCatalogAccount - Update account settings`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`UpdateCatalogAccount(updateCatalogAccountOptions *UpdateCatalogAccountOptions)`, func() { + account, response, err := catalogManagementService.GetCatalogAccount(getCatalogAccountOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(account).ToNot(BeNil()) - filterTermsModel := &catalogmanagementv1.FilterTerms{ - FilterTerms: []string{"testString"}, - } + accountRevLink = *account.Rev + fmt.Fprintf(GinkgoWriter, "Saved accountRevLink value: %v\n", accountRevLink) + }) + }) - categoryFilterModel := &catalogmanagementv1.CategoryFilter{ - Include: core.BoolPtr(true), - Filter: filterTermsModel, - } + Describe(`UpdateCatalogAccount - Update account settings`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`UpdateCatalogAccount(updateCatalogAccountOptions *UpdateCatalogAccountOptions)`, func() { + filterTermsModel := &catalogmanagementv1.FilterTerms{ + FilterTerms: []string{"testString"}, + } - idFilterModel := &catalogmanagementv1.IDFilter{ - Include: filterTermsModel, - Exclude: filterTermsModel, - } + categoryFilterModel := &catalogmanagementv1.CategoryFilter{ + Include: core.BoolPtr(true), + Filter: filterTermsModel, + } - filtersModel := &catalogmanagementv1.Filters{ - IncludeAll: core.BoolPtr(true), - CategoryFilters: make(map[string]catalogmanagementv1.CategoryFilter), - IDFilters: idFilterModel, - } - filtersModel.CategoryFilters["foo"] = *categoryFilterModel + idFilterModel := &catalogmanagementv1.IDFilter{ + Include: filterTermsModel, + Exclude: filterTermsModel, + } - updateCatalogAccountOptions := &catalogmanagementv1.UpdateCatalogAccountOptions{ - ID: core.StringPtr("testString"), - HideIBMCloudCatalog: core.BoolPtr(true), - AccountFilters: filtersModel, - } + filtersModel := &catalogmanagementv1.Filters{ + IncludeAll: core.BoolPtr(true), + CategoryFilters: make(map[string]catalogmanagementv1.CategoryFilter), + IDFilters: idFilterModel, + } + filtersModel.CategoryFilters["foo"] = *categoryFilterModel - response, err := catalogManagementService.UpdateCatalogAccount(updateCatalogAccountOptions) + updateCatalogAccountOptions := &catalogmanagementv1.UpdateCatalogAccountOptions{ + ID: core.StringPtr(accountID), + Rev: &accountRevLink, + HideIBMCloudCatalog: core.BoolPtr(true), + AccountFilters: filtersModel, + } - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) + account, response, err := catalogManagementService.UpdateCatalogAccount(updateCatalogAccountOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(account).ToNot(BeNil()) - }) + accountRevLink = *account.Rev + fmt.Fprintf(GinkgoWriter, "Saved accountRevLink value: %v\n", accountRevLink) }) + }) - Describe(`GetCatalogAccountAudit - Get catalog account audit log`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`GetCatalogAccountAudit(getCatalogAccountAuditOptions *GetCatalogAccountAuditOptions)`, func() { - - getCatalogAccountAuditOptions := &catalogmanagementv1.GetCatalogAccountAuditOptions{ - } - - auditLog, response, err := catalogManagementService.GetCatalogAccountAudit(getCatalogAccountAuditOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(auditLog).ToNot(BeNil()) - - }) + Describe(`CreateCatalog - Create a catalog`, func() { + BeforeEach(func() { + shouldSkipTest() }) + It(`CreateCatalog(createCatalogOptions *CreateCatalogOptions)`, func() { + featureModel := &catalogmanagementv1.Feature{ + Title: core.StringPtr("testString"), + TitleI18n: make(map[string]string), + Description: core.StringPtr("testString"), + DescriptionI18n: make(map[string]string), + } - Describe(`GetCatalogAccountFilters - Get catalog account filters`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`GetCatalogAccountFilters(getCatalogAccountFiltersOptions *GetCatalogAccountFiltersOptions)`, func() { + filterTermsModel := &catalogmanagementv1.FilterTerms{ + FilterTerms: []string{"testString"}, + } - getCatalogAccountFiltersOptions := &catalogmanagementv1.GetCatalogAccountFiltersOptions{ - Catalog: core.StringPtr("testString"), - } + categoryFilterModel := &catalogmanagementv1.CategoryFilter{ + Include: core.BoolPtr(true), + Filter: filterTermsModel, + } - accumulatedFilters, response, err := catalogManagementService.GetCatalogAccountFilters(getCatalogAccountFiltersOptions) + idFilterModel := &catalogmanagementv1.IDFilter{ + Include: filterTermsModel, + Exclude: filterTermsModel, + } - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(accumulatedFilters).ToNot(BeNil()) + filtersModel := &catalogmanagementv1.Filters{ + IncludeAll: core.BoolPtr(true), + CategoryFilters: make(map[string]catalogmanagementv1.CategoryFilter), + IDFilters: idFilterModel, + } + filtersModel.CategoryFilters["foo"] = *categoryFilterModel + + syndicationClusterModel := &catalogmanagementv1.SyndicationCluster{ + Region: core.StringPtr("testString"), + ID: core.StringPtr("testString"), + Name: core.StringPtr("testString"), + ResourceGroupName: core.StringPtr("testString"), + Type: core.StringPtr("testString"), + Namespaces: []string{"testString"}, + AllNamespaces: core.BoolPtr(true), + } - }) - }) + syndicationHistoryModel := &catalogmanagementv1.SyndicationHistory{ + Namespaces: []string{"testString"}, + Clusters: []catalogmanagementv1.SyndicationCluster{*syndicationClusterModel}, + LastRun: CreateMockDateTime("2019-01-01T12:00:00.000Z"), + } - Describe(`ListCatalogs - Get list of catalogs`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`ListCatalogs(listCatalogsOptions *ListCatalogsOptions)`, func() { + syndicationAuthorizationModel := &catalogmanagementv1.SyndicationAuthorization{ + Token: core.StringPtr("testString"), + LastRun: CreateMockDateTime("2019-01-01T12:00:00.000Z"), + } - listCatalogsOptions := &catalogmanagementv1.ListCatalogsOptions{ - } + syndicationResourceModel := &catalogmanagementv1.SyndicationResource{ + RemoveRelatedComponents: core.BoolPtr(true), + Clusters: []catalogmanagementv1.SyndicationCluster{*syndicationClusterModel}, + History: syndicationHistoryModel, + Authorization: syndicationAuthorizationModel, + } - catalogSearchResult, response, err := catalogManagementService.ListCatalogs(listCatalogsOptions) + createCatalogOptions := &catalogmanagementv1.CreateCatalogOptions{ + ID: &catalogIDLink, + Rev: &catalogRevLink, + Label: core.StringPtr("testString"), + LabelI18n: make(map[string]string), + ShortDescription: core.StringPtr("testString"), + ShortDescriptionI18n: make(map[string]string), + CatalogIconURL: core.StringPtr("testString"), + Tags: []string{"testString"}, + Features: []catalogmanagementv1.Feature{*featureModel}, + Disabled: core.BoolPtr(true), + OwningAccount: core.StringPtr("testString"), + CatalogFilters: filtersModel, + SyndicationSettings: syndicationResourceModel, + Kind: core.StringPtr("offering"), + Metadata: make(map[string]interface{}), + } - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(catalogSearchResult).ToNot(BeNil()) + catalog, response, err := catalogManagementService.CreateCatalog(createCatalogOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(201)) + Expect(catalog).ToNot(BeNil()) - }) + catalogIDLink = *catalog.ID + fmt.Fprintf(GinkgoWriter, "Saved catalogIDLink value: %v\n", catalogIDLink) + catalogRevLink = *catalog.Rev + fmt.Fprintf(GinkgoWriter, "Saved catalogRevLink value: %v\n", catalogRevLink) }) - */ - Describe(`CreateCatalog - Create a catalog`, func() { + }) + + Describe(`GetCatalog - Get catalog`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`CreateCatalog(createCatalogOptions *CreateCatalogOptions)`, func() { - - options := catalogManagementService.NewCreateCatalogOptions() - options.SetLabel(expectedLabel) - options.SetShortDescription(expectedShortDesc) - result, response, err := catalogManagementService.CreateCatalog(options) + It(`GetCatalog(getCatalogOptions *GetCatalogOptions)`, func() { + getCatalogOptions := &catalogmanagementv1.GetCatalogOptions{ + CatalogIdentifier: &catalogIDLink, + } + catalog, response, err := catalogManagementService.GetCatalog(getCatalogOptions) Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(201)) - Expect(result).ToNot(BeNil()) - fmt.Fprintf(GinkgoWriter, "CreateCatalog() result:\n%s\n", common.ToJSON(result)) - - Expect(*result.Label).To(Equal(expectedLabel)) - Expect(*result.ShortDescription).To(Equal(expectedShortDesc)) - Expect(*result.URL).To(Equal(fmt.Sprintf(expectedURL, *result.ID))) - Expect(*result.OfferingsURL).To(Equal(fmt.Sprintf(expectedOfferingsURL, *result.ID))) - Expect(*result.OwningAccount).To(Equal(targetAccountID)) - Expect(*result.CatalogFilters.IncludeAll).To(BeFalse()) - Expect(len(result.CatalogFilters.CategoryFilters)).To(BeZero()) - Expect(result.CatalogFilters.IDFilters.Include).To(BeNil()) - Expect(result.CatalogFilters.IDFilters.Exclude).To(BeNil()) - - Expect(result.ID).ToNot(BeNil()) - testCatalogID = *result.ID - }) - }) - /* - Describe(`GetCatalog - Get catalog`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`GetCatalog(getCatalogOptions *GetCatalogOptions)`, func() { - - getCatalogOptions := &catalogmanagementv1.GetCatalogOptions{ - CatalogIdentifier: core.StringPtr("testString"), - } - - catalog, response, err := catalogManagementService.GetCatalog(getCatalogOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(catalog).ToNot(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(catalog).ToNot(BeNil()) - }) + catalogRevLink = *catalog.Rev + fmt.Fprintf(GinkgoWriter, "Saved catalogRevLink value: %v\n", catalogRevLink) }) + }) - Describe(`ReplaceCatalog - Update catalog`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`ReplaceCatalog(replaceCatalogOptions *ReplaceCatalogOptions)`, func() { - - featureModel := &catalogmanagementv1.Feature{ - Title: core.StringPtr("testString"), - Description: core.StringPtr("testString"), - } - - filterTermsModel := &catalogmanagementv1.FilterTerms{ - FilterTerms: []string{"testString"}, - } - - categoryFilterModel := &catalogmanagementv1.CategoryFilter{ - Include: core.BoolPtr(true), - Filter: filterTermsModel, - } - - idFilterModel := &catalogmanagementv1.IDFilter{ - Include: filterTermsModel, - Exclude: filterTermsModel, - } - - filtersModel := &catalogmanagementv1.Filters{ - IncludeAll: core.BoolPtr(true), - CategoryFilters: make(map[string]catalogmanagementv1.CategoryFilter), - IDFilters: idFilterModel, - } - filtersModel.CategoryFilters["foo"] = *categoryFilterModel - - syndicationClusterModel := &catalogmanagementv1.SyndicationCluster{ - Region: core.StringPtr("testString"), - ID: core.StringPtr("testString"), - Name: core.StringPtr("testString"), - ResourceGroupName: core.StringPtr("testString"), - Type: core.StringPtr("testString"), - Namespaces: []string{"testString"}, - AllNamespaces: core.BoolPtr(true), - } - - syndicationHistoryModel := &catalogmanagementv1.SyndicationHistory{ - Namespaces: []string{"testString"}, - Clusters: []catalogmanagementv1.SyndicationCluster{*syndicationClusterModel}, - LastRun: CreateMockDateTime(), - } - - syndicationAuthorizationModel := &catalogmanagementv1.SyndicationAuthorization{ - Token: core.StringPtr("testString"), - LastRun: CreateMockDateTime(), - } + Describe(`ReplaceCatalog - Update catalog`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`ReplaceCatalog(replaceCatalogOptions *ReplaceCatalogOptions)`, func() { + featureModel := &catalogmanagementv1.Feature{ + Title: core.StringPtr("testString"), + TitleI18n: make(map[string]string), + Description: core.StringPtr("testString"), + DescriptionI18n: make(map[string]string), + } - syndicationResourceModel := &catalogmanagementv1.SyndicationResource{ - RemoveRelatedComponents: core.BoolPtr(true), - Clusters: []catalogmanagementv1.SyndicationCluster{*syndicationClusterModel}, - History: syndicationHistoryModel, - Authorization: syndicationAuthorizationModel, - } + filterTermsModel := &catalogmanagementv1.FilterTerms{ + FilterTerms: []string{"testString"}, + } - replaceCatalogOptions := &catalogmanagementv1.ReplaceCatalogOptions{ - CatalogIdentifier: core.StringPtr("testString"), - ID: core.StringPtr("testString"), - Rev: core.StringPtr("testString"), - Label: core.StringPtr("testString"), - ShortDescription: core.StringPtr("testString"), - CatalogIconURL: core.StringPtr("testString"), - Tags: []string{"testString"}, - Features: []catalogmanagementv1.Feature{*featureModel}, - Disabled: core.BoolPtr(true), - ResourceGroupID: core.StringPtr("testString"), - OwningAccount: core.StringPtr("testString"), - CatalogFilters: filtersModel, - SyndicationSettings: syndicationResourceModel, - } + categoryFilterModel := &catalogmanagementv1.CategoryFilter{ + Include: core.BoolPtr(true), + Filter: filterTermsModel, + } - catalog, response, err := catalogManagementService.ReplaceCatalog(replaceCatalogOptions) + idFilterModel := &catalogmanagementv1.IDFilter{ + Include: filterTermsModel, + Exclude: filterTermsModel, + } - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(catalog).ToNot(BeNil()) + filtersModel := &catalogmanagementv1.Filters{ + IncludeAll: core.BoolPtr(true), + CategoryFilters: make(map[string]catalogmanagementv1.CategoryFilter), + IDFilters: idFilterModel, + } + filtersModel.CategoryFilters["foo"] = *categoryFilterModel + + syndicationClusterModel := &catalogmanagementv1.SyndicationCluster{ + Region: core.StringPtr("testString"), + ID: core.StringPtr("testString"), + Name: core.StringPtr("testString"), + ResourceGroupName: core.StringPtr("testString"), + Type: core.StringPtr("testString"), + Namespaces: []string{"testString"}, + AllNamespaces: core.BoolPtr(true), + } - }) - }) + syndicationHistoryModel := &catalogmanagementv1.SyndicationHistory{ + Namespaces: []string{"testString"}, + Clusters: []catalogmanagementv1.SyndicationCluster{*syndicationClusterModel}, + LastRun: CreateMockDateTime("2019-01-01T12:00:00.000Z"), + } - Describe(`GetCatalogAudit - Get catalog audit log`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`GetCatalogAudit(getCatalogAuditOptions *GetCatalogAuditOptions)`, func() { + syndicationAuthorizationModel := &catalogmanagementv1.SyndicationAuthorization{ + Token: core.StringPtr("testString"), + LastRun: CreateMockDateTime("2019-01-01T12:00:00.000Z"), + } - getCatalogAuditOptions := &catalogmanagementv1.GetCatalogAuditOptions{ - CatalogIdentifier: core.StringPtr("testString"), - } + syndicationResourceModel := &catalogmanagementv1.SyndicationResource{ + RemoveRelatedComponents: core.BoolPtr(true), + Clusters: []catalogmanagementv1.SyndicationCluster{*syndicationClusterModel}, + History: syndicationHistoryModel, + Authorization: syndicationAuthorizationModel, + } - auditLog, response, err := catalogManagementService.GetCatalogAudit(getCatalogAuditOptions) + replaceCatalogOptions := &catalogmanagementv1.ReplaceCatalogOptions{ + CatalogIdentifier: &catalogIDLink, + ID: &catalogIDLink, + Rev: &catalogRevLink, + Label: core.StringPtr("testString"), + LabelI18n: make(map[string]string), + ShortDescription: core.StringPtr("testString"), + ShortDescriptionI18n: make(map[string]string), + CatalogIconURL: core.StringPtr("testString"), + Tags: []string{"testString"}, + Features: []catalogmanagementv1.Feature{*featureModel}, + Disabled: core.BoolPtr(true), + OwningAccount: core.StringPtr("testString"), + CatalogFilters: filtersModel, + SyndicationSettings: syndicationResourceModel, + Kind: core.StringPtr("offering"), + Metadata: make(map[string]interface{}), + } - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(auditLog).ToNot(BeNil()) + catalog, response, err := catalogManagementService.ReplaceCatalog(replaceCatalogOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(catalog).ToNot(BeNil()) - }) + catalogRevLink = *catalog.Rev + fmt.Fprintf(GinkgoWriter, "Saved catalogRevLink value: %v\n", catalogRevLink) }) + }) - Describe(`GetEnterprise - Get enterprise settings`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`GetEnterprise(getEnterpriseOptions *GetEnterpriseOptions)`, func() { - - getEnterpriseOptions := &catalogmanagementv1.GetEnterpriseOptions{ - EnterpriseID: core.StringPtr("testString"), - } - - enterprise, response, err := catalogManagementService.GetEnterprise(getEnterpriseOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(enterprise).ToNot(BeNil()) - - }) + Describe(`CreateOffering - Create offering`, func() { + BeforeEach(func() { + shouldSkipTest() }) + It(`CreateOffering(createOfferingOptions *CreateOfferingOptions)`, func() { + ratingModel := &catalogmanagementv1.Rating{ + OneStarCount: core.Int64Ptr(int64(38)), + TwoStarCount: core.Int64Ptr(int64(38)), + ThreeStarCount: core.Int64Ptr(int64(38)), + FourStarCount: core.Int64Ptr(int64(38)), + } - Describe(`UpdateEnterprise - Update enterprise settings`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`UpdateEnterprise(updateEnterpriseOptions *UpdateEnterpriseOptions)`, func() { + featureModel := &catalogmanagementv1.Feature{ + Title: core.StringPtr("testString"), + TitleI18n: make(map[string]string), + Description: core.StringPtr("testString"), + DescriptionI18n: make(map[string]string), + } - filterTermsModel := &catalogmanagementv1.FilterTerms{ - FilterTerms: []string{"testString"}, - } + flavorModel := &catalogmanagementv1.Flavor{ + Name: core.StringPtr("testString"), + Label: core.StringPtr("testString"), + LabelI18n: make(map[string]string), + Index: core.Int64Ptr(int64(38)), + } - categoryFilterModel := &catalogmanagementv1.CategoryFilter{ - Include: core.BoolPtr(true), - Filter: filterTermsModel, - } + renderTypeAssociationsParametersItemModel := &catalogmanagementv1.RenderTypeAssociationsParametersItem{ + Name: core.StringPtr("testString"), + OptionsRefresh: core.BoolPtr(true), + } - idFilterModel := &catalogmanagementv1.IDFilter{ - Include: filterTermsModel, - Exclude: filterTermsModel, - } + renderTypeAssociationsModel := &catalogmanagementv1.RenderTypeAssociations{ + Parameters: []catalogmanagementv1.RenderTypeAssociationsParametersItem{*renderTypeAssociationsParametersItemModel}, + } - filtersModel := &catalogmanagementv1.Filters{ - IncludeAll: core.BoolPtr(true), - CategoryFilters: make(map[string]catalogmanagementv1.CategoryFilter), - IDFilters: idFilterModel, - } - filtersModel.CategoryFilters["foo"] = *categoryFilterModel + renderTypeModel := &catalogmanagementv1.RenderType{ + Type: core.StringPtr("testString"), + Grouping: core.StringPtr("testString"), + OriginalGrouping: core.StringPtr("testString"), + GroupingIndex: core.Int64Ptr(int64(38)), + ConfigConstraints: map[string]interface{}{"anyKey": "anyValue"}, + Associations: renderTypeAssociationsModel, + } - accountGroupModel := &catalogmanagementv1.AccountGroup{ - ID: core.StringPtr("testString"), - AccountFilters: filtersModel, - } + configurationModel := &catalogmanagementv1.Configuration{ + Key: core.StringPtr("testString"), + Type: core.StringPtr("testString"), + DefaultValue: core.StringPtr("testString"), + DisplayName: core.StringPtr("testString"), + ValueConstraint: core.StringPtr("testString"), + Description: core.StringPtr("testString"), + Required: core.BoolPtr(true), + Options: []interface{}{"testString"}, + Hidden: core.BoolPtr(true), + CustomConfig: renderTypeModel, + TypeMetadata: core.StringPtr("testString"), + } - enterpriseAccountGroupsModel := &catalogmanagementv1.EnterpriseAccountGroups{ - Keys: accountGroupModel, - } + outputModel := &catalogmanagementv1.Output{ + Key: core.StringPtr("testString"), + Description: core.StringPtr("testString"), + } - updateEnterpriseOptions := &catalogmanagementv1.UpdateEnterpriseOptions{ - EnterpriseID: core.StringPtr("testString"), - ID: core.StringPtr("testString"), - Rev: core.StringPtr("testString"), - AccountFilters: filtersModel, - AccountGroups: enterpriseAccountGroupsModel, - } + iamResourceModel := &catalogmanagementv1.IamResource{ + Name: core.StringPtr("testString"), + Description: core.StringPtr("testString"), + RoleCrns: []string{"testString"}, + } - response, err := catalogManagementService.UpdateEnterprise(updateEnterpriseOptions) + iamPermissionModel := &catalogmanagementv1.IamPermission{ + ServiceName: core.StringPtr("testString"), + RoleCrns: []string{"testString"}, + Resources: []catalogmanagementv1.IamResource{*iamResourceModel}, + } - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) + validationModel := &catalogmanagementv1.Validation{ + Validated: CreateMockDateTime("2019-01-01T12:00:00.000Z"), + Requested: CreateMockDateTime("2019-01-01T12:00:00.000Z"), + State: core.StringPtr("testString"), + LastOperation: core.StringPtr("testString"), + Target: make(map[string]interface{}), + Message: core.StringPtr("testString"), + } - }) - }) + resourceModel := &catalogmanagementv1.Resource{ + Type: core.StringPtr("mem"), + Value: core.StringPtr("testString"), + } - Describe(`GetEnterpriseAudit - Get enterprise audit log`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`GetEnterpriseAudit(getEnterpriseAuditOptions *GetEnterpriseAuditOptions)`, func() { + scriptModel := &catalogmanagementv1.Script{ + Instructions: core.StringPtr("testString"), + InstructionsI18n: make(map[string]string), + Script: core.StringPtr("testString"), + ScriptPermission: core.StringPtr("testString"), + DeleteScript: core.StringPtr("testString"), + Scope: core.StringPtr("testString"), + } - getEnterpriseAuditOptions := &catalogmanagementv1.GetEnterpriseAuditOptions{ - EnterpriseID: core.StringPtr("testString"), - } + versionEntitlementModel := &catalogmanagementv1.VersionEntitlement{ + ProviderName: core.StringPtr("testString"), + ProviderID: core.StringPtr("testString"), + ProductID: core.StringPtr("testString"), + PartNumbers: []string{"testString"}, + ImageRepoName: core.StringPtr("testString"), + } - auditLog, response, err := catalogManagementService.GetEnterpriseAudit(getEnterpriseAuditOptions) + licenseModel := &catalogmanagementv1.License{ + ID: core.StringPtr("testString"), + Name: core.StringPtr("testString"), + Type: core.StringPtr("testString"), + URL: core.StringPtr("testString"), + Description: core.StringPtr("testString"), + } - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(auditLog).ToNot(BeNil()) + stateModel := &catalogmanagementv1.State{ + Current: core.StringPtr("testString"), + CurrentEntered: CreateMockDateTime("2019-01-01T12:00:00.000Z"), + Pending: core.StringPtr("testString"), + PendingRequested: CreateMockDateTime("2019-01-01T12:00:00.000Z"), + Previous: core.StringPtr("testString"), + } - }) - }) + deprecatePendingModel := &catalogmanagementv1.DeprecatePending{ + DeprecateDate: CreateMockDateTime("2019-01-01T12:00:00.000Z"), + DeprecateState: core.StringPtr("testString"), + Description: core.StringPtr("testString"), + } - Describe(`GetConsumptionOfferings - Get consumption offerings`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`GetConsumptionOfferings(getConsumptionOfferingsOptions *GetConsumptionOfferingsOptions)`, func() { + mediaItemModel := &catalogmanagementv1.MediaItem{ + URL: core.StringPtr("testString"), + APIURL: core.StringPtr("testString"), + Caption: core.StringPtr("testString"), + CaptionI18n: make(map[string]string), + Type: core.StringPtr("testString"), + ThumbnailURL: core.StringPtr("testString"), + } - getConsumptionOfferingsOptions := &catalogmanagementv1.GetConsumptionOfferingsOptions{ - Digest: core.BoolPtr(true), - Catalog: core.StringPtr("testString"), - Select: core.StringPtr("all"), - IncludeHidden: core.BoolPtr(true), - Limit: core.Int64Ptr(int64(1000)), - Offset: core.Int64Ptr(int64(38)), - } + architectureDiagramModel := &catalogmanagementv1.ArchitectureDiagram{ + Diagram: mediaItemModel, + Description: core.StringPtr("testString"), + DescriptionI18n: make(map[string]string), + } - offeringSearchResult, response, err := catalogManagementService.GetConsumptionOfferings(getConsumptionOfferingsOptions) + costComponentModel := &catalogmanagementv1.CostComponent{ + Name: core.StringPtr("testString"), + Unit: core.StringPtr("testString"), + HourlyQuantity: core.StringPtr("testString"), + MonthlyQuantity: core.StringPtr("testString"), + Price: core.StringPtr("testString"), + HourlyCost: core.StringPtr("testString"), + MonthlyCost: core.StringPtr("testString"), + } - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(offeringSearchResult).ToNot(BeNil()) + costResourceModel := &catalogmanagementv1.CostResource{ + Name: core.StringPtr("testString"), + Metadata: make(map[string]interface{}), + HourlyCost: core.StringPtr("testString"), + MonthlyCost: core.StringPtr("testString"), + CostComponents: []catalogmanagementv1.CostComponent{*costComponentModel}, + } - }) - }) + costBreakdownModel := &catalogmanagementv1.CostBreakdown{ + TotalHourlyCost: core.StringPtr("testString"), + TotalMonthlyCOst: core.StringPtr("testString"), + Resources: []catalogmanagementv1.CostResource{*costResourceModel}, + } - Describe(`ListOfferings - Get list of offerings`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`ListOfferings(listOfferingsOptions *ListOfferingsOptions)`, func() { + costSummaryModel := &catalogmanagementv1.CostSummary{ + TotalDetectedResources: core.Int64Ptr(int64(38)), + TotalSupportedResources: core.Int64Ptr(int64(38)), + TotalUnsupportedResources: core.Int64Ptr(int64(38)), + TotalUsageBasedResources: core.Int64Ptr(int64(38)), + TotalNoPriceResources: core.Int64Ptr(int64(38)), + UnsupportedResourceCounts: make(map[string]int64), + NoPriceResourceCounts: make(map[string]int64), + } - listOfferingsOptions := &catalogmanagementv1.ListOfferingsOptions{ - CatalogIdentifier: core.StringPtr("testString"), - Digest: core.BoolPtr(true), - Limit: core.Int64Ptr(int64(1000)), - Offset: core.Int64Ptr(int64(38)), - Name: core.StringPtr("testString"), - Sort: core.StringPtr("testString"), - } + projectModel := &catalogmanagementv1.Project{ + Name: core.StringPtr("testString"), + Metadata: make(map[string]interface{}), + PastBreakdown: costBreakdownModel, + Breakdown: costBreakdownModel, + Diff: costBreakdownModel, + Summary: costSummaryModel, + } - offeringSearchResult, response, err := catalogManagementService.ListOfferings(listOfferingsOptions) + costEstimateModel := &catalogmanagementv1.CostEstimate{ + Version: core.StringPtr("testString"), + Currency: core.StringPtr("testString"), + Projects: []catalogmanagementv1.Project{*projectModel}, + Summary: costSummaryModel, + TotalHourlyCost: core.StringPtr("testString"), + TotalMonthlyCost: core.StringPtr("testString"), + PastTotalHourlyCost: core.StringPtr("testString"), + PastTotalMonthlyCost: core.StringPtr("testString"), + DiffTotalHourlyCost: core.StringPtr("testString"), + DiffTotalMonthlyCost: core.StringPtr("testString"), + TimeGenerated: CreateMockDateTime("2019-01-01T12:00:00.000Z"), + } - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(offeringSearchResult).ToNot(BeNil()) + dependencyModel := &catalogmanagementv1.Dependency{ + CatalogID: core.StringPtr("testString"), + ID: core.StringPtr("testString"), + Name: core.StringPtr("testString"), + Version: core.StringPtr("testString"), + Flavors: []string{"testString"}, + } - }) - }) + solutionInfoModel := &catalogmanagementv1.SolutionInfo{ + ArchitectureDiagrams: []catalogmanagementv1.ArchitectureDiagram{*architectureDiagramModel}, + Features: []catalogmanagementv1.Feature{*featureModel}, + CostEstimate: costEstimateModel, + Dependencies: []catalogmanagementv1.Dependency{*dependencyModel}, + } - Describe(`CreateOffering - Create offering`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`CreateOffering(createOfferingOptions *CreateOfferingOptions)`, func() { + versionModel := &catalogmanagementv1.Version{ + ID: &versionIDLink, + Rev: &versionRevLink, + CRN: core.StringPtr("testString"), + Version: core.StringPtr("1.0.0"), + Flavor: flavorModel, + Sha: core.StringPtr("testString"), + Created: CreateMockDateTime("2019-01-01T12:00:00.000Z"), + Updated: CreateMockDateTime("2019-01-01T12:00:00.000Z"), + OfferingID: &offeringIDLink, + CatalogID: &catalogIDLink, + KindID: core.StringPtr("testString"), + Tags: []string{"testString"}, + RepoURL: core.StringPtr("testString"), + SourceURL: core.StringPtr("testString"), + TgzURL: core.StringPtr(tgzURL), + Configuration: []catalogmanagementv1.Configuration{*configurationModel}, + Outputs: []catalogmanagementv1.Output{*outputModel}, + IamPermissions: []catalogmanagementv1.IamPermission{*iamPermissionModel}, + Metadata: make(map[string]interface{}), + Validation: validationModel, + RequiredResources: []catalogmanagementv1.Resource{*resourceModel}, + SingleInstance: core.BoolPtr(true), + Install: scriptModel, + PreInstall: []catalogmanagementv1.Script{*scriptModel}, + Entitlement: versionEntitlementModel, + Licenses: []catalogmanagementv1.License{*licenseModel}, + ImageManifestURL: core.StringPtr("testString"), + Deprecated: core.BoolPtr(true), + PackageVersion: core.StringPtr("testString"), + State: stateModel, + LongDescription: core.StringPtr("testString"), + LongDescriptionI18n: make(map[string]string), + WhitelistedAccounts: []string{"testString"}, + DeprecatePending: deprecatePendingModel, + SolutionInfo: solutionInfoModel, + IsConsumable: core.BoolPtr(true), + } - ratingModel := &catalogmanagementv1.Rating{ - OneStarCount: core.Int64Ptr(int64(38)), - TwoStarCount: core.Int64Ptr(int64(38)), - ThreeStarCount: core.Int64Ptr(int64(38)), - FourStarCount: core.Int64Ptr(int64(38)), - } + deploymentModel := &catalogmanagementv1.Deployment{ + ID: core.StringPtr("testString"), + Label: core.StringPtr("testString"), + Name: core.StringPtr("testString"), + ShortDescription: core.StringPtr("testString"), + LongDescription: core.StringPtr("testString"), + Metadata: make(map[string]interface{}), + Tags: []string{"testString"}, + Created: CreateMockDateTime("2019-01-01T12:00:00.000Z"), + Updated: CreateMockDateTime("2019-01-01T12:00:00.000Z"), + } - featureModel := &catalogmanagementv1.Feature{ - Title: core.StringPtr("testString"), - Description: core.StringPtr("testString"), - } + planModel := &catalogmanagementv1.Plan{ + ID: core.StringPtr("testString"), + Label: core.StringPtr("testString"), + Name: core.StringPtr("testString"), + ShortDescription: core.StringPtr("testString"), + LongDescription: core.StringPtr("testString"), + Metadata: make(map[string]interface{}), + Tags: []string{"testString"}, + AdditionalFeatures: []catalogmanagementv1.Feature{*featureModel}, + Created: CreateMockDateTime("2019-01-01T12:00:00.000Z"), + Updated: CreateMockDateTime("2019-01-01T12:00:00.000Z"), + Deployments: []catalogmanagementv1.Deployment{*deploymentModel}, + } - configurationModel := &catalogmanagementv1.Configuration{ - Key: core.StringPtr("testString"), - Type: core.StringPtr("testString"), - DefaultValue: core.StringPtr("testString"), - ValueConstraint: core.StringPtr("testString"), - Description: core.StringPtr("testString"), - Required: core.BoolPtr(true), - Options: []interface{}{"testString"}, - Hidden: core.BoolPtr(true), - } + kindModel := &catalogmanagementv1.Kind{ + ID: core.StringPtr("testString"), + FormatKind: core.StringPtr(formatKindTerraform), + InstallKind: core.StringPtr(installKindTerraform), + TargetKind: core.StringPtr(targetKindTerraform), + Metadata: make(map[string]interface{}), + Tags: []string{"testString"}, + AdditionalFeatures: []catalogmanagementv1.Feature{*featureModel}, + Created: CreateMockDateTime("2019-01-01T12:00:00.000Z"), + Updated: CreateMockDateTime("2019-01-01T12:00:00.000Z"), + Versions: []catalogmanagementv1.Version{*versionModel}, + Plans: []catalogmanagementv1.Plan{*planModel}, + } - validationModel := &catalogmanagementv1.Validation{ - Validated: CreateMockDateTime(), - Requested: CreateMockDateTime(), - State: core.StringPtr("testString"), - LastOperation: core.StringPtr("testString"), - Target: make(map[string]interface{}), - } + providerInfoModel := &catalogmanagementv1.ProviderInfo{ + ID: core.StringPtr("testString"), + Name: core.StringPtr("testString"), + } - resourceModel := &catalogmanagementv1.Resource{ - Type: core.StringPtr("mem"), - Value: core.StringPtr("testString"), - } + supportWaitTimeModel := &catalogmanagementv1.SupportWaitTime{ + Value: core.Int64Ptr(int64(38)), + Type: core.StringPtr("testString"), + } - scriptModel := &catalogmanagementv1.Script{ - Instructions: core.StringPtr("testString"), - Script: core.StringPtr("testString"), - ScriptPermission: core.StringPtr("testString"), - DeleteScript: core.StringPtr("testString"), - Scope: core.StringPtr("testString"), - } + supportTimeModel := &catalogmanagementv1.SupportTime{ + Day: core.Int64Ptr(int64(38)), + StartTime: core.StringPtr("testString"), + EndTime: core.StringPtr("testString"), + } - versionEntitlementModel := &catalogmanagementv1.VersionEntitlement{ - ProviderName: core.StringPtr("testString"), - ProviderID: core.StringPtr("testString"), - ProductID: core.StringPtr("testString"), - PartNumbers: []string{"testString"}, - ImageRepoName: core.StringPtr("testString"), - } + supportAvailabilityModel := &catalogmanagementv1.SupportAvailability{ + Times: []catalogmanagementv1.SupportTime{*supportTimeModel}, + Timezone: core.StringPtr("testString"), + AlwaysAvailable: core.BoolPtr(true), + } - licenseModel := &catalogmanagementv1.License{ - ID: core.StringPtr("testString"), - Name: core.StringPtr("testString"), - Type: core.StringPtr("testString"), - URL: core.StringPtr("testString"), - Description: core.StringPtr("testString"), - } + supportDetailModel := &catalogmanagementv1.SupportDetail{ + Type: core.StringPtr("testString"), + Contact: core.StringPtr("testString"), + ResponseWaitTime: supportWaitTimeModel, + Availability: supportAvailabilityModel, + } - stateModel := &catalogmanagementv1.State{ - Current: core.StringPtr("testString"), - CurrentEntered: CreateMockDateTime(), - Pending: core.StringPtr("testString"), - PendingRequested: CreateMockDateTime(), - Previous: core.StringPtr("testString"), - } + supportEscalationModel := &catalogmanagementv1.SupportEscalation{ + EscalationWaitTime: supportWaitTimeModel, + ResponseWaitTime: supportWaitTimeModel, + Contact: core.StringPtr("testString"), + } - versionModel := &catalogmanagementv1.Version{ - ID: core.StringPtr("testString"), - Rev: core.StringPtr("testString"), - CRN: core.StringPtr("testString"), - Version: core.StringPtr("testString"), - Sha: core.StringPtr("testString"), - Created: CreateMockDateTime(), - Updated: CreateMockDateTime(), - OfferingID: core.StringPtr("testString"), - CatalogID: core.StringPtr("testString"), - KindID: core.StringPtr("testString"), - Tags: []string{"testString"}, - RepoURL: core.StringPtr("testString"), - SourceURL: core.StringPtr("testString"), - TgzURL: core.StringPtr("testString"), - Configuration: []catalogmanagementv1.Configuration{*configurationModel}, - Metadata: make(map[string]interface{}), - Validation: validationModel, - RequiredResources: []catalogmanagementv1.Resource{*resourceModel}, - SingleInstance: core.BoolPtr(true), - Install: scriptModel, - PreInstall: []catalogmanagementv1.Script{*scriptModel}, - Entitlement: versionEntitlementModel, - Licenses: []catalogmanagementv1.License{*licenseModel}, - ImageManifestURL: core.StringPtr("testString"), - Deprecated: core.BoolPtr(true), - PackageVersion: core.StringPtr("testString"), - State: stateModel, - VersionLocator: core.StringPtr("testString"), - ConsoleURL: core.StringPtr("testString"), - LongDescription: core.StringPtr("testString"), - WhitelistedAccounts: []string{"testString"}, - } + supportModel := &catalogmanagementv1.Support{ + URL: core.StringPtr("testString"), + Process: core.StringPtr("testString"), + ProcessI18n: make(map[string]string), + Locations: []string{"testString"}, + SupportDetails: []catalogmanagementv1.SupportDetail{*supportDetailModel}, + SupportEscalation: supportEscalationModel, + SupportType: core.StringPtr("testString"), + } - deploymentModel := &catalogmanagementv1.Deployment{ - ID: core.StringPtr("testString"), - Label: core.StringPtr("testString"), - Name: core.StringPtr("testString"), - ShortDescription: core.StringPtr("testString"), - LongDescription: core.StringPtr("testString"), - Metadata: make(map[string]interface{}), - Tags: []string{"testString"}, - Created: CreateMockDateTime(), - Updated: CreateMockDateTime(), - } + learnMoreLinksModel := &catalogmanagementv1.LearnMoreLinks{ + FirstParty: core.StringPtr("testString"), + ThirdParty: core.StringPtr("testString"), + } - planModel := &catalogmanagementv1.Plan{ - ID: core.StringPtr("testString"), - Label: core.StringPtr("testString"), - Name: core.StringPtr("testString"), - ShortDescription: core.StringPtr("testString"), - LongDescription: core.StringPtr("testString"), - Metadata: make(map[string]interface{}), - Tags: []string{"testString"}, - AdditionalFeatures: []catalogmanagementv1.Feature{*featureModel}, - Created: CreateMockDateTime(), - Updated: CreateMockDateTime(), - Deployments: []catalogmanagementv1.Deployment{*deploymentModel}, - } + constraintModel := &catalogmanagementv1.Constraint{ + Type: core.StringPtr("testString"), + Rule: core.StringPtr("testString"), + } - kindModel := &catalogmanagementv1.Kind{ - ID: core.StringPtr("testString"), - FormatKind: core.StringPtr("testString"), - TargetKind: core.StringPtr("testString"), - Metadata: make(map[string]interface{}), - InstallDescription: core.StringPtr("testString"), - Tags: []string{"testString"}, - AdditionalFeatures: []catalogmanagementv1.Feature{*featureModel}, - Created: CreateMockDateTime(), - Updated: CreateMockDateTime(), - Versions: []catalogmanagementv1.Version{*versionModel}, - Plans: []catalogmanagementv1.Plan{*planModel}, - } + badgeModel := &catalogmanagementv1.Badge{ + ID: core.StringPtr("testString"), + Label: core.StringPtr("testString"), + LabelI18n: make(map[string]string), + Description: core.StringPtr("testString"), + DescriptionI18n: make(map[string]string), + Icon: core.StringPtr("testString"), + Authority: core.StringPtr("testString"), + Tag: core.StringPtr("testString"), + LearnMoreLinks: learnMoreLinksModel, + Constraints: []catalogmanagementv1.Constraint{*constraintModel}, + } - repoInfoModel := &catalogmanagementv1.RepoInfo{ - Token: core.StringPtr("testString"), - Type: core.StringPtr("testString"), - } + createOfferingOptions := &catalogmanagementv1.CreateOfferingOptions{ + CatalogIdentifier: &catalogIDLink, + ID: &offeringIDLink, + Rev: &offeringRevLink, + URL: core.StringPtr("testString"), + CRN: core.StringPtr("testString"), + Label: core.StringPtr("testString"), + LabelI18n: make(map[string]string), + Name: core.StringPtr("testString"), + OfferingIconURL: core.StringPtr("testString"), + OfferingDocsURL: core.StringPtr("testString"), + OfferingSupportURL: core.StringPtr("testString"), + Tags: []string{"testString"}, + Keywords: []string{"testString"}, + Rating: ratingModel, + Created: CreateMockDateTime("2019-01-01T12:00:00.000Z"), + Updated: CreateMockDateTime("2019-01-01T12:00:00.000Z"), + ShortDescription: core.StringPtr("testString"), + ShortDescriptionI18n: make(map[string]string), + LongDescription: core.StringPtr("testString"), + LongDescriptionI18n: make(map[string]string), + Features: []catalogmanagementv1.Feature{*featureModel}, + Kinds: []catalogmanagementv1.Kind{*kindModel}, + PcManaged: core.BoolPtr(true), + PublishApproved: core.BoolPtr(true), + ShareWithAll: core.BoolPtr(true), + ShareWithIBM: core.BoolPtr(true), + ShareEnabled: core.BoolPtr(true), + PermitRequestIBMPublicPublish: core.BoolPtr(true), + IBMPublishApproved: core.BoolPtr(true), + PublicPublishApproved: core.BoolPtr(true), + PublicOriginalCRN: core.StringPtr("testString"), + PublishPublicCRN: core.StringPtr("testString"), + PortalApprovalRecord: core.StringPtr("testString"), + PortalUIURL: core.StringPtr("testString"), + CatalogID: &catalogIDLink, + CatalogName: core.StringPtr("testString"), + Metadata: make(map[string]interface{}), + Disclaimer: core.StringPtr("testString"), + Hidden: core.BoolPtr(true), + Provider: core.StringPtr("testString"), + ProviderInfo: providerInfoModel, + Support: supportModel, + Media: []catalogmanagementv1.MediaItem{*mediaItemModel}, + DeprecatePending: deprecatePendingModel, + ProductKind: core.StringPtr("solution"), + Badges: []catalogmanagementv1.Badge{*badgeModel}, + } - createOfferingOptions := &catalogmanagementv1.CreateOfferingOptions{ - CatalogIdentifier: core.StringPtr("testString"), - ID: core.StringPtr("testString"), - Rev: core.StringPtr("testString"), - URL: core.StringPtr("testString"), - CRN: core.StringPtr("testString"), - Label: core.StringPtr("testString"), - Name: core.StringPtr("testString"), - OfferingIconURL: core.StringPtr("testString"), - OfferingDocsURL: core.StringPtr("testString"), - OfferingSupportURL: core.StringPtr("testString"), - Tags: []string{"testString"}, - Rating: ratingModel, - Created: CreateMockDateTime(), - Updated: CreateMockDateTime(), - ShortDescription: core.StringPtr("testString"), - LongDescription: core.StringPtr("testString"), - Features: []catalogmanagementv1.Feature{*featureModel}, - Kinds: []catalogmanagementv1.Kind{*kindModel}, - PermitRequestIBMPublicPublish: core.BoolPtr(true), - IBMPublishApproved: core.BoolPtr(true), - PublicPublishApproved: core.BoolPtr(true), - PublicOriginalCRN: core.StringPtr("testString"), - PublishPublicCRN: core.StringPtr("testString"), - PortalApprovalRecord: core.StringPtr("testString"), - PortalUIURL: core.StringPtr("testString"), - CatalogID: core.StringPtr("testString"), - CatalogName: core.StringPtr("testString"), - Metadata: make(map[string]interface{}), - Disclaimer: core.StringPtr("testString"), - Hidden: core.BoolPtr(true), - Provider: core.StringPtr("testString"), - RepoInfo: repoInfoModel, - } + offering, response, err := catalogManagementService.CreateOffering(createOfferingOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(201)) + Expect(offering).ToNot(BeNil()) - offering, response, err := catalogManagementService.CreateOffering(createOfferingOptions) + offeringIDLink = *offering.ID + fmt.Fprintf(GinkgoWriter, "Saved offeringIDLink value: %v\n", offeringIDLink) + offeringRevLink = *offering.Rev + fmt.Fprintf(GinkgoWriter, "Saved offeringRevLink value: %v\n", offeringRevLink) + versionLocatorLink = *offering.Kinds[0].Versions[0].VersionLocator + fmt.Fprintf(GinkgoWriter, "Saved versionLocatorLink value: %v\n", versionLocatorLink) + versionIDLink = *offering.Kinds[0].Versions[0].VersionLocator + fmt.Fprintf(GinkgoWriter, "Saved versionIDLink value: %v\n", versionIDLink) + versionRevLink = *offering.Kinds[0].Versions[0].Rev + fmt.Fprintf(GinkgoWriter, "Saved versionRevLink value: %v\n", versionRevLink) + }) + }) - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(201)) - Expect(offering).ToNot(BeNil()) - - }) - }) - - Describe(`ImportOfferingVersion - Import offering version`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`ImportOfferingVersion(importOfferingVersionOptions *ImportOfferingVersionOptions)`, func() { - - importOfferingVersionOptions := &catalogmanagementv1.ImportOfferingVersionOptions{ - CatalogIdentifier: core.StringPtr("testString"), - OfferingID: core.StringPtr("testString"), - Tags: []string{"testString"}, - TargetKinds: []string{"testString"}, - Content: CreateMockByteArray("This is a mock byte array value."), - Zipurl: core.StringPtr("testString"), - TargetVersion: core.StringPtr("testString"), - IncludeConfig: core.BoolPtr(true), - RepoType: core.StringPtr("testString"), - } + Describe(`ImportOfferingVersion - Import offering version`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`ImportOfferingVersion(importOfferingVersionOptions *ImportOfferingVersionOptions)`, func() { + flavorModel := &catalogmanagementv1.Flavor{ + Name: core.StringPtr("testString"), + Label: core.StringPtr("testString"), + LabelI18n: make(map[string]string), + Index: core.Int64Ptr(int64(38)), + } - offering, response, err := catalogManagementService.ImportOfferingVersion(importOfferingVersionOptions) + importOfferingVersionOptions := &catalogmanagementv1.ImportOfferingVersionOptions{ + CatalogIdentifier: &catalogIDLink, + OfferingID: &offeringIDLink, + Tags: []string{"testString"}, + Name: core.StringPtr("testString"), + Label: core.StringPtr("testString"), + InstallKind: core.StringPtr(installKindTerraform), + TargetKinds: []string{targetKindTerraform}, + FormatKind: core.StringPtr(formatKindTerraform), + ProductKind: core.StringPtr("solution"), + Flavor: flavorModel, + Zipurl: core.StringPtr(tgzURL), + TargetVersion: core.StringPtr("1.0.1"), + } - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(201)) - Expect(offering).ToNot(BeNil()) + offering, response, err := catalogManagementService.ImportOfferingVersion(importOfferingVersionOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(201)) + Expect(offering).ToNot(BeNil()) - }) + offeringIDLink = *offering.ID + fmt.Fprintf(GinkgoWriter, "Saved offeringIDLink value: %v\n", offeringIDLink) + offeringRevLink = *offering.Rev + fmt.Fprintf(GinkgoWriter, "Saved offeringRevLink value: %v\n", offeringRevLink) + versionLocatorLink = *offering.Kinds[0].Versions[0].VersionLocator + fmt.Fprintf(GinkgoWriter, "Saved versionLocatorLink value: %v\n", versionLocatorLink) + versionIDLink = *offering.Kinds[0].Versions[0].VersionLocator + fmt.Fprintf(GinkgoWriter, "Saved versionIDLink value: %v\n", versionIDLink) + versionRevLink = *offering.Kinds[0].Versions[0].Rev + fmt.Fprintf(GinkgoWriter, "Saved versionRevLink value: %v\n", versionRevLink) }) - */ + }) + Describe(`ImportOffering - Import offering`, func() { BeforeEach(func() { shouldSkipTest() }) It(`ImportOffering(importOfferingOptions *ImportOfferingOptions)`, func() { - Expect(testCatalogID).ToNot(BeEmpty()) - - const ( - expectedOfferingName = "node-red-operator-certified" - expectedOfferingLabel = "Node-RED Operator" - expectedOfferingTargetKind = "roks" - expectedOfferingVersion = "0.0.2" - expectedOfferingVersions = 1 - expectedOfferingKinds = 1 - expectedOfferingShortDesc = "Node-RED is a programming tool for wiring together hardware devices, APIs and online services in new and interesting ways." - expectedOfferingURL = "https://cm.globalcatalog.test.cloud.ibm.com/api/v1-beta/catalogs/%s/offerings/%s" - expectedOfferingZipURL = "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" - ) - offeringOptions := catalogManagementService.NewImportOfferingOptions(testCatalogID) - offeringOptions.SetZipurl(expectedOfferingZipURL) - offeringOptions.SetXAuthToken(gitToken) - offeringOptions.SetTargetKinds([]string{"roks"}) - offeringOptions.SetTargetVersion("0.0.2") - offeringOptions.SetRepoType("public_git") - offering, response, err := catalogManagementService.ImportOffering(offeringOptions) + flavorModel := &catalogmanagementv1.Flavor{ + Name: core.StringPtr("testString"), + Label: core.StringPtr("testString"), + LabelI18n: make(map[string]string), + Index: core.Int64Ptr(int64(38)), + } + + importOfferingOptions := &catalogmanagementv1.ImportOfferingOptions{ + CatalogIdentifier: &catalogIDLink, + Tags: []string{"testString"}, + Name: core.StringPtr("testString"), + Label: core.StringPtr("testString"), + InstallKind: core.StringPtr(installKindTerraform), + TargetKinds: []string{targetKindTerraform}, + FormatKind: core.StringPtr(formatKindTerraform), + ProductKind: core.StringPtr("solution"), + Version: core.StringPtr("1.0.2"), + Flavor: flavorModel, + Zipurl: core.StringPtr(tgzURL), + OfferingID: &offeringIDLink, + TargetVersion: core.StringPtr("1.1.0"), + } + offering, response, err := catalogManagementService.ImportOffering(importOfferingOptions) Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(201)) Expect(offering).ToNot(BeNil()) - fmt.Fprintf(GinkgoWriter, "ImportOffering() result:\n%s\n", common.ToJSON(offering)) - Expect(offering.ID).ToNot(BeNil()) - testOfferingID = *offering.ID + offeringRevLink = *offering.Rev + fmt.Fprintf(GinkgoWriter, "Saved offeringRevLink value: %v\n", offeringRevLink) + versionLocatorLink = *offering.Kinds[0].Versions[0].VersionLocator + fmt.Fprintf(GinkgoWriter, "Saved versionLocatorLink value: %v\n", versionLocatorLink) + }) + }) - Expect(response.StatusCode).To(Equal(201)) - Expect(*offering.Name).To(Equal(expectedOfferingName)) - Expect(*offering.URL).To(Equal(fmt.Sprintf(expectedOfferingURL, testCatalogID, testOfferingID))) - Expect(*offering.Label).To(Equal(expectedOfferingLabel)) - Expect(*offering.ShortDescription).To(Equal(expectedOfferingShortDesc)) - Expect(*offering.CatalogName).To(Equal(expectedLabel)) - Expect(*offering.CatalogID).To(Equal(testCatalogID)) - Expect(len(offering.Kinds)).To(Equal(expectedOfferingKinds)) - Expect(*offering.Kinds[0].TargetKind).To(Equal(expectedOfferingTargetKind)) - Expect(len(offering.Kinds[0].Versions)).To(Equal(expectedOfferingVersions)) - Expect(*offering.Kinds[0].Versions[0].Version).To(Equal(expectedOfferingVersion)) - Expect(*offering.Kinds[0].Versions[0].TgzURL).To(Equal(expectedOfferingZipURL)) - }) - }) - /* - Describe(`ReloadOffering - Reload offering`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`ReloadOffering(reloadOfferingOptions *ReloadOfferingOptions)`, func() { - - reloadOfferingOptions := &catalogmanagementv1.ReloadOfferingOptions{ - CatalogIdentifier: core.StringPtr("testString"), - OfferingID: core.StringPtr("testString"), - TargetVersion: core.StringPtr("testString"), - Tags: []string{"testString"}, - TargetKinds: []string{"testString"}, - Content: CreateMockByteArray("This is a mock byte array value."), - Zipurl: core.StringPtr("testString"), - RepoType: core.StringPtr("testString"), - } + Describe(`ReloadOffering - Reload offering`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`ReloadOffering(reloadOfferingOptions *ReloadOfferingOptions)`, func() { + flavorModel := &catalogmanagementv1.Flavor{ + Name: core.StringPtr("testString"), + Label: core.StringPtr("testString"), + LabelI18n: make(map[string]string), + Index: core.Int64Ptr(int64(38)), + } - offering, response, err := catalogManagementService.ReloadOffering(reloadOfferingOptions) + reloadOfferingOptions := &catalogmanagementv1.ReloadOfferingOptions{ + CatalogIdentifier: &catalogIDLink, + OfferingID: &offeringIDLink, + TargetVersion: core.StringPtr("1.0.1"), + Tags: []string{"testString"}, + TargetKinds: []string{targetKindTerraform}, + FormatKind: core.StringPtr(formatKindTerraform), + Flavor: flavorModel, + Zipurl: core.StringPtr(tgzURL), + } - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(201)) - Expect(offering).ToNot(BeNil()) + offering, response, err := catalogManagementService.ReloadOffering(reloadOfferingOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(offering).ToNot(BeNil()) - }) + offeringRevLink = *offering.Rev + fmt.Fprintf(GinkgoWriter, "Saved offeringRevLink value: %v\n", offeringRevLink) }) + }) - Describe(`GetOffering - Get offering`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`GetOffering(getOfferingOptions *GetOfferingOptions)`, func() { - - getOfferingOptions := &catalogmanagementv1.GetOfferingOptions{ - CatalogIdentifier: core.StringPtr("testString"), - OfferingID: core.StringPtr("testString"), - } + Describe(`GetOffering - Get offering`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`GetOffering(getOfferingOptions *GetOfferingOptions)`, func() { + getOfferingOptions := &catalogmanagementv1.GetOfferingOptions{ + CatalogIdentifier: &catalogIDLink, + OfferingID: &offeringIDLink, + Type: core.StringPtr("id"), + Digest: core.BoolPtr(false), + } - offering, response, err := catalogManagementService.GetOffering(getOfferingOptions) + offering, response, err := catalogManagementService.GetOffering(getOfferingOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(offering).ToNot(BeNil()) - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(offering).ToNot(BeNil()) + offeringRevLink = *offering.Rev + fmt.Fprintf(GinkgoWriter, "Saved offeringRevLink value: %v\n", offeringRevLink) + versionLocatorLink = *offering.Kinds[0].Versions[0].VersionLocator + fmt.Fprintf(GinkgoWriter, "Saved versionLocatorLink value: %v\n", versionLocatorLink) + versionIDLink = *offering.Kinds[0].Versions[0].VersionLocator + fmt.Fprintf(GinkgoWriter, "Saved versionIDLink value: %v\n", versionIDLink) + versionRevLink = *offering.Kinds[0].Versions[0].Rev + fmt.Fprintf(GinkgoWriter, "Saved versionRevLink value: %v\n", versionRevLink) + }) + }) - }) + Describe(`UpdateOffering - Update offering`, func() { + BeforeEach(func() { + shouldSkipTest() }) + It(`UpdateOffering(updateOfferingOptions *UpdateOfferingOptions)`, func() { + jsonPatchOperationModel := &catalogmanagementv1.JSONPatchOperation{ + Op: core.StringPtr("add"), + Path: core.StringPtr("/tags/-"), + Value: core.StringPtr("dev_ops"), + } - Describe(`ReplaceOffering - Update offering`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`ReplaceOffering(replaceOfferingOptions *ReplaceOfferingOptions)`, func() { + updateOfferingOptions := &catalogmanagementv1.UpdateOfferingOptions{ + CatalogIdentifier: &catalogIDLink, + OfferingID: &offeringIDLink, + IfMatch: core.StringPtr(fmt.Sprintf("\"%s\"", offeringRevLink)), + Updates: []catalogmanagementv1.JSONPatchOperation{*jsonPatchOperationModel}, + } - ratingModel := &catalogmanagementv1.Rating{ - OneStarCount: core.Int64Ptr(int64(38)), - TwoStarCount: core.Int64Ptr(int64(38)), - ThreeStarCount: core.Int64Ptr(int64(38)), - FourStarCount: core.Int64Ptr(int64(38)), - } + offering, response, err := catalogManagementService.UpdateOffering(updateOfferingOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(offering).ToNot(BeNil()) - featureModel := &catalogmanagementv1.Feature{ - Title: core.StringPtr("testString"), - Description: core.StringPtr("testString"), - } + offeringRevLink = *offering.Rev + fmt.Fprintf(GinkgoWriter, "Saved offeringRevLink value: %v\n", offeringRevLink) + }) + }) - configurationModel := &catalogmanagementv1.Configuration{ - Key: core.StringPtr("testString"), - Type: core.StringPtr("testString"), - DefaultValue: core.StringPtr("testString"), - ValueConstraint: core.StringPtr("testString"), - Description: core.StringPtr("testString"), - Required: core.BoolPtr(true), - Options: []interface{}{"testString"}, - Hidden: core.BoolPtr(true), - } + Describe(`ReplaceOffering - Update offering`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`ReplaceOffering(replaceOfferingOptions *ReplaceOfferingOptions)`, func() { + //Skip("") + ratingModel := &catalogmanagementv1.Rating{ + OneStarCount: core.Int64Ptr(int64(38)), + TwoStarCount: core.Int64Ptr(int64(38)), + ThreeStarCount: core.Int64Ptr(int64(38)), + FourStarCount: core.Int64Ptr(int64(38)), + } - validationModel := &catalogmanagementv1.Validation{ - Validated: CreateMockDateTime(), - Requested: CreateMockDateTime(), - State: core.StringPtr("testString"), - LastOperation: core.StringPtr("testString"), - Target: make(map[string]interface{}), - } + featureModel := &catalogmanagementv1.Feature{ + Title: core.StringPtr("testString"), + TitleI18n: make(map[string]string), + Description: core.StringPtr("testString"), + DescriptionI18n: make(map[string]string), + } - resourceModel := &catalogmanagementv1.Resource{ - Type: core.StringPtr("mem"), - Value: core.StringPtr("testString"), - } + flavorModel := &catalogmanagementv1.Flavor{ + Name: core.StringPtr("testString"), + Label: core.StringPtr("testString"), + LabelI18n: make(map[string]string), + Index: core.Int64Ptr(int64(38)), + } - scriptModel := &catalogmanagementv1.Script{ - Instructions: core.StringPtr("testString"), - Script: core.StringPtr("testString"), - ScriptPermission: core.StringPtr("testString"), - DeleteScript: core.StringPtr("testString"), - Scope: core.StringPtr("testString"), - } + renderTypeAssociationsParametersItemModel := &catalogmanagementv1.RenderTypeAssociationsParametersItem{ + Name: core.StringPtr("testString"), + OptionsRefresh: core.BoolPtr(true), + } - versionEntitlementModel := &catalogmanagementv1.VersionEntitlement{ - ProviderName: core.StringPtr("testString"), - ProviderID: core.StringPtr("testString"), - ProductID: core.StringPtr("testString"), - PartNumbers: []string{"testString"}, - ImageRepoName: core.StringPtr("testString"), - } + renderTypeAssociationsModel := &catalogmanagementv1.RenderTypeAssociations{ + Parameters: []catalogmanagementv1.RenderTypeAssociationsParametersItem{*renderTypeAssociationsParametersItemModel}, + } - licenseModel := &catalogmanagementv1.License{ - ID: core.StringPtr("testString"), - Name: core.StringPtr("testString"), - Type: core.StringPtr("testString"), - URL: core.StringPtr("testString"), - Description: core.StringPtr("testString"), - } + renderTypeModel := &catalogmanagementv1.RenderType{ + Type: core.StringPtr("testString"), + Grouping: core.StringPtr("testString"), + OriginalGrouping: core.StringPtr("testString"), + GroupingIndex: core.Int64Ptr(int64(38)), + ConfigConstraints: map[string]interface{}{"anyKey": "anyValue"}, + Associations: renderTypeAssociationsModel, + } - stateModel := &catalogmanagementv1.State{ - Current: core.StringPtr("testString"), - CurrentEntered: CreateMockDateTime(), - Pending: core.StringPtr("testString"), - PendingRequested: CreateMockDateTime(), - Previous: core.StringPtr("testString"), - } + configurationModel := &catalogmanagementv1.Configuration{ + Key: core.StringPtr("testString"), + Type: core.StringPtr("testString"), + DefaultValue: core.StringPtr("testString"), + DisplayName: core.StringPtr("testString"), + ValueConstraint: core.StringPtr("testString"), + Description: core.StringPtr("testString"), + Required: core.BoolPtr(true), + Options: []interface{}{"testString"}, + Hidden: core.BoolPtr(true), + CustomConfig: renderTypeModel, + TypeMetadata: core.StringPtr("testString"), + } - versionModel := &catalogmanagementv1.Version{ - ID: core.StringPtr("testString"), - Rev: core.StringPtr("testString"), - CRN: core.StringPtr("testString"), - Version: core.StringPtr("testString"), - Sha: core.StringPtr("testString"), - Created: CreateMockDateTime(), - Updated: CreateMockDateTime(), - OfferingID: core.StringPtr("testString"), - CatalogID: core.StringPtr("testString"), - KindID: core.StringPtr("testString"), - Tags: []string{"testString"}, - RepoURL: core.StringPtr("testString"), - SourceURL: core.StringPtr("testString"), - TgzURL: core.StringPtr("testString"), - Configuration: []catalogmanagementv1.Configuration{*configurationModel}, - Metadata: make(map[string]interface{}), - Validation: validationModel, - RequiredResources: []catalogmanagementv1.Resource{*resourceModel}, - SingleInstance: core.BoolPtr(true), - Install: scriptModel, - PreInstall: []catalogmanagementv1.Script{*scriptModel}, - Entitlement: versionEntitlementModel, - Licenses: []catalogmanagementv1.License{*licenseModel}, - ImageManifestURL: core.StringPtr("testString"), - Deprecated: core.BoolPtr(true), - PackageVersion: core.StringPtr("testString"), - State: stateModel, - VersionLocator: core.StringPtr("testString"), - ConsoleURL: core.StringPtr("testString"), - LongDescription: core.StringPtr("testString"), - WhitelistedAccounts: []string{"testString"}, - } + outputModel := &catalogmanagementv1.Output{ + Key: core.StringPtr("testString"), + Description: core.StringPtr("testString"), + } - deploymentModel := &catalogmanagementv1.Deployment{ - ID: core.StringPtr("testString"), - Label: core.StringPtr("testString"), - Name: core.StringPtr("testString"), - ShortDescription: core.StringPtr("testString"), - LongDescription: core.StringPtr("testString"), - Metadata: make(map[string]interface{}), - Tags: []string{"testString"}, - Created: CreateMockDateTime(), - Updated: CreateMockDateTime(), - } + iamResourceModel := &catalogmanagementv1.IamResource{ + Name: core.StringPtr("testString"), + Description: core.StringPtr("testString"), + RoleCrns: []string{"testString"}, + } - planModel := &catalogmanagementv1.Plan{ - ID: core.StringPtr("testString"), - Label: core.StringPtr("testString"), - Name: core.StringPtr("testString"), - ShortDescription: core.StringPtr("testString"), - LongDescription: core.StringPtr("testString"), - Metadata: make(map[string]interface{}), - Tags: []string{"testString"}, - AdditionalFeatures: []catalogmanagementv1.Feature{*featureModel}, - Created: CreateMockDateTime(), - Updated: CreateMockDateTime(), - Deployments: []catalogmanagementv1.Deployment{*deploymentModel}, - } + iamPermissionModel := &catalogmanagementv1.IamPermission{ + ServiceName: core.StringPtr("testString"), + RoleCrns: []string{"testString"}, + Resources: []catalogmanagementv1.IamResource{*iamResourceModel}, + } - kindModel := &catalogmanagementv1.Kind{ - ID: core.StringPtr("testString"), - FormatKind: core.StringPtr("testString"), - TargetKind: core.StringPtr("testString"), - Metadata: make(map[string]interface{}), - InstallDescription: core.StringPtr("testString"), - Tags: []string{"testString"}, - AdditionalFeatures: []catalogmanagementv1.Feature{*featureModel}, - Created: CreateMockDateTime(), - Updated: CreateMockDateTime(), - Versions: []catalogmanagementv1.Version{*versionModel}, - Plans: []catalogmanagementv1.Plan{*planModel}, - } + validationModel := &catalogmanagementv1.Validation{ + Validated: CreateMockDateTime("2019-01-01T12:00:00.000Z"), + Requested: CreateMockDateTime("2019-01-01T12:00:00.000Z"), + State: core.StringPtr("testString"), + LastOperation: core.StringPtr("testString"), + Target: make(map[string]interface{}), + Message: core.StringPtr("testString"), + } - repoInfoModel := &catalogmanagementv1.RepoInfo{ - Token: core.StringPtr("testString"), - Type: core.StringPtr("testString"), - } + resourceModel := &catalogmanagementv1.Resource{ + Type: core.StringPtr("mem"), + Value: core.StringPtr("testString"), + } - replaceOfferingOptions := &catalogmanagementv1.ReplaceOfferingOptions{ - CatalogIdentifier: core.StringPtr("testString"), - OfferingID: core.StringPtr("testString"), - ID: core.StringPtr("testString"), - Rev: core.StringPtr("testString"), - URL: core.StringPtr("testString"), - CRN: core.StringPtr("testString"), - Label: core.StringPtr("testString"), - Name: core.StringPtr("testString"), - OfferingIconURL: core.StringPtr("testString"), - OfferingDocsURL: core.StringPtr("testString"), - OfferingSupportURL: core.StringPtr("testString"), - Tags: []string{"testString"}, - Rating: ratingModel, - Created: CreateMockDateTime(), - Updated: CreateMockDateTime(), - ShortDescription: core.StringPtr("testString"), - LongDescription: core.StringPtr("testString"), - Features: []catalogmanagementv1.Feature{*featureModel}, - Kinds: []catalogmanagementv1.Kind{*kindModel}, - PermitRequestIBMPublicPublish: core.BoolPtr(true), - IBMPublishApproved: core.BoolPtr(true), - PublicPublishApproved: core.BoolPtr(true), - PublicOriginalCRN: core.StringPtr("testString"), - PublishPublicCRN: core.StringPtr("testString"), - PortalApprovalRecord: core.StringPtr("testString"), - PortalUIURL: core.StringPtr("testString"), - CatalogID: core.StringPtr("testString"), - CatalogName: core.StringPtr("testString"), - Metadata: make(map[string]interface{}), - Disclaimer: core.StringPtr("testString"), - Hidden: core.BoolPtr(true), - Provider: core.StringPtr("testString"), - RepoInfo: repoInfoModel, - } + scriptModel := &catalogmanagementv1.Script{ + Instructions: core.StringPtr("testString"), + InstructionsI18n: make(map[string]string), + Script: core.StringPtr("testString"), + ScriptPermission: core.StringPtr("testString"), + DeleteScript: core.StringPtr("testString"), + Scope: core.StringPtr("testString"), + } - offering, response, err := catalogManagementService.ReplaceOffering(replaceOfferingOptions) + versionEntitlementModel := &catalogmanagementv1.VersionEntitlement{ + ProviderName: core.StringPtr("testString"), + ProviderID: core.StringPtr("testString"), + ProductID: core.StringPtr("testString"), + PartNumbers: []string{"testString"}, + ImageRepoName: core.StringPtr("testString"), + } - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(offering).ToNot(BeNil()) + licenseModel := &catalogmanagementv1.License{ + ID: core.StringPtr("testString"), + Name: core.StringPtr("testString"), + Type: core.StringPtr("testString"), + URL: core.StringPtr("testString"), + Description: core.StringPtr("testString"), + } - }) - }) + stateModel := &catalogmanagementv1.State{ + Current: core.StringPtr("testString"), + CurrentEntered: CreateMockDateTime("2019-01-01T12:00:00.000Z"), + Pending: core.StringPtr("testString"), + PendingRequested: CreateMockDateTime("2019-01-01T12:00:00.000Z"), + Previous: core.StringPtr("testString"), + } - Describe(`GetOfferingAudit - Get offering audit log`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`GetOfferingAudit(getOfferingAuditOptions *GetOfferingAuditOptions)`, func() { + deprecatePendingModel := &catalogmanagementv1.DeprecatePending{ + DeprecateDate: CreateMockDateTime("2019-01-01T12:00:00.000Z"), + DeprecateState: core.StringPtr("testString"), + Description: core.StringPtr("testString"), + } - getOfferingAuditOptions := &catalogmanagementv1.GetOfferingAuditOptions{ - CatalogIdentifier: core.StringPtr("testString"), - OfferingID: core.StringPtr("testString"), - } + mediaItemModel := &catalogmanagementv1.MediaItem{ + URL: core.StringPtr("testString"), + APIURL: core.StringPtr("testString"), + Caption: core.StringPtr("testString"), + CaptionI18n: make(map[string]string), + Type: core.StringPtr("testString"), + ThumbnailURL: core.StringPtr("testString"), + } - auditLog, response, err := catalogManagementService.GetOfferingAudit(getOfferingAuditOptions) + architectureDiagramModel := &catalogmanagementv1.ArchitectureDiagram{ + Diagram: mediaItemModel, + Description: core.StringPtr("testString"), + DescriptionI18n: make(map[string]string), + } - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(auditLog).ToNot(BeNil()) + costComponentModel := &catalogmanagementv1.CostComponent{ + Name: core.StringPtr("testString"), + Unit: core.StringPtr("testString"), + HourlyQuantity: core.StringPtr("testString"), + MonthlyQuantity: core.StringPtr("testString"), + Price: core.StringPtr("testString"), + HourlyCost: core.StringPtr("testString"), + MonthlyCost: core.StringPtr("testString"), + } - }) - }) + costResourceModel := &catalogmanagementv1.CostResource{ + Name: core.StringPtr("testString"), + Metadata: make(map[string]interface{}), + HourlyCost: core.StringPtr("testString"), + MonthlyCost: core.StringPtr("testString"), + CostComponents: []catalogmanagementv1.CostComponent{*costComponentModel}, + } - Describe(`ReplaceOfferingIcon - Upload icon for offering`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`ReplaceOfferingIcon(replaceOfferingIconOptions *ReplaceOfferingIconOptions)`, func() { + costBreakdownModel := &catalogmanagementv1.CostBreakdown{ + TotalHourlyCost: core.StringPtr("testString"), + TotalMonthlyCOst: core.StringPtr("testString"), + Resources: []catalogmanagementv1.CostResource{*costResourceModel}, + } - replaceOfferingIconOptions := &catalogmanagementv1.ReplaceOfferingIconOptions{ - CatalogIdentifier: core.StringPtr("testString"), - OfferingID: core.StringPtr("testString"), - FileName: core.StringPtr("testString"), - } + costSummaryModel := &catalogmanagementv1.CostSummary{ + TotalDetectedResources: core.Int64Ptr(int64(38)), + TotalSupportedResources: core.Int64Ptr(int64(38)), + TotalUnsupportedResources: core.Int64Ptr(int64(38)), + TotalUsageBasedResources: core.Int64Ptr(int64(38)), + TotalNoPriceResources: core.Int64Ptr(int64(38)), + UnsupportedResourceCounts: make(map[string]int64), + NoPriceResourceCounts: make(map[string]int64), + } - offering, response, err := catalogManagementService.ReplaceOfferingIcon(replaceOfferingIconOptions) + projectModel := &catalogmanagementv1.Project{ + Name: core.StringPtr("testString"), + Metadata: make(map[string]interface{}), + PastBreakdown: costBreakdownModel, + Breakdown: costBreakdownModel, + Diff: costBreakdownModel, + Summary: costSummaryModel, + } - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(offering).ToNot(BeNil()) + costEstimateModel := &catalogmanagementv1.CostEstimate{ + Version: core.StringPtr("testString"), + Currency: core.StringPtr("testString"), + Projects: []catalogmanagementv1.Project{*projectModel}, + Summary: costSummaryModel, + TotalHourlyCost: core.StringPtr("testString"), + TotalMonthlyCost: core.StringPtr("testString"), + PastTotalHourlyCost: core.StringPtr("testString"), + PastTotalMonthlyCost: core.StringPtr("testString"), + DiffTotalHourlyCost: core.StringPtr("testString"), + DiffTotalMonthlyCost: core.StringPtr("testString"), + TimeGenerated: CreateMockDateTime("2019-01-01T12:00:00.000Z"), + } - }) - }) + dependencyModel := &catalogmanagementv1.Dependency{ + CatalogID: core.StringPtr("testString"), + ID: core.StringPtr("testString"), + Name: core.StringPtr("testString"), + Version: core.StringPtr("testString"), + Flavors: []string{"testString"}, + } - Describe(`UpdateOfferingIBM - Allow offering to be published`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`UpdateOfferingIBM(updateOfferingIBMOptions *UpdateOfferingIBMOptions)`, func() { + solutionInfoModel := &catalogmanagementv1.SolutionInfo{ + ArchitectureDiagrams: []catalogmanagementv1.ArchitectureDiagram{*architectureDiagramModel}, + Features: []catalogmanagementv1.Feature{*featureModel}, + CostEstimate: costEstimateModel, + Dependencies: []catalogmanagementv1.Dependency{*dependencyModel}, + } - updateOfferingIBMOptions := &catalogmanagementv1.UpdateOfferingIBMOptions{ - CatalogIdentifier: core.StringPtr("testString"), - OfferingID: core.StringPtr("testString"), - ApprovalType: core.StringPtr("allow_request"), - Approved: core.StringPtr("true"), - } + versionModel := &catalogmanagementv1.Version{ + //ID: &versionIDLink, + //Rev: &versionRevLink, + CRN: core.StringPtr("testString"), + Version: core.StringPtr("1.0.0"), + Flavor: flavorModel, + Sha: core.StringPtr("testString"), + Created: CreateMockDateTime("2019-01-01T12:00:00.000Z"), + Updated: CreateMockDateTime("2019-01-01T12:00:00.000Z"), + OfferingID: &offeringIDLink, + CatalogID: &catalogIDLink, + KindID: core.StringPtr("testString"), + Tags: []string{"testString"}, + RepoURL: core.StringPtr("testString"), + SourceURL: core.StringPtr("testString"), + TgzURL: core.StringPtr(tgzURL), + Configuration: []catalogmanagementv1.Configuration{*configurationModel}, + Outputs: []catalogmanagementv1.Output{*outputModel}, + IamPermissions: []catalogmanagementv1.IamPermission{*iamPermissionModel}, + Metadata: make(map[string]interface{}), + Validation: validationModel, + RequiredResources: []catalogmanagementv1.Resource{*resourceModel}, + SingleInstance: core.BoolPtr(true), + Install: scriptModel, + PreInstall: []catalogmanagementv1.Script{*scriptModel}, + Entitlement: versionEntitlementModel, + Licenses: []catalogmanagementv1.License{*licenseModel}, + ImageManifestURL: core.StringPtr("testString"), + Deprecated: core.BoolPtr(true), + PackageVersion: core.StringPtr("testString"), + State: stateModel, + VersionLocator: &versionLocatorLink, + LongDescription: core.StringPtr("testString"), + LongDescriptionI18n: make(map[string]string), + WhitelistedAccounts: []string{"testString"}, + DeprecatePending: deprecatePendingModel, + SolutionInfo: solutionInfoModel, + IsConsumable: core.BoolPtr(true), + } - approvalResult, response, err := catalogManagementService.UpdateOfferingIBM(updateOfferingIBMOptions) + deploymentModel := &catalogmanagementv1.Deployment{ + ID: core.StringPtr("testString"), + Label: core.StringPtr("testString"), + Name: core.StringPtr("testString"), + ShortDescription: core.StringPtr("testString"), + LongDescription: core.StringPtr("testString"), + Metadata: make(map[string]interface{}), + Tags: []string{"testString"}, + Created: CreateMockDateTime("2019-01-01T12:00:00.000Z"), + Updated: CreateMockDateTime("2019-01-01T12:00:00.000Z"), + } - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(approvalResult).ToNot(BeNil()) - - }) - }) - - Describe(`GetVersionUpdates - Get version updates`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`GetVersionUpdates(getVersionUpdatesOptions *GetVersionUpdatesOptions)`, func() { - - getVersionUpdatesOptions := &catalogmanagementv1.GetVersionUpdatesOptions{ - CatalogIdentifier: core.StringPtr("testString"), - OfferingID: core.StringPtr("testString"), - Kind: core.StringPtr("testString"), - Version: core.StringPtr("testString"), - ClusterID: core.StringPtr("testString"), - Region: core.StringPtr("testString"), - ResourceGroupID: core.StringPtr("testString"), - Namespace: core.StringPtr("testString"), - } + planModel := &catalogmanagementv1.Plan{ + ID: core.StringPtr("testString"), + Label: core.StringPtr("testString"), + Name: core.StringPtr("testString"), + ShortDescription: core.StringPtr("testString"), + LongDescription: core.StringPtr("testString"), + Metadata: make(map[string]interface{}), + Tags: []string{"testString"}, + AdditionalFeatures: []catalogmanagementv1.Feature{*featureModel}, + Created: CreateMockDateTime("2019-01-01T12:00:00.000Z"), + Updated: CreateMockDateTime("2019-01-01T12:00:00.000Z"), + Deployments: []catalogmanagementv1.Deployment{*deploymentModel}, + } - versionUpdateDescriptor, response, err := catalogManagementService.GetVersionUpdates(getVersionUpdatesOptions) + kindModel := &catalogmanagementv1.Kind{ + ID: core.StringPtr("testString"), + FormatKind: core.StringPtr(formatKindTerraform), + InstallKind: core.StringPtr(installKindTerraform), + TargetKind: core.StringPtr(targetKindTerraform), + Metadata: make(map[string]interface{}), + Tags: []string{"testString"}, + AdditionalFeatures: []catalogmanagementv1.Feature{*featureModel}, + Created: CreateMockDateTime("2019-01-01T12:00:00.000Z"), + Updated: CreateMockDateTime("2019-01-01T12:00:00.000Z"), + Versions: []catalogmanagementv1.Version{*versionModel}, + Plans: []catalogmanagementv1.Plan{*planModel}, + } - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(versionUpdateDescriptor).ToNot(BeNil()) + providerInfoModel := &catalogmanagementv1.ProviderInfo{ + ID: core.StringPtr("testString"), + Name: core.StringPtr("testString"), + } - }) - }) + supportWaitTimeModel := &catalogmanagementv1.SupportWaitTime{ + Value: core.Int64Ptr(int64(38)), + Type: core.StringPtr("testString"), + } - Describe(`GetVersionAbout - Get version about information`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`GetVersionAbout(getVersionAboutOptions *GetVersionAboutOptions)`, func() { + supportTimeModel := &catalogmanagementv1.SupportTime{ + Day: core.Int64Ptr(int64(38)), + StartTime: core.StringPtr("testString"), + EndTime: core.StringPtr("testString"), + } - getVersionAboutOptions := &catalogmanagementv1.GetVersionAboutOptions{ - VersionLocID: core.StringPtr("testString"), - } + supportAvailabilityModel := &catalogmanagementv1.SupportAvailability{ + Times: []catalogmanagementv1.SupportTime{*supportTimeModel}, + Timezone: core.StringPtr("testString"), + AlwaysAvailable: core.BoolPtr(true), + } - result, response, err := catalogManagementService.GetVersionAbout(getVersionAboutOptions) + supportDetailModel := &catalogmanagementv1.SupportDetail{ + Type: core.StringPtr("testString"), + Contact: core.StringPtr("testString"), + ResponseWaitTime: supportWaitTimeModel, + Availability: supportAvailabilityModel, + } - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(result).ToNot(BeNil()) + supportEscalationModel := &catalogmanagementv1.SupportEscalation{ + EscalationWaitTime: supportWaitTimeModel, + ResponseWaitTime: supportWaitTimeModel, + Contact: core.StringPtr("testString"), + } - }) - }) + supportModel := &catalogmanagementv1.Support{ + URL: core.StringPtr("testString"), + Process: core.StringPtr("testString"), + ProcessI18n: make(map[string]string), + Locations: []string{"testString"}, + SupportDetails: []catalogmanagementv1.SupportDetail{*supportDetailModel}, + SupportEscalation: supportEscalationModel, + SupportType: core.StringPtr("testString"), + } - Describe(`GetVersionLicense - Get version license content`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`GetVersionLicense(getVersionLicenseOptions *GetVersionLicenseOptions)`, func() { + learnMoreLinksModel := &catalogmanagementv1.LearnMoreLinks{ + FirstParty: core.StringPtr("testString"), + ThirdParty: core.StringPtr("testString"), + } - getVersionLicenseOptions := &catalogmanagementv1.GetVersionLicenseOptions{ - VersionLocID: core.StringPtr("testString"), - LicenseID: core.StringPtr("testString"), - } + constraintModel := &catalogmanagementv1.Constraint{ + Type: core.StringPtr("testString"), + Rule: core.StringPtr("testString"), + } + + badgeModel := &catalogmanagementv1.Badge{ + ID: core.StringPtr("testString"), + Label: core.StringPtr("testString"), + LabelI18n: make(map[string]string), + Description: core.StringPtr("testString"), + DescriptionI18n: make(map[string]string), + Icon: core.StringPtr("testString"), + Authority: core.StringPtr("testString"), + Tag: core.StringPtr("testString"), + LearnMoreLinks: learnMoreLinksModel, + Constraints: []catalogmanagementv1.Constraint{*constraintModel}, + } - result, response, err := catalogManagementService.GetVersionLicense(getVersionLicenseOptions) + replaceOfferingOptions := &catalogmanagementv1.ReplaceOfferingOptions{ + CatalogIdentifier: &catalogIDLink, + OfferingID: &offeringIDLink, + ID: &offeringIDLink, + Rev: &offeringRevLink, + URL: core.StringPtr("testString"), + CRN: core.StringPtr("testString"), + Label: core.StringPtr("testString"), + LabelI18n: make(map[string]string), + Name: core.StringPtr("testString"), + OfferingIconURL: core.StringPtr("testString"), + OfferingDocsURL: core.StringPtr("testString"), + OfferingSupportURL: core.StringPtr("testString"), + Tags: []string{"testString"}, + Keywords: []string{"testString"}, + Rating: ratingModel, + Created: CreateMockDateTime("2019-01-01T12:00:00.000Z"), + Updated: CreateMockDateTime("2019-01-01T12:00:00.000Z"), + ShortDescription: core.StringPtr("testString"), + ShortDescriptionI18n: make(map[string]string), + LongDescription: core.StringPtr("testString"), + LongDescriptionI18n: make(map[string]string), + Features: []catalogmanagementv1.Feature{*featureModel}, + Kinds: []catalogmanagementv1.Kind{*kindModel}, + PcManaged: core.BoolPtr(true), + PublishApproved: core.BoolPtr(true), + ShareWithAll: core.BoolPtr(true), + ShareWithIBM: core.BoolPtr(true), + ShareEnabled: core.BoolPtr(true), + PermitRequestIBMPublicPublish: core.BoolPtr(true), + IBMPublishApproved: core.BoolPtr(true), + PublicPublishApproved: core.BoolPtr(true), + PublicOriginalCRN: core.StringPtr("testString"), + PublishPublicCRN: core.StringPtr("testString"), + PortalApprovalRecord: core.StringPtr("testString"), + PortalUIURL: core.StringPtr("testString"), + CatalogID: &catalogIDLink, + CatalogName: core.StringPtr("testString"), + Metadata: make(map[string]interface{}), + Disclaimer: core.StringPtr("testString"), + Hidden: core.BoolPtr(true), + Provider: core.StringPtr("testString"), + ProviderInfo: providerInfoModel, + Support: supportModel, + Media: []catalogmanagementv1.MediaItem{*mediaItemModel}, + DeprecatePending: deprecatePendingModel, + ProductKind: core.StringPtr("solution"), + Badges: []catalogmanagementv1.Badge{*badgeModel}, + } - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(result).ToNot(BeNil()) + offering, response, err := catalogManagementService.ReplaceOffering(replaceOfferingOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(offering).ToNot(BeNil()) - }) + offeringIDLink = *offering.ID + fmt.Fprintf(GinkgoWriter, "Saved offeringIDLink value: %v\n", offeringIDLink) + offeringRevLink = *offering.Rev + fmt.Fprintf(GinkgoWriter, "Saved offeringRevLink value: %v\n", offeringRevLink) + versionLocatorLink = *offering.Kinds[0].Versions[0].VersionLocator + fmt.Fprintf(GinkgoWriter, "Saved versionLocatorLink value: %v\n", versionLocatorLink) + versionIDLink = *offering.Kinds[0].Versions[0].ID + fmt.Fprintf(GinkgoWriter, "Saved versionIDLink value: %v\n", versionIDLink) + versionRevLink = *offering.Kinds[0].Versions[0].Rev + fmt.Fprintf(GinkgoWriter, "Saved versionRevLink value: %v\n", versionRevLink) }) + }) - Describe(`GetVersionContainerImages - Get version's container images`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`GetVersionContainerImages(getVersionContainerImagesOptions *GetVersionContainerImagesOptions)`, func() { - - getVersionContainerImagesOptions := &catalogmanagementv1.GetVersionContainerImagesOptions{ - VersionLocID: core.StringPtr("testString"), - } + Describe(`ListCatalogAccountAudits - Get catalog account audit logs`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`ListCatalogAccountAudits(listCatalogAccountAuditsOptions *ListCatalogAccountAuditsOptions) with pagination`, func() { + Skip("Not testing") + listCatalogAccountAuditsOptions := &catalogmanagementv1.ListCatalogAccountAuditsOptions{ + Start: core.StringPtr(""), + Limit: core.Int64Ptr(int64(10)), + Lookupnames: core.BoolPtr(true), + } - imageManifest, response, err := catalogManagementService.GetVersionContainerImages(getVersionContainerImagesOptions) + listCatalogAccountAuditsOptions.Start = nil + listCatalogAccountAuditsOptions.Limit = core.Int64Ptr(1) + var allResults []catalogmanagementv1.AuditLogDigest + for { + auditLogs, response, err := catalogManagementService.ListCatalogAccountAudits(listCatalogAccountAuditsOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) - Expect(imageManifest).ToNot(BeNil()) - - }) - }) - - Describe(`DeprecateVersion - Deprecate version`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`DeprecateVersion(deprecateVersionOptions *DeprecateVersionOptions)`, func() { - - deprecateVersionOptions := &catalogmanagementv1.DeprecateVersionOptions{ - VersionLocID: core.StringPtr("testString"), - } - - response, err := catalogManagementService.DeprecateVersion(deprecateVersionOptions) + Expect(auditLogs).ToNot(BeNil()) + allResults = append(allResults, auditLogs.Audits...) + listCatalogAccountAuditsOptions.Start, err = auditLogs.GetNextStart() Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(202)) - }) - }) - - Describe(`AccountPublishVersion - Publish version to account members`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`AccountPublishVersion(accountPublishVersionOptions *AccountPublishVersionOptions)`, func() { - - accountPublishVersionOptions := &catalogmanagementv1.AccountPublishVersionOptions{ - VersionLocID: core.StringPtr("testString"), + if listCatalogAccountAuditsOptions.Start == nil { + break } - - response, err := catalogManagementService.AccountPublishVersion(accountPublishVersionOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(202)) - - }) + } + fmt.Fprintf(GinkgoWriter, "Retrieved a total of %d item(s) with pagination.\n", len(allResults)) }) + It(`ListCatalogAccountAudits(listCatalogAccountAuditsOptions *ListCatalogAccountAuditsOptions) using CatalogAccountAuditsPager`, func() { + Skip("Not testing") + listCatalogAccountAuditsOptions := &catalogmanagementv1.ListCatalogAccountAuditsOptions{ + Limit: core.Int64Ptr(int64(10)), + Lookupnames: core.BoolPtr(true), + } - Describe(`IBMPublishVersion - Publish version to IBMers in public catalog`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`IBMPublishVersion(ibmPublishVersionOptions *IBMPublishVersionOptions)`, func() { + // Test GetNext(). + pager, err := catalogManagementService.NewCatalogAccountAuditsPager(listCatalogAccountAuditsOptions) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) - ibmPublishVersionOptions := &catalogmanagementv1.IBMPublishVersionOptions{ - VersionLocID: core.StringPtr("testString"), - } + var allResults []catalogmanagementv1.AuditLogDigest + for pager.HasNext() { + nextPage, err := pager.GetNext() + Expect(err).To(BeNil()) + Expect(nextPage).ToNot(BeNil()) + allResults = append(allResults, nextPage...) + } - response, err := catalogManagementService.IBMPublishVersion(ibmPublishVersionOptions) + // Test GetAll(). + pager, err = catalogManagementService.NewCatalogAccountAuditsPager(listCatalogAccountAuditsOptions) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(202)) + allItems, err := pager.GetAll() + Expect(err).To(BeNil()) + Expect(allItems).ToNot(BeNil()) - }) + Expect(len(allItems)).To(Equal(len(allResults))) + fmt.Fprintf(GinkgoWriter, "ListCatalogAccountAudits() returned a total of %d item(s) using CatalogAccountAuditsPager.\n", len(allResults)) }) + }) - Describe(`PublicPublishVersion - Publish version to all users in public catalog`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`PublicPublishVersion(publicPublishVersionOptions *PublicPublishVersionOptions)`, func() { + Describe(`GetCatalogAccountAudit - Get a catalog account audit log entry`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`GetCatalogAccountAudit(getCatalogAccountAuditOptions *GetCatalogAccountAuditOptions)`, func() { + Skip("Not testing") + getCatalogAccountAuditOptions := &catalogmanagementv1.GetCatalogAccountAuditOptions{ + AuditlogIdentifier: core.StringPtr("testString"), + Lookupnames: core.BoolPtr(true), + } - publicPublishVersionOptions := &catalogmanagementv1.PublicPublishVersionOptions{ - VersionLocID: core.StringPtr("testString"), - } + auditLog, response, err := catalogManagementService.GetCatalogAccountAudit(getCatalogAccountAuditOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(auditLog).ToNot(BeNil()) + }) + }) - response, err := catalogManagementService.PublicPublishVersion(publicPublishVersionOptions) + Describe(`GetCatalogAccountFilters - Get catalog account filters`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`GetCatalogAccountFilters(getCatalogAccountFiltersOptions *GetCatalogAccountFiltersOptions)`, func() { + getCatalogAccountFiltersOptions := &catalogmanagementv1.GetCatalogAccountFiltersOptions{ + Catalog: &catalogIDLink, + } - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(202)) + accumulatedFilters, response, err := catalogManagementService.GetCatalogAccountFilters(getCatalogAccountFiltersOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(accumulatedFilters).ToNot(BeNil()) + }) + }) - }) + Describe(`ListCatalogs - Get list of catalogs`, func() { + BeforeEach(func() { + shouldSkipTest() }) + It(`ListCatalogs(listCatalogsOptions *ListCatalogsOptions)`, func() { + listCatalogsOptions := &catalogmanagementv1.ListCatalogsOptions{} - Describe(`CommitVersion - Commit version`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`CommitVersion(commitVersionOptions *CommitVersionOptions)`, func() { + catalogSearchResult, response, err := catalogManagementService.ListCatalogs(listCatalogsOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(catalogSearchResult).ToNot(BeNil()) + }) + }) - commitVersionOptions := &catalogmanagementv1.CommitVersionOptions{ - VersionLocID: core.StringPtr("testString"), - } + Describe(`ListCatalogAudits - Get catalog audit logs`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`ListCatalogAudits(listCatalogAuditsOptions *ListCatalogAuditsOptions) with pagination`, func() { + Skip("Not testing") + listCatalogAuditsOptions := &catalogmanagementv1.ListCatalogAuditsOptions{ + CatalogIdentifier: &catalogIDLink, + Start: core.StringPtr(""), + Limit: core.Int64Ptr(int64(10)), + Lookupnames: core.BoolPtr(true), + } - response, err := catalogManagementService.CommitVersion(commitVersionOptions) + listCatalogAuditsOptions.Start = nil + listCatalogAuditsOptions.Limit = core.Int64Ptr(1) + var allResults []catalogmanagementv1.AuditLogDigest + for { + auditLogs, response, err := catalogManagementService.ListCatalogAudits(listCatalogAuditsOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) + Expect(auditLogs).ToNot(BeNil()) + allResults = append(allResults, auditLogs.Audits...) - }) - }) - - Describe(`CopyVersion - Copy version to new target kind`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`CopyVersion(copyVersionOptions *CopyVersionOptions)`, func() { + listCatalogAuditsOptions.Start, err = auditLogs.GetNextStart() + Expect(err).To(BeNil()) - copyVersionOptions := &catalogmanagementv1.CopyVersionOptions{ - VersionLocID: core.StringPtr("testString"), - Tags: []string{"testString"}, - TargetKinds: []string{"testString"}, - Content: CreateMockByteArray("This is a mock byte array value."), + if listCatalogAuditsOptions.Start == nil { + break } + } + fmt.Fprintf(GinkgoWriter, "Retrieved a total of %d item(s) with pagination.\n", len(allResults)) + }) + It(`ListCatalogAudits(listCatalogAuditsOptions *ListCatalogAuditsOptions) using CatalogAuditsPager`, func() { + Skip("Not testing") + listCatalogAuditsOptions := &catalogmanagementv1.ListCatalogAuditsOptions{ + CatalogIdentifier: &catalogIDLink, + Limit: core.Int64Ptr(int64(10)), + Lookupnames: core.BoolPtr(true), + } - response, err := catalogManagementService.CopyVersion(copyVersionOptions) + // Test GetNext(). + pager, err := catalogManagementService.NewCatalogAuditsPager(listCatalogAuditsOptions) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + var allResults []catalogmanagementv1.AuditLogDigest + for pager.HasNext() { + nextPage, err := pager.GetNext() Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - - }) - }) - - Describe(`GetVersionWorkingCopy - Create working copy of version`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`GetVersionWorkingCopy(getVersionWorkingCopyOptions *GetVersionWorkingCopyOptions)`, func() { + Expect(nextPage).ToNot(BeNil()) + allResults = append(allResults, nextPage...) + } - getVersionWorkingCopyOptions := &catalogmanagementv1.GetVersionWorkingCopyOptions{ - VersionLocID: core.StringPtr("testString"), - } + // Test GetAll(). + pager, err = catalogManagementService.NewCatalogAuditsPager(listCatalogAuditsOptions) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) - version, response, err := catalogManagementService.GetVersionWorkingCopy(getVersionWorkingCopyOptions) + allItems, err := pager.GetAll() + Expect(err).To(BeNil()) + Expect(allItems).ToNot(BeNil()) - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(version).ToNot(BeNil()) + Expect(len(allItems)).To(Equal(len(allResults))) + fmt.Fprintf(GinkgoWriter, "ListCatalogAudits() returned a total of %d item(s) using CatalogAuditsPager.\n", len(allResults)) + }) + }) - }) + Describe(`GetCatalogAudit - Get a catalog audit log entry`, func() { + BeforeEach(func() { + shouldSkipTest() }) + It(`GetCatalogAudit(getCatalogAuditOptions *GetCatalogAuditOptions)`, func() { + Skip("Not testing") + getCatalogAuditOptions := &catalogmanagementv1.GetCatalogAuditOptions{ + CatalogIdentifier: &catalogIDLink, + AuditlogIdentifier: core.StringPtr("testString"), + Lookupnames: core.BoolPtr(true), + } - Describe(`GetVersion - Get offering/kind/version 'branch'`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`GetVersion(getVersionOptions *GetVersionOptions)`, func() { + auditLog, response, err := catalogManagementService.GetCatalogAudit(getCatalogAuditOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(auditLog).ToNot(BeNil()) + }) + }) - getVersionOptions := &catalogmanagementv1.GetVersionOptions{ - VersionLocID: core.StringPtr("testString"), - } + Describe(`ListEnterpriseAudits - Get enterprise audit logs`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`ListEnterpriseAudits(listEnterpriseAuditsOptions *ListEnterpriseAuditsOptions) with pagination`, func() { + Skip("Not testing") + listEnterpriseAuditsOptions := &catalogmanagementv1.ListEnterpriseAuditsOptions{ + EnterpriseIdentifier: core.StringPtr("testString"), + Start: core.StringPtr(""), + Limit: core.Int64Ptr(int64(10)), + Lookupnames: core.BoolPtr(true), + } - offering, response, err := catalogManagementService.GetVersion(getVersionOptions) + listEnterpriseAuditsOptions.Start = nil + listEnterpriseAuditsOptions.Limit = core.Int64Ptr(1) + var allResults []catalogmanagementv1.AuditLogDigest + for { + auditLogs, response, err := catalogManagementService.ListEnterpriseAudits(listEnterpriseAuditsOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) - Expect(offering).ToNot(BeNil()) + Expect(auditLogs).ToNot(BeNil()) + allResults = append(allResults, auditLogs.Audits...) - }) - }) - - Describe(`GetRepos - List a repository's entries`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`GetRepos(getReposOptions *GetReposOptions)`, func() { + listEnterpriseAuditsOptions.Start, err = auditLogs.GetNextStart() + Expect(err).To(BeNil()) - getReposOptions := &catalogmanagementv1.GetReposOptions{ - Type: core.StringPtr("testString"), - Repourl: core.StringPtr("testString"), + if listEnterpriseAuditsOptions.Start == nil { + break } + } + fmt.Fprintf(GinkgoWriter, "Retrieved a total of %d item(s) with pagination.\n", len(allResults)) + }) + It(`ListEnterpriseAudits(listEnterpriseAuditsOptions *ListEnterpriseAuditsOptions) using EnterpriseAuditsPager`, func() { + Skip("Not testing") + listEnterpriseAuditsOptions := &catalogmanagementv1.ListEnterpriseAuditsOptions{ + EnterpriseIdentifier: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + Lookupnames: core.BoolPtr(true), + } - helmRepoList, response, err := catalogManagementService.GetRepos(getReposOptions) + // Test GetNext(). + pager, err := catalogManagementService.NewEnterpriseAuditsPager(listEnterpriseAuditsOptions) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + var allResults []catalogmanagementv1.AuditLogDigest + for pager.HasNext() { + nextPage, err := pager.GetNext() Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(helmRepoList).ToNot(BeNil()) + Expect(nextPage).ToNot(BeNil()) + allResults = append(allResults, nextPage...) + } - }) + // Test GetAll(). + pager, err = catalogManagementService.NewEnterpriseAuditsPager(listEnterpriseAuditsOptions) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + allItems, err := pager.GetAll() + Expect(err).To(BeNil()) + Expect(allItems).ToNot(BeNil()) + + Expect(len(allItems)).To(Equal(len(allResults))) + fmt.Fprintf(GinkgoWriter, "ListEnterpriseAudits() returned a total of %d item(s) using EnterpriseAuditsPager.\n", len(allResults)) }) + }) - Describe(`GetRepo - Get repository contents`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`GetRepo(getRepoOptions *GetRepoOptions)`, func() { + Describe(`GetEnterpriseAudit - Get an enterprise audit log entry`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`GetEnterpriseAudit(getEnterpriseAuditOptions *GetEnterpriseAuditOptions)`, func() { + Skip("Not testing") + getEnterpriseAuditOptions := &catalogmanagementv1.GetEnterpriseAuditOptions{ + EnterpriseIdentifier: core.StringPtr("testString"), + AuditlogIdentifier: core.StringPtr("testString"), + Lookupnames: core.BoolPtr(true), + } - getRepoOptions := &catalogmanagementv1.GetRepoOptions{ - Type: core.StringPtr("testString"), - Charturl: core.StringPtr("testString"), - } + auditLog, response, err := catalogManagementService.GetEnterpriseAudit(getEnterpriseAuditOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(auditLog).ToNot(BeNil()) + }) + }) - helmPackage, response, err := catalogManagementService.GetRepo(getRepoOptions) + Describe(`GetConsumptionOfferings - Get consumption offerings`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`GetConsumptionOfferings(getConsumptionOfferingsOptions *GetConsumptionOfferingsOptions)`, func() { + getConsumptionOfferingsOptions := &catalogmanagementv1.GetConsumptionOfferingsOptions{ + Digest: core.BoolPtr(true), + Catalog: &catalogIDLink, + Select: core.StringPtr("all"), + IncludeHidden: core.BoolPtr(true), + Limit: core.Int64Ptr(int64(1000)), + Offset: core.Int64Ptr(int64(38)), + } - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(helmPackage).ToNot(BeNil()) + offeringSearchResult, response, err := catalogManagementService.GetConsumptionOfferings(getConsumptionOfferingsOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(offeringSearchResult).ToNot(BeNil()) + }) + }) - }) + Describe(`ListOfferings - Get list of offerings`, func() { + BeforeEach(func() { + shouldSkipTest() }) + It(`ListOfferings(listOfferingsOptions *ListOfferingsOptions)`, func() { + listOfferingsOptions := &catalogmanagementv1.ListOfferingsOptions{ + CatalogIdentifier: &catalogIDLink, + Digest: core.BoolPtr(true), + Limit: core.Int64Ptr(int64(1000)), + Offset: core.Int64Ptr(int64(38)), + Name: core.StringPtr("testString"), + Sort: core.StringPtr("name"), + IncludeHidden: core.BoolPtr(true), + } - Describe(`GetCluster - Get kubernetes cluster`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`GetCluster(getClusterOptions *GetClusterOptions)`, func() { + offeringSearchResult, response, err := catalogManagementService.ListOfferings(listOfferingsOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(offeringSearchResult).ToNot(BeNil()) + }) + }) - getClusterOptions := &catalogmanagementv1.GetClusterOptions{ - ClusterID: core.StringPtr("testString"), - Region: core.StringPtr("testString"), - XAuthRefreshToken: core.StringPtr("testString"), - } + Describe(`ListOfferingAudits - Get offering audit logs`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`ListOfferingAudits(listOfferingAuditsOptions *ListOfferingAuditsOptions) with pagination`, func() { + Skip("Not testing") + listOfferingAuditsOptions := &catalogmanagementv1.ListOfferingAuditsOptions{ + CatalogIdentifier: &catalogIDLink, + OfferingID: &offeringIDLink, + Start: core.StringPtr(""), + Limit: core.Int64Ptr(int64(10)), + Lookupnames: core.BoolPtr(true), + } - clusterInfo, response, err := catalogManagementService.GetCluster(getClusterOptions) + listOfferingAuditsOptions.Start = nil + listOfferingAuditsOptions.Limit = core.Int64Ptr(1) + var allResults []catalogmanagementv1.AuditLogDigest + for { + auditLogs, response, err := catalogManagementService.ListOfferingAudits(listOfferingAuditsOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) - Expect(clusterInfo).ToNot(BeNil()) + Expect(auditLogs).ToNot(BeNil()) + allResults = append(allResults, auditLogs.Audits...) - }) - }) - - Describe(`GetNamespaces - Get cluster namespaces`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`GetNamespaces(getNamespacesOptions *GetNamespacesOptions)`, func() { + listOfferingAuditsOptions.Start, err = auditLogs.GetNextStart() + Expect(err).To(BeNil()) - getNamespacesOptions := &catalogmanagementv1.GetNamespacesOptions{ - ClusterID: core.StringPtr("testString"), - Region: core.StringPtr("testString"), - XAuthRefreshToken: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(1000)), - Offset: core.Int64Ptr(int64(38)), + if listOfferingAuditsOptions.Start == nil { + break } + } + fmt.Fprintf(GinkgoWriter, "Retrieved a total of %d item(s) with pagination.\n", len(allResults)) + }) + It(`ListOfferingAudits(listOfferingAuditsOptions *ListOfferingAuditsOptions) using OfferingAuditsPager`, func() { + Skip("Not testing") + listOfferingAuditsOptions := &catalogmanagementv1.ListOfferingAuditsOptions{ + CatalogIdentifier: &catalogIDLink, + OfferingID: &offeringIDLink, + Limit: core.Int64Ptr(int64(10)), + Lookupnames: core.BoolPtr(true), + } - namespaceSearchResult, response, err := catalogManagementService.GetNamespaces(getNamespacesOptions) + // Test GetNext(). + pager, err := catalogManagementService.NewOfferingAuditsPager(listOfferingAuditsOptions) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + var allResults []catalogmanagementv1.AuditLogDigest + for pager.HasNext() { + nextPage, err := pager.GetNext() Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(namespaceSearchResult).ToNot(BeNil()) + Expect(nextPage).ToNot(BeNil()) + allResults = append(allResults, nextPage...) + } - }) - }) + // Test GetAll(). + pager, err = catalogManagementService.NewOfferingAuditsPager(listOfferingAuditsOptions) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) - Describe(`DeployOperators - Deploy operators`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`DeployOperators(deployOperatorsOptions *DeployOperatorsOptions)`, func() { + allItems, err := pager.GetAll() + Expect(err).To(BeNil()) + Expect(allItems).ToNot(BeNil()) - deployOperatorsOptions := &catalogmanagementv1.DeployOperatorsOptions{ - XAuthRefreshToken: core.StringPtr("testString"), - ClusterID: core.StringPtr("testString"), - Region: core.StringPtr("testString"), - Namespaces: []string{"testString"}, - AllNamespaces: core.BoolPtr(true), - VersionLocatorID: core.StringPtr("testString"), - } + Expect(len(allItems)).To(Equal(len(allResults))) + fmt.Fprintf(GinkgoWriter, "ListOfferingAudits() returned a total of %d item(s) using OfferingAuditsPager.\n", len(allResults)) + }) + }) - operatorDeployResult, response, err := catalogManagementService.DeployOperators(deployOperatorsOptions) + Describe(`GetOfferingAudit - Get an offering audit log entry`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`GetOfferingAudit(getOfferingAuditOptions *GetOfferingAuditOptions)`, func() { + Skip("Not testing") + getOfferingAuditOptions := &catalogmanagementv1.GetOfferingAuditOptions{ + CatalogIdentifier: &catalogIDLink, + OfferingID: &offeringIDLink, + AuditlogIdentifier: core.StringPtr("testString"), + Lookupnames: core.BoolPtr(true), + } - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(operatorDeployResult).ToNot(BeNil()) + auditLog, response, err := catalogManagementService.GetOfferingAudit(getOfferingAuditOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(auditLog).ToNot(BeNil()) + }) + }) - }) + Describe(`SetOfferingPublish - Set offering publish approval settings`, func() { + BeforeEach(func() { + shouldSkipTest() }) + It(`SetOfferingPublish(setOfferingPublishOptions *SetOfferingPublishOptions)`, func() { + Skip("Not testing") + setOfferingPublishOptions := &catalogmanagementv1.SetOfferingPublishOptions{ + CatalogIdentifier: &catalogIDLink, + OfferingID: &offeringIDLink, + ApprovalType: core.StringPtr("pc_managed"), + Approved: core.StringPtr("true"), + PortalRecord: core.StringPtr("testString"), + PortalURL: core.StringPtr("testString"), + XApproverToken: core.StringPtr("testString"), + } - Describe(`ListOperators - List operators`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`ListOperators(listOperatorsOptions *ListOperatorsOptions)`, func() { + approvalResult, response, err := catalogManagementService.SetOfferingPublish(setOfferingPublishOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(approvalResult).ToNot(BeNil()) + }) + }) - listOperatorsOptions := &catalogmanagementv1.ListOperatorsOptions{ - XAuthRefreshToken: core.StringPtr("testString"), - ClusterID: core.StringPtr("testString"), - Region: core.StringPtr("testString"), - VersionLocatorID: core.StringPtr("testString"), - } + Describe(`DeprecateOffering - Allows offering to be deprecated`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`DeprecateOffering(deprecateOfferingOptions *DeprecateOfferingOptions)`, func() { + Skip("Not testing") + deprecateOfferingOptions := &catalogmanagementv1.DeprecateOfferingOptions{ + CatalogIdentifier: &catalogIDLink, + OfferingID: &offeringIDLink, + Setting: core.StringPtr("true"), + Description: core.StringPtr("testString"), + DaysUntilDeprecate: core.Int64Ptr(int64(38)), + } - operatorDeployResult, response, err := catalogManagementService.ListOperators(listOperatorsOptions) + response, err := catalogManagementService.DeprecateOffering(deprecateOfferingOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(202)) + }) + }) - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(operatorDeployResult).ToNot(BeNil()) + Describe(`ShareOffering - Allows offering to be shared`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`ShareOffering(shareOfferingOptions *ShareOfferingOptions)`, func() { + Skip("Not testing") + shareOfferingOptions := &catalogmanagementv1.ShareOfferingOptions{ + CatalogIdentifier: &catalogIDLink, + OfferingID: &offeringIDLink, + IBM: core.BoolPtr(true), + Public: core.BoolPtr(true), + Enabled: core.BoolPtr(true), + } - }) + shareSetting, response, err := catalogManagementService.ShareOffering(shareOfferingOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(shareSetting).ToNot(BeNil()) }) + }) - Describe(`ReplaceOperators - Update operators`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`ReplaceOperators(replaceOperatorsOptions *ReplaceOperatorsOptions)`, func() { + Describe(`GetOfferingAccess - Check for account ID in offering access list`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`GetOfferingAccess(getOfferingAccessOptions *GetOfferingAccessOptions)`, func() { + getOfferingAccessOptions := &catalogmanagementv1.GetOfferingAccessOptions{ + CatalogIdentifier: &catalogIDLink, + OfferingID: &offeringIDLink, + AccessIdentifier: core.StringPtr(accountID), + } - replaceOperatorsOptions := &catalogmanagementv1.ReplaceOperatorsOptions{ - XAuthRefreshToken: core.StringPtr("testString"), - ClusterID: core.StringPtr("testString"), - Region: core.StringPtr("testString"), - Namespaces: []string{"testString"}, - AllNamespaces: core.BoolPtr(true), - VersionLocatorID: core.StringPtr("testString"), - } + access, response, err := catalogManagementService.GetOfferingAccess(getOfferingAccessOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(access).ToNot(BeNil()) + }) + }) - operatorDeployResult, response, err := catalogManagementService.ReplaceOperators(replaceOperatorsOptions) + Describe(`GetOfferingAccessList - Get offering access list`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`GetOfferingAccessList(getOfferingAccessListOptions *GetOfferingAccessListOptions) with pagination`, func() { + Skip("Not testing") + getOfferingAccessListOptions := &catalogmanagementv1.GetOfferingAccessListOptions{ + CatalogIdentifier: &catalogIDLink, + OfferingID: &offeringIDLink, + Start: core.StringPtr(""), + Limit: core.Int64Ptr(int64(10)), + } + getOfferingAccessListOptions.Start = nil + getOfferingAccessListOptions.Limit = core.Int64Ptr(1) + + var allResults []catalogmanagementv1.Access + for { + accessListResult, response, err := catalogManagementService.GetOfferingAccessList(getOfferingAccessListOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) - Expect(operatorDeployResult).ToNot(BeNil()) + Expect(accessListResult).ToNot(BeNil()) + allResults = append(allResults, accessListResult.Resources...) + + getOfferingAccessListOptions.Start, err = accessListResult.GetNextStart() + Expect(err).To(BeNil()) - }) + if getOfferingAccessListOptions.Start == nil { + break + } + } + fmt.Fprintf(GinkgoWriter, "Retrieved a total of %d item(s) with pagination.\n", len(allResults)) + }) + It(`GetOfferingAccessList(getOfferingAccessListOptions *GetOfferingAccessListOptions) using GetOfferingAccessListPager`, func() { + Skip("Not testing") + getOfferingAccessListOptions := &catalogmanagementv1.GetOfferingAccessListOptions{ + CatalogIdentifier: &catalogIDLink, + OfferingID: &offeringIDLink, + Limit: core.Int64Ptr(int64(10)), + } + + // Test GetNext(). + pager, err := catalogManagementService.NewGetOfferingAccessListPager(getOfferingAccessListOptions) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []catalogmanagementv1.Access + for pager.HasNext() { + nextPage, err := pager.GetNext() + Expect(err).To(BeNil()) + Expect(nextPage).ToNot(BeNil()) + allResults = append(allResults, nextPage...) + } + + // Test GetAll(). + pager, err = catalogManagementService.NewGetOfferingAccessListPager(getOfferingAccessListOptions) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + allItems, err := pager.GetAll() + Expect(err).To(BeNil()) + Expect(allItems).ToNot(BeNil()) + + Expect(len(allItems)).To(Equal(len(allResults))) + fmt.Fprintf(GinkgoWriter, "GetOfferingAccessList() returned a total of %d item(s) using GetOfferingAccessListPager.\n", len(allResults)) }) + }) - Describe(`InstallVersion - Install version`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`InstallVersion(installVersionOptions *InstallVersionOptions)`, func() { + Describe(`AddOfferingAccessList - Add accesses to offering access list`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`AddOfferingAccessList(addOfferingAccessListOptions *AddOfferingAccessListOptions)`, func() { + addOfferingAccessListOptions := &catalogmanagementv1.AddOfferingAccessListOptions{ + CatalogIdentifier: &catalogIDLink, + OfferingID: &offeringIDLink, + Accesses: []string{accountID}, + } - deployRequestBodySchematicsModel := &catalogmanagementv1.DeployRequestBodySchematics{ - Name: core.StringPtr("testString"), - Description: core.StringPtr("testString"), - Tags: []string{"testString"}, - ResourceGroupID: core.StringPtr("testString"), - } + accessListResult, response, err := catalogManagementService.AddOfferingAccessList(addOfferingAccessListOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(201)) + Expect(accessListResult).ToNot(BeNil()) + }) + }) - installVersionOptions := &catalogmanagementv1.InstallVersionOptions{ - VersionLocID: core.StringPtr("testString"), - XAuthRefreshToken: core.StringPtr("testString"), - ClusterID: core.StringPtr("testString"), - Region: core.StringPtr("testString"), - Namespace: core.StringPtr("testString"), - OverrideValues: make(map[string]interface{}), - EntitlementApikey: core.StringPtr("testString"), - Schematics: deployRequestBodySchematicsModel, - Script: core.StringPtr("testString"), - ScriptID: core.StringPtr("testString"), - VersionLocatorID: core.StringPtr("testString"), - VcenterID: core.StringPtr("testString"), - VcenterUser: core.StringPtr("testString"), - VcenterPassword: core.StringPtr("testString"), - VcenterLocation: core.StringPtr("testString"), - VcenterDatastore: core.StringPtr("testString"), - } + Describe(`GetOfferingUpdates - Get version updates`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`GetOfferingUpdates(getOfferingUpdatesOptions *GetOfferingUpdatesOptions)`, func() { + getOfferingUpdatesOptions := &catalogmanagementv1.GetOfferingUpdatesOptions{ + CatalogIdentifier: &catalogIDLink, + OfferingID: &offeringIDLink, + Kind: core.StringPtr("testString"), + XAuthRefreshToken: core.StringPtr("testString"), + Target: core.StringPtr("testString"), + Version: core.StringPtr("1.0.0"), + ClusterID: core.StringPtr("testString"), + Region: core.StringPtr("testString"), + ResourceGroupID: core.StringPtr("testString"), + Namespace: core.StringPtr("testString"), + Sha: core.StringPtr("testString"), + Channel: core.StringPtr("testString"), + Namespaces: []string{"testString"}, + AllNamespaces: core.BoolPtr(true), + } - response, err := catalogManagementService.InstallVersion(installVersionOptions) + versionUpdateDescriptor, response, err := catalogManagementService.GetOfferingUpdates(getOfferingUpdatesOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(versionUpdateDescriptor).ToNot(BeNil()) + }) + }) - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(202)) + Describe(`GetOfferingSource - Get offering source`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`GetOfferingSource(getOfferingSourceOptions *GetOfferingSourceOptions)`, func() { + Skip("Not testing") + getOfferingSourceOptions := &catalogmanagementv1.GetOfferingSourceOptions{ + Version: core.StringPtr("testString"), + Accept: core.StringPtr("application/yaml"), + CatalogID: core.StringPtr("testString"), + Name: core.StringPtr("testString"), + ID: core.StringPtr("testString"), + Kind: core.StringPtr("testString"), + Channel: core.StringPtr("testString"), + } - }) + result, response, err := catalogManagementService.GetOfferingSource(getOfferingSourceOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(result).ToNot(BeNil()) }) + }) - Describe(`PreinstallVersion - Pre-install version`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`PreinstallVersion(preinstallVersionOptions *PreinstallVersionOptions)`, func() { + Describe(`GetOfferingSourceURL - Get offering source URL`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`GetOfferingSourceURL(getOfferingSourceURLOptions *GetOfferingSourceURLOptions)`, func() { + Skip("Not testing") + getOfferingSourceURLOptions := &catalogmanagementv1.GetOfferingSourceURLOptions{ + KeyIdentifier: core.StringPtr("testString"), + Accept: core.StringPtr("application/yaml"), + CatalogID: core.StringPtr("testString"), + Name: core.StringPtr("testString"), + ID: core.StringPtr("testString"), + } - deployRequestBodySchematicsModel := &catalogmanagementv1.DeployRequestBodySchematics{ - Name: core.StringPtr("testString"), - Description: core.StringPtr("testString"), - Tags: []string{"testString"}, - ResourceGroupID: core.StringPtr("testString"), - } + result, response, err := catalogManagementService.GetOfferingSourceURL(getOfferingSourceURLOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(result).ToNot(BeNil()) + }) + }) - preinstallVersionOptions := &catalogmanagementv1.PreinstallVersionOptions{ - VersionLocID: core.StringPtr("testString"), - XAuthRefreshToken: core.StringPtr("testString"), - ClusterID: core.StringPtr("testString"), - Region: core.StringPtr("testString"), - Namespace: core.StringPtr("testString"), - OverrideValues: make(map[string]interface{}), - EntitlementApikey: core.StringPtr("testString"), - Schematics: deployRequestBodySchematicsModel, - Script: core.StringPtr("testString"), - ScriptID: core.StringPtr("testString"), - VersionLocatorID: core.StringPtr("testString"), - VcenterID: core.StringPtr("testString"), - VcenterUser: core.StringPtr("testString"), - VcenterPassword: core.StringPtr("testString"), - VcenterLocation: core.StringPtr("testString"), - VcenterDatastore: core.StringPtr("testString"), - } + Describe(`GetOfferingAbout - Get version about information`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`GetOfferingAbout(getOfferingAboutOptions *GetOfferingAboutOptions)`, func() { + getOfferingAboutOptions := &catalogmanagementv1.GetOfferingAboutOptions{ + VersionLocID: core.StringPtr(versionLocatorLink), + } - response, err := catalogManagementService.PreinstallVersion(preinstallVersionOptions) + result, response, err := catalogManagementService.GetOfferingAbout(getOfferingAboutOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(result).ToNot(BeNil()) + }) + }) - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(202)) + Describe(`GetOfferingLicense - Get version license content`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`GetOfferingLicense(getOfferingLicenseOptions *GetOfferingLicenseOptions)`, func() { + Skip("Not testing") + getOfferingLicenseOptions := &catalogmanagementv1.GetOfferingLicenseOptions{ + VersionLocID: core.StringPtr(versionLocatorLink), + LicenseID: core.StringPtr("testString"), + } - }) + result, response, err := catalogManagementService.GetOfferingLicense(getOfferingLicenseOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(result).ToNot(BeNil()) }) + }) - Describe(`GetPreinstall - Get version pre-install status`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`GetPreinstall(getPreinstallOptions *GetPreinstallOptions)`, func() { + Describe(`GetOfferingContainerImages - Get version's container images`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`GetOfferingContainerImages(getOfferingContainerImagesOptions *GetOfferingContainerImagesOptions)`, func() { + Skip("Not testing") + getOfferingContainerImagesOptions := &catalogmanagementv1.GetOfferingContainerImagesOptions{ + VersionLocID: core.StringPtr(versionLocatorLink), + } - getPreinstallOptions := &catalogmanagementv1.GetPreinstallOptions{ - VersionLocID: core.StringPtr("testString"), - XAuthRefreshToken: core.StringPtr("testString"), - ClusterID: core.StringPtr("testString"), - Region: core.StringPtr("testString"), - Namespace: core.StringPtr("testString"), - } + imageManifest, response, err := catalogManagementService.GetOfferingContainerImages(getOfferingContainerImagesOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(imageManifest).ToNot(BeNil()) + }) + }) - installStatus, response, err := catalogManagementService.GetPreinstall(getPreinstallOptions) + Describe(`ArchiveVersion - Archive version immediately`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`ArchiveVersion(archiveVersionOptions *ArchiveVersionOptions)`, func() { + Skip("Not testing") + archiveVersionOptions := &catalogmanagementv1.ArchiveVersionOptions{ + VersionLocID: core.StringPtr(versionLocatorLink), + } - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(installStatus).ToNot(BeNil()) + response, err := catalogManagementService.ArchiveVersion(archiveVersionOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(202)) + }) + }) - }) + Describe(`SetDeprecateVersion - Sets version to be deprecated in a certain time period`, func() { + BeforeEach(func() { + shouldSkipTest() }) + It(`SetDeprecateVersion(setDeprecateVersionOptions *SetDeprecateVersionOptions)`, func() { + Skip("Not testing") + setDeprecateVersionOptions := &catalogmanagementv1.SetDeprecateVersionOptions{ + VersionLocID: core.StringPtr(versionLocatorLink), + Setting: core.StringPtr("true"), + Description: core.StringPtr("testString"), + DaysUntilDeprecate: core.Int64Ptr(int64(38)), + } - Describe(`ValidateInstall - Validate offering`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`ValidateInstall(validateInstallOptions *ValidateInstallOptions)`, func() { + response, err := catalogManagementService.SetDeprecateVersion(setDeprecateVersionOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(202)) + }) + }) - deployRequestBodySchematicsModel := &catalogmanagementv1.DeployRequestBodySchematics{ - Name: core.StringPtr("testString"), - Description: core.StringPtr("testString"), - Tags: []string{"testString"}, - ResourceGroupID: core.StringPtr("testString"), - } + Describe(`ConsumableVersion - Make version consumable for sharing`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`ConsumableVersion(consumableVersionOptions *ConsumableVersionOptions)`, func() { + Skip("Not testing") + consumableVersionOptions := &catalogmanagementv1.ConsumableVersionOptions{ + VersionLocID: core.StringPtr(versionLocatorLink), + } - validateInstallOptions := &catalogmanagementv1.ValidateInstallOptions{ - VersionLocID: core.StringPtr("testString"), - XAuthRefreshToken: core.StringPtr("testString"), - ClusterID: core.StringPtr("testString"), - Region: core.StringPtr("testString"), - Namespace: core.StringPtr("testString"), - OverrideValues: make(map[string]interface{}), - EntitlementApikey: core.StringPtr("testString"), - Schematics: deployRequestBodySchematicsModel, - Script: core.StringPtr("testString"), - ScriptID: core.StringPtr("testString"), - VersionLocatorID: core.StringPtr("testString"), - VcenterID: core.StringPtr("testString"), - VcenterUser: core.StringPtr("testString"), - VcenterPassword: core.StringPtr("testString"), - VcenterLocation: core.StringPtr("testString"), - VcenterDatastore: core.StringPtr("testString"), - } + response, err := catalogManagementService.ConsumableVersion(consumableVersionOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(202)) + }) + }) - response, err := catalogManagementService.ValidateInstall(validateInstallOptions) + Describe(`SuspendVersion - Suspend a version`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`SuspendVersion(suspendVersionOptions *SuspendVersionOptions)`, func() { + Skip("Not testing") + suspendVersionOptions := &catalogmanagementv1.SuspendVersionOptions{ + VersionLocID: core.StringPtr(versionLocatorLink), + } - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(202)) + response, err := catalogManagementService.SuspendVersion(suspendVersionOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(202)) + }) + }) - }) + Describe(`CommitVersion - Commit version`, func() { + BeforeEach(func() { + shouldSkipTest() }) + It(`CommitVersion(commitVersionOptions *CommitVersionOptions)`, func() { + Skip("Not testing") + commitVersionOptions := &catalogmanagementv1.CommitVersionOptions{ + VersionLocID: core.StringPtr(versionLocatorLink), + } - Describe(`GetValidationStatus - Get offering install status`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`GetValidationStatus(getValidationStatusOptions *GetValidationStatusOptions)`, func() { + response, err := catalogManagementService.CommitVersion(commitVersionOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + }) + }) - getValidationStatusOptions := &catalogmanagementv1.GetValidationStatusOptions{ - VersionLocID: core.StringPtr("testString"), - XAuthRefreshToken: core.StringPtr("testString"), - } + Describe(`CopyVersion - Copy version to new target kind`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`CopyVersion(copyVersionOptions *CopyVersionOptions)`, func() { + Skip("Not testing") + flavorModel := &catalogmanagementv1.Flavor{ + Name: core.StringPtr("testString"), + Label: core.StringPtr("testString"), + LabelI18n: make(map[string]string), + Index: core.Int64Ptr(int64(38)), + } - validation, response, err := catalogManagementService.GetValidationStatus(getValidationStatusOptions) + copyVersionOptions := &catalogmanagementv1.CopyVersionOptions{ + VersionLocID: core.StringPtr(versionLocatorLink), + Tags: []string{"testString"}, + Content: CreateMockByteArray("This is a mock byte array value."), + TargetKinds: []string{targetKindTerraform}, + FormatKind: core.StringPtr(formatKindTerraform), + Flavor: flavorModel, + WorkingDirectory: core.StringPtr("testString"), + } - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(validation).ToNot(BeNil()) + response, err := catalogManagementService.CopyVersion(copyVersionOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + }) + }) - }) + Describe(`GetOfferingWorkingCopy - Create working copy of version`, func() { + BeforeEach(func() { + shouldSkipTest() }) + It(`GetOfferingWorkingCopy(getOfferingWorkingCopyOptions *GetOfferingWorkingCopyOptions)`, func() { + Skip("Not testing") + getOfferingWorkingCopyOptions := &catalogmanagementv1.GetOfferingWorkingCopyOptions{ + VersionLocID: core.StringPtr(versionLocatorLink), + } - Describe(`GetOverrideValues - Get override values`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`GetOverrideValues(getOverrideValuesOptions *GetOverrideValuesOptions)`, func() { + version, response, err := catalogManagementService.GetOfferingWorkingCopy(getOfferingWorkingCopyOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(version).ToNot(BeNil()) + }) + }) - getOverrideValuesOptions := &catalogmanagementv1.GetOverrideValuesOptions{ - VersionLocID: core.StringPtr("testString"), - } + Describe(`CopyFromPreviousVersion - Copy values from a previous version`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`CopyFromPreviousVersion(copyFromPreviousVersionOptions *CopyFromPreviousVersionOptions)`, func() { + Skip("Not testing") + copyFromPreviousVersionOptions := &catalogmanagementv1.CopyFromPreviousVersionOptions{ + VersionLocID: core.StringPtr(versionLocatorLink), + Type: core.StringPtr("testString"), + VersionLocIDToCopyFrom: core.StringPtr("testString"), + } - result, response, err := catalogManagementService.GetOverrideValues(getOverrideValuesOptions) + response, err := catalogManagementService.CopyFromPreviousVersion(copyFromPreviousVersionOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + }) + }) - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(result).ToNot(BeNil()) - - }) - }) - - Describe(`CreateLicenseEntitlement - Create license entitlement`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`CreateLicenseEntitlement(createLicenseEntitlementOptions *CreateLicenseEntitlementOptions)`, func() { - - createLicenseEntitlementOptions := &catalogmanagementv1.CreateLicenseEntitlementOptions{ - Name: core.StringPtr("testString"), - EffectiveFrom: core.StringPtr("testString"), - EffectiveUntil: core.StringPtr("testString"), - VersionID: core.StringPtr("testString"), - LicenseID: core.StringPtr("testString"), - LicenseOwnerID: core.StringPtr("testString"), - LicenseProviderID: core.StringPtr("testString"), - LicenseProductID: core.StringPtr("testString"), - AccountID: core.StringPtr("testString"), - } + Describe(`GetVersion - Get offering/kind/version 'branch'`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`GetVersion(getVersionOptions *GetVersionOptions)`, func() { + getVersionOptions := &catalogmanagementv1.GetVersionOptions{ + VersionLocID: core.StringPtr(versionLocatorLink), + } - licenseEntitlement, response, err := catalogManagementService.CreateLicenseEntitlement(createLicenseEntitlementOptions) + offering, response, err := catalogManagementService.GetVersion(getVersionOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(offering).ToNot(BeNil()) + }) + }) - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(licenseEntitlement).ToNot(BeNil()) + Describe(`DeprecateVersion - Deprecate version immediately - use /archive instead`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`DeprecateVersion(deprecateVersionOptions *DeprecateVersionOptions)`, func() { + Skip("Not testing") + deprecateVersionOptions := &catalogmanagementv1.DeprecateVersionOptions{ + VersionLocID: core.StringPtr(versionLocatorLink), + } - }) + response, err := catalogManagementService.DeprecateVersion(deprecateVersionOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(202)) }) + }) - Describe(`SearchObjects - List objects across catalogs`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`SearchObjects(searchObjectsOptions *SearchObjectsOptions)`, func() { + Describe(`AccountPublishVersion - Publish version to account members`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`AccountPublishVersion(accountPublishVersionOptions *AccountPublishVersionOptions)`, func() { + Skip("Not testing") + accountPublishVersionOptions := &catalogmanagementv1.AccountPublishVersionOptions{ + VersionLocID: core.StringPtr(versionLocatorLink), + } - searchObjectsOptions := &catalogmanagementv1.SearchObjectsOptions{ - Query: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(1000)), - Offset: core.Int64Ptr(int64(38)), - Collapse: core.BoolPtr(true), - } + response, err := catalogManagementService.AccountPublishVersion(accountPublishVersionOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(202)) + }) + }) - objectSearchResult, response, err := catalogManagementService.SearchObjects(searchObjectsOptions) + Describe(`IBMPublishVersion - Publish version to IBMers in public catalog`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`IBMPublishVersion(ibmPublishVersionOptions *IBMPublishVersionOptions)`, func() { + Skip("Not testing") + ibmPublishVersionOptions := &catalogmanagementv1.IBMPublishVersionOptions{ + VersionLocID: core.StringPtr(versionLocatorLink), + } - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(objectSearchResult).ToNot(BeNil()) + response, err := catalogManagementService.IBMPublishVersion(ibmPublishVersionOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(202)) + }) + }) - }) + Describe(`PublicPublishVersion - Publish version to all users in public catalog`, func() { + BeforeEach(func() { + shouldSkipTest() }) + It(`PublicPublishVersion(publicPublishVersionOptions *PublicPublishVersionOptions)`, func() { + Skip("Not testing") + publicPublishVersionOptions := &catalogmanagementv1.PublicPublishVersionOptions{ + VersionLocID: core.StringPtr(versionLocatorLink), + } - Describe(`ListObjects - List objects within a catalog`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`ListObjects(listObjectsOptions *ListObjectsOptions)`, func() { + response, err := catalogManagementService.PublicPublishVersion(publicPublishVersionOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(202)) + }) + }) - listObjectsOptions := &catalogmanagementv1.ListObjectsOptions{ - CatalogIdentifier: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(1000)), - Offset: core.Int64Ptr(int64(38)), - Name: core.StringPtr("testString"), - Sort: core.StringPtr("testString"), - } + Describe(`GetCluster - Get kubernetes cluster`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`GetCluster(getClusterOptions *GetClusterOptions)`, func() { + Skip("Not testing") + getClusterOptions := &catalogmanagementv1.GetClusterOptions{ + ClusterID: core.StringPtr("testString"), + Region: core.StringPtr("testString"), + XAuthRefreshToken: core.StringPtr("testString"), + } - objectListResult, response, err := catalogManagementService.ListObjects(listObjectsOptions) + clusterInfo, response, err := catalogManagementService.GetCluster(getClusterOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(clusterInfo).ToNot(BeNil()) + }) + }) - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(objectListResult).ToNot(BeNil()) + Describe(`GetNamespaces - Get cluster namespaces`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`GetNamespaces(getNamespacesOptions *GetNamespacesOptions)`, func() { + Skip("Not testing") + getNamespacesOptions := &catalogmanagementv1.GetNamespacesOptions{ + ClusterID: core.StringPtr("testString"), + Region: core.StringPtr("testString"), + XAuthRefreshToken: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(1000)), + Offset: core.Int64Ptr(int64(38)), + } - }) + namespaceSearchResult, response, err := catalogManagementService.GetNamespaces(getNamespacesOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(namespaceSearchResult).ToNot(BeNil()) }) + }) - Describe(`CreateObject - Create catalog object`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`CreateObject(createObjectOptions *CreateObjectOptions)`, func() { + Describe(`DeployOperators - Deploy operators`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`DeployOperators(deployOperatorsOptions *DeployOperatorsOptions)`, func() { + Skip("Not testing") + deployOperatorsOptions := &catalogmanagementv1.DeployOperatorsOptions{ + XAuthRefreshToken: core.StringPtr("testString"), + ClusterID: core.StringPtr("testString"), + Region: core.StringPtr("testString"), + Namespaces: []string{"testString"}, + AllNamespaces: core.BoolPtr(true), + VersionLocatorID: core.StringPtr("testString"), + Channel: core.StringPtr("testString"), + InstallPlan: core.StringPtr("testString"), + } - publishObjectModel := &catalogmanagementv1.PublishObject{ - PermitIBMPublicPublish: core.BoolPtr(true), - IBMApproved: core.BoolPtr(true), - PublicApproved: core.BoolPtr(true), - PortalApprovalRecord: core.StringPtr("testString"), - PortalURL: core.StringPtr("testString"), - } + operatorDeployResult, response, err := catalogManagementService.DeployOperators(deployOperatorsOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(operatorDeployResult).ToNot(BeNil()) + }) + }) - stateModel := &catalogmanagementv1.State{ - Current: core.StringPtr("testString"), - CurrentEntered: CreateMockDateTime(), - Pending: core.StringPtr("testString"), - PendingRequested: CreateMockDateTime(), - Previous: core.StringPtr("testString"), - } + Describe(`ListOperators - List operators`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`ListOperators(listOperatorsOptions *ListOperatorsOptions)`, func() { + Skip("Not testing") + listOperatorsOptions := &catalogmanagementv1.ListOperatorsOptions{ + XAuthRefreshToken: core.StringPtr("testString"), + ClusterID: core.StringPtr("testString"), + Region: core.StringPtr("testString"), + VersionLocatorID: core.StringPtr("testString"), + } - createObjectOptions := &catalogmanagementv1.CreateObjectOptions{ - CatalogIdentifier: core.StringPtr("testString"), - ID: core.StringPtr("testString"), - Name: core.StringPtr("testString"), - Rev: core.StringPtr("testString"), - CRN: core.StringPtr("testString"), - URL: core.StringPtr("testString"), - ParentID: core.StringPtr("testString"), - LabelI18n: core.StringPtr("testString"), - Label: core.StringPtr("testString"), - Tags: []string{"testString"}, - Created: CreateMockDateTime(), - Updated: CreateMockDateTime(), - ShortDescription: core.StringPtr("testString"), - ShortDescriptionI18n: core.StringPtr("testString"), - Kind: core.StringPtr("testString"), - Publish: publishObjectModel, - State: stateModel, - CatalogID: core.StringPtr("testString"), - CatalogName: core.StringPtr("testString"), - Data: make(map[string]interface{}), - } + operatorDeployResult, response, err := catalogManagementService.ListOperators(listOperatorsOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(operatorDeployResult).ToNot(BeNil()) + }) + }) - catalogObject, response, err := catalogManagementService.CreateObject(createObjectOptions) + Describe(`ReplaceOperators - Update operators`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`ReplaceOperators(replaceOperatorsOptions *ReplaceOperatorsOptions)`, func() { + Skip("Not testing") + replaceOperatorsOptions := &catalogmanagementv1.ReplaceOperatorsOptions{ + XAuthRefreshToken: core.StringPtr("testString"), + ClusterID: core.StringPtr("testString"), + Region: core.StringPtr("testString"), + Namespaces: []string{"testString"}, + AllNamespaces: core.BoolPtr(true), + VersionLocatorID: core.StringPtr("testString"), + Channel: core.StringPtr("testString"), + InstallPlan: core.StringPtr("testString"), + } - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(201)) - Expect(catalogObject).ToNot(BeNil()) + operatorDeployResult, response, err := catalogManagementService.ReplaceOperators(replaceOperatorsOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(operatorDeployResult).ToNot(BeNil()) + }) + }) - }) + Describe(`InstallVersion - Install version`, func() { + BeforeEach(func() { + shouldSkipTest() }) + It(`InstallVersion(installVersionOptions *InstallVersionOptions)`, func() { + Skip("Not testing") + deployRequestBodyOverrideValuesModel := &catalogmanagementv1.DeployRequestBodyOverrideValues{ + VsiInstanceName: core.StringPtr("testString"), + VPCProfile: core.StringPtr("testString"), + SubnetID: core.StringPtr("testString"), + VPCID: core.StringPtr("testString"), + SubnetZone: core.StringPtr("testString"), + SSHKeyID: core.StringPtr("testString"), + VPCRegion: core.StringPtr("testString"), + } + deployRequestBodyOverrideValuesModel.SetProperty("foo", core.StringPtr("testString")) - Describe(`GetObject - Get catalog object`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`GetObject(getObjectOptions *GetObjectOptions)`, func() { + deployRequestBodyEnvironmentVariablesItemModel := &catalogmanagementv1.DeployRequestBodyEnvironmentVariablesItem{ + Name: core.StringPtr("testString"), + Value: core.StringPtr("testString"), + Secure: core.BoolPtr(true), + } - getObjectOptions := &catalogmanagementv1.GetObjectOptions{ - CatalogIdentifier: core.StringPtr("testString"), - ObjectIdentifier: core.StringPtr("testString"), - } + deployRequestBodySchematicsModel := &catalogmanagementv1.DeployRequestBodySchematics{ + Name: core.StringPtr("testString"), + Description: core.StringPtr("testString"), + Tags: []string{"testString"}, + ResourceGroupID: core.StringPtr("testString"), + TerraformVersion: core.StringPtr("testString"), + Region: core.StringPtr("testString"), + } - catalogObject, response, err := catalogManagementService.GetObject(getObjectOptions) + installVersionOptions := &catalogmanagementv1.InstallVersionOptions{ + VersionLocID: core.StringPtr(versionLocatorLink), + XAuthRefreshToken: core.StringPtr("testString"), + ClusterID: core.StringPtr("testString"), + Region: core.StringPtr("testString"), + Namespace: core.StringPtr("testString"), + OverrideValues: deployRequestBodyOverrideValuesModel, + EnvironmentVariables: []catalogmanagementv1.DeployRequestBodyEnvironmentVariablesItem{*deployRequestBodyEnvironmentVariablesItemModel}, + EntitlementApikey: core.StringPtr("testString"), + Schematics: deployRequestBodySchematicsModel, + Script: core.StringPtr("testString"), + ScriptID: core.StringPtr("testString"), + VersionLocatorID: core.StringPtr("testString"), + VcenterID: core.StringPtr("testString"), + VcenterLocation: core.StringPtr("testString"), + VcenterUser: core.StringPtr("testString"), + VcenterPassword: core.StringPtr("testString"), + VcenterDatastore: core.StringPtr("testString"), + } - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(catalogObject).ToNot(BeNil()) + response, err := catalogManagementService.InstallVersion(installVersionOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(202)) + }) + }) - }) + Describe(`PreinstallVersion - Pre-install version`, func() { + BeforeEach(func() { + shouldSkipTest() }) + It(`PreinstallVersion(preinstallVersionOptions *PreinstallVersionOptions)`, func() { + Skip("Not testing") + deployRequestBodyOverrideValuesModel := &catalogmanagementv1.DeployRequestBodyOverrideValues{ + VsiInstanceName: core.StringPtr("testString"), + VPCProfile: core.StringPtr("testString"), + SubnetID: core.StringPtr("testString"), + VPCID: core.StringPtr("testString"), + SubnetZone: core.StringPtr("testString"), + SSHKeyID: core.StringPtr("testString"), + VPCRegion: core.StringPtr("testString"), + } + deployRequestBodyOverrideValuesModel.SetProperty("foo", core.StringPtr("testString")) - Describe(`ReplaceObject - Update catalog object`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`ReplaceObject(replaceObjectOptions *ReplaceObjectOptions)`, func() { + deployRequestBodyEnvironmentVariablesItemModel := &catalogmanagementv1.DeployRequestBodyEnvironmentVariablesItem{ + Name: core.StringPtr("testString"), + Value: core.StringPtr("testString"), + Secure: core.BoolPtr(true), + } - publishObjectModel := &catalogmanagementv1.PublishObject{ - PermitIBMPublicPublish: core.BoolPtr(true), - IBMApproved: core.BoolPtr(true), - PublicApproved: core.BoolPtr(true), - PortalApprovalRecord: core.StringPtr("testString"), - PortalURL: core.StringPtr("testString"), - } + deployRequestBodySchematicsModel := &catalogmanagementv1.DeployRequestBodySchematics{ + Name: core.StringPtr("testString"), + Description: core.StringPtr("testString"), + Tags: []string{"testString"}, + ResourceGroupID: core.StringPtr("testString"), + TerraformVersion: core.StringPtr("testString"), + Region: core.StringPtr("testString"), + } - stateModel := &catalogmanagementv1.State{ - Current: core.StringPtr("testString"), - CurrentEntered: CreateMockDateTime(), - Pending: core.StringPtr("testString"), - PendingRequested: CreateMockDateTime(), - Previous: core.StringPtr("testString"), - } + preinstallVersionOptions := &catalogmanagementv1.PreinstallVersionOptions{ + VersionLocID: core.StringPtr(versionLocatorLink), + XAuthRefreshToken: core.StringPtr("testString"), + ClusterID: core.StringPtr("testString"), + Region: core.StringPtr("testString"), + Namespace: core.StringPtr("testString"), + OverrideValues: deployRequestBodyOverrideValuesModel, + EnvironmentVariables: []catalogmanagementv1.DeployRequestBodyEnvironmentVariablesItem{*deployRequestBodyEnvironmentVariablesItemModel}, + EntitlementApikey: core.StringPtr("testString"), + Schematics: deployRequestBodySchematicsModel, + Script: core.StringPtr("testString"), + ScriptID: core.StringPtr("testString"), + VersionLocatorID: core.StringPtr("testString"), + VcenterID: core.StringPtr("testString"), + VcenterLocation: core.StringPtr("testString"), + VcenterUser: core.StringPtr("testString"), + VcenterPassword: core.StringPtr("testString"), + VcenterDatastore: core.StringPtr("testString"), + } - replaceObjectOptions := &catalogmanagementv1.ReplaceObjectOptions{ - CatalogIdentifier: core.StringPtr("testString"), - ObjectIdentifier: core.StringPtr("testString"), - ID: core.StringPtr("testString"), - Name: core.StringPtr("testString"), - Rev: core.StringPtr("testString"), - CRN: core.StringPtr("testString"), - URL: core.StringPtr("testString"), - ParentID: core.StringPtr("testString"), - LabelI18n: core.StringPtr("testString"), - Label: core.StringPtr("testString"), - Tags: []string{"testString"}, - Created: CreateMockDateTime(), - Updated: CreateMockDateTime(), - ShortDescription: core.StringPtr("testString"), - ShortDescriptionI18n: core.StringPtr("testString"), - Kind: core.StringPtr("testString"), - Publish: publishObjectModel, - State: stateModel, - CatalogID: core.StringPtr("testString"), - CatalogName: core.StringPtr("testString"), - Data: make(map[string]interface{}), - } + response, err := catalogManagementService.PreinstallVersion(preinstallVersionOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(202)) + }) + }) + + Describe(`GetPreinstall - Get version pre-install status`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`GetPreinstall(getPreinstallOptions *GetPreinstallOptions)`, func() { + Skip("Not testing") + getPreinstallOptions := &catalogmanagementv1.GetPreinstallOptions{ + VersionLocID: core.StringPtr(versionLocatorLink), + XAuthRefreshToken: core.StringPtr("testString"), + ClusterID: core.StringPtr("testString"), + Region: core.StringPtr("testString"), + Namespace: core.StringPtr("testString"), + } + + installStatus, response, err := catalogManagementService.GetPreinstall(getPreinstallOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(installStatus).ToNot(BeNil()) + }) + }) + + Describe(`ValidateInstall - Validate offering`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`ValidateInstall(validateInstallOptions *ValidateInstallOptions)`, func() { + Skip("Not testing") + deployRequestBodyOverrideValuesModel := &catalogmanagementv1.DeployRequestBodyOverrideValues{ + VsiInstanceName: core.StringPtr("testString"), + VPCProfile: core.StringPtr("testString"), + SubnetID: core.StringPtr("testString"), + VPCID: core.StringPtr("testString"), + SubnetZone: core.StringPtr("testString"), + SSHKeyID: core.StringPtr("testString"), + VPCRegion: core.StringPtr("testString"), + } + deployRequestBodyOverrideValuesModel.SetProperty("foo", core.StringPtr("testString")) + + deployRequestBodyEnvironmentVariablesItemModel := &catalogmanagementv1.DeployRequestBodyEnvironmentVariablesItem{ + Name: core.StringPtr("testString"), + Value: core.StringPtr("testString"), + Secure: core.BoolPtr(true), + } + + deployRequestBodySchematicsModel := &catalogmanagementv1.DeployRequestBodySchematics{ + Name: core.StringPtr("testString"), + Description: core.StringPtr("testString"), + Tags: []string{"testString"}, + ResourceGroupID: core.StringPtr("testString"), + TerraformVersion: core.StringPtr("testString"), + Region: core.StringPtr("testString"), + } + + validateInstallOptions := &catalogmanagementv1.ValidateInstallOptions{ + VersionLocID: core.StringPtr(versionLocatorLink), + XAuthRefreshToken: core.StringPtr("testString"), + ClusterID: core.StringPtr("testString"), + Region: core.StringPtr("testString"), + Namespace: core.StringPtr("testString"), + OverrideValues: deployRequestBodyOverrideValuesModel, + EnvironmentVariables: []catalogmanagementv1.DeployRequestBodyEnvironmentVariablesItem{*deployRequestBodyEnvironmentVariablesItemModel}, + EntitlementApikey: core.StringPtr("testString"), + Schematics: deployRequestBodySchematicsModel, + Script: core.StringPtr("testString"), + ScriptID: core.StringPtr("testString"), + VersionLocatorID: core.StringPtr("testString"), + VcenterID: core.StringPtr("testString"), + VcenterLocation: core.StringPtr("testString"), + VcenterUser: core.StringPtr("testString"), + VcenterPassword: core.StringPtr("testString"), + VcenterDatastore: core.StringPtr("testString"), + } + + response, err := catalogManagementService.ValidateInstall(validateInstallOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(202)) + }) + }) - catalogObject, response, err := catalogManagementService.ReplaceObject(replaceObjectOptions) + Describe(`GetValidationStatus - Get offering install status`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`GetValidationStatus(getValidationStatusOptions *GetValidationStatusOptions)`, func() { + Skip("Not testing") + getValidationStatusOptions := &catalogmanagementv1.GetValidationStatusOptions{ + VersionLocID: core.StringPtr(versionLocatorLink), + XAuthRefreshToken: core.StringPtr("testString"), + } + validation, response, err := catalogManagementService.GetValidationStatus(getValidationStatusOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(validation).ToNot(BeNil()) + }) + }) + + Describe(`GetOverrideValues - Get override values`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`GetOverrideValues(getOverrideValuesOptions *GetOverrideValuesOptions)`, func() { + Skip("Not testing") + getOverrideValuesOptions := &catalogmanagementv1.GetOverrideValuesOptions{ + VersionLocID: core.StringPtr(versionLocatorLink), + } + + result, response, err := catalogManagementService.GetOverrideValues(getOverrideValuesOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(result).ToNot(BeNil()) + }) + }) + + Describe(`CreateOfferingInstance - Create an offering resource instance`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`CreateOfferingInstance(createOfferingInstanceOptions *CreateOfferingInstanceOptions)`, func() { + Skip("Not testing") + offeringInstanceLastOperationModel := &catalogmanagementv1.OfferingInstanceLastOperation{ + Operation: core.StringPtr("testString"), + State: core.StringPtr("testString"), + Message: core.StringPtr("testString"), + TransactionID: core.StringPtr("testString"), + Updated: CreateMockDateTime("2019-01-01T12:00:00.000Z"), + Code: core.StringPtr("testString"), + } + + createOfferingInstanceOptions := &catalogmanagementv1.CreateOfferingInstanceOptions{ + XAuthRefreshToken: core.StringPtr("testString"), + ID: core.StringPtr("testString"), + Rev: core.StringPtr("testString"), + URL: core.StringPtr("testString"), + CRN: core.StringPtr("testString"), + Label: core.StringPtr("testString"), + CatalogID: core.StringPtr("testString"), + OfferingID: core.StringPtr("testString"), + KindFormat: core.StringPtr("testString"), + Version: core.StringPtr("testString"), + VersionID: core.StringPtr("testString"), + ClusterID: core.StringPtr("testString"), + ClusterRegion: core.StringPtr("testString"), + ClusterNamespaces: []string{"testString"}, + ClusterAllNamespaces: core.BoolPtr(true), + SchematicsWorkspaceID: core.StringPtr("testString"), + InstallPlan: core.StringPtr("testString"), + Channel: core.StringPtr("testString"), + Created: CreateMockDateTime("2019-01-01T12:00:00.000Z"), + Updated: CreateMockDateTime("2019-01-01T12:00:00.000Z"), + Metadata: make(map[string]interface{}), + ResourceGroupID: core.StringPtr("testString"), + Location: core.StringPtr("testString"), + Disabled: core.BoolPtr(true), + Account: core.StringPtr("testString"), + LastOperation: offeringInstanceLastOperationModel, + KindTarget: core.StringPtr("testString"), + Sha: core.StringPtr("testString"), + } + + offeringInstance, response, err := catalogManagementService.CreateOfferingInstance(createOfferingInstanceOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(201)) + Expect(offeringInstance).ToNot(BeNil()) + }) + }) + + Describe(`GetOfferingInstance - Get Offering Instance`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`GetOfferingInstance(getOfferingInstanceOptions *GetOfferingInstanceOptions)`, func() { + Skip("Not testing") + getOfferingInstanceOptions := &catalogmanagementv1.GetOfferingInstanceOptions{ + InstanceIdentifier: core.StringPtr("testString"), + } + + offeringInstance, response, err := catalogManagementService.GetOfferingInstance(getOfferingInstanceOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(offeringInstance).ToNot(BeNil()) + }) + }) + + Describe(`PutOfferingInstance - Update Offering Instance`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`PutOfferingInstance(putOfferingInstanceOptions *PutOfferingInstanceOptions)`, func() { + Skip("Not testing") + offeringInstanceLastOperationModel := &catalogmanagementv1.OfferingInstanceLastOperation{ + Operation: core.StringPtr("testString"), + State: core.StringPtr("testString"), + Message: core.StringPtr("testString"), + TransactionID: core.StringPtr("testString"), + Updated: CreateMockDateTime("2019-01-01T12:00:00.000Z"), + Code: core.StringPtr("testString"), + } + + putOfferingInstanceOptions := &catalogmanagementv1.PutOfferingInstanceOptions{ + InstanceIdentifier: core.StringPtr("testString"), + XAuthRefreshToken: core.StringPtr("testString"), + ID: core.StringPtr("testString"), + Rev: core.StringPtr("testString"), + URL: core.StringPtr("testString"), + CRN: core.StringPtr("testString"), + Label: core.StringPtr("testString"), + CatalogID: core.StringPtr("testString"), + OfferingID: core.StringPtr("testString"), + KindFormat: core.StringPtr("testString"), + Version: core.StringPtr("testString"), + VersionID: core.StringPtr("testString"), + ClusterID: core.StringPtr("testString"), + ClusterRegion: core.StringPtr("testString"), + ClusterNamespaces: []string{"testString"}, + ClusterAllNamespaces: core.BoolPtr(true), + SchematicsWorkspaceID: core.StringPtr("testString"), + InstallPlan: core.StringPtr("testString"), + Channel: core.StringPtr("testString"), + Created: CreateMockDateTime("2019-01-01T12:00:00.000Z"), + Updated: CreateMockDateTime("2019-01-01T12:00:00.000Z"), + Metadata: make(map[string]interface{}), + ResourceGroupID: core.StringPtr("testString"), + Location: core.StringPtr("testString"), + Disabled: core.BoolPtr(true), + Account: core.StringPtr("testString"), + LastOperation: offeringInstanceLastOperationModel, + KindTarget: core.StringPtr("testString"), + Sha: core.StringPtr("testString"), + } + + offeringInstance, response, err := catalogManagementService.PutOfferingInstance(putOfferingInstanceOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(offeringInstance).ToNot(BeNil()) + }) + }) + + Describe(`ListOfferingInstanceAudits - Get offering instance audit logs`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`ListOfferingInstanceAudits(listOfferingInstanceAuditsOptions *ListOfferingInstanceAuditsOptions) with pagination`, func() { + Skip("Not testing") + listOfferingInstanceAuditsOptions := &catalogmanagementv1.ListOfferingInstanceAuditsOptions{ + InstanceIdentifier: core.StringPtr("testString"), + Start: core.StringPtr(""), + Limit: core.Int64Ptr(int64(10)), + Lookupnames: core.BoolPtr(true), + } + + listOfferingInstanceAuditsOptions.Start = nil + listOfferingInstanceAuditsOptions.Limit = core.Int64Ptr(1) + + var allResults []catalogmanagementv1.AuditLogDigest + for { + auditLogs, response, err := catalogManagementService.ListOfferingInstanceAudits(listOfferingInstanceAuditsOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) - Expect(catalogObject).ToNot(BeNil()) + Expect(auditLogs).ToNot(BeNil()) + allResults = append(allResults, auditLogs.Audits...) + + listOfferingInstanceAuditsOptions.Start, err = auditLogs.GetNextStart() + Expect(err).To(BeNil()) + + if listOfferingInstanceAuditsOptions.Start == nil { + break + } + } + fmt.Fprintf(GinkgoWriter, "Retrieved a total of %d item(s) with pagination.\n", len(allResults)) + }) + It(`ListOfferingInstanceAudits(listOfferingInstanceAuditsOptions *ListOfferingInstanceAuditsOptions) using OfferingInstanceAuditsPager`, func() { + Skip("Not testing") + listOfferingInstanceAuditsOptions := &catalogmanagementv1.ListOfferingInstanceAuditsOptions{ + InstanceIdentifier: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + Lookupnames: core.BoolPtr(true), + } + + // Test GetNext(). + pager, err := catalogManagementService.NewOfferingInstanceAuditsPager(listOfferingInstanceAuditsOptions) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []catalogmanagementv1.AuditLogDigest + for pager.HasNext() { + nextPage, err := pager.GetNext() + Expect(err).To(BeNil()) + Expect(nextPage).ToNot(BeNil()) + allResults = append(allResults, nextPage...) + } + + // Test GetAll(). + pager, err = catalogManagementService.NewOfferingInstanceAuditsPager(listOfferingInstanceAuditsOptions) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + allItems, err := pager.GetAll() + Expect(err).To(BeNil()) + Expect(allItems).ToNot(BeNil()) + + Expect(len(allItems)).To(Equal(len(allResults))) + fmt.Fprintf(GinkgoWriter, "ListOfferingInstanceAudits() returned a total of %d item(s) using OfferingInstanceAuditsPager.\n", len(allResults)) + }) + }) + + Describe(`GetOfferingInstanceAudit - Get an offering instance audit log entry`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`GetOfferingInstanceAudit(getOfferingInstanceAuditOptions *GetOfferingInstanceAuditOptions)`, func() { + Skip("Not testing") + getOfferingInstanceAuditOptions := &catalogmanagementv1.GetOfferingInstanceAuditOptions{ + InstanceIdentifier: core.StringPtr("testString"), + AuditlogIdentifier: core.StringPtr("testString"), + Lookupnames: core.BoolPtr(true), + } + + auditLog, response, err := catalogManagementService.GetOfferingInstanceAudit(getOfferingInstanceAuditOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(auditLog).ToNot(BeNil()) + }) + }) + + Describe(`DeleteOfferingAccessList - Delete accesses from offering access list`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`DeleteOfferingAccessList(deleteOfferingAccessListOptions *DeleteOfferingAccessListOptions)`, func() { + deleteOfferingAccessListOptions := &catalogmanagementv1.DeleteOfferingAccessListOptions{ + CatalogIdentifier: &catalogIDLink, + OfferingID: &offeringIDLink, + Accesses: []string{accountID}, + } + + accessListBulkResponse, response, err := catalogManagementService.DeleteOfferingAccessList(deleteOfferingAccessListOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(accessListBulkResponse).ToNot(BeNil()) + }) + }) + + Describe(`DeleteOperators - Delete operators`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`DeleteOperators(deleteOperatorsOptions *DeleteOperatorsOptions)`, func() { + Skip("Not testing") + deleteOperatorsOptions := &catalogmanagementv1.DeleteOperatorsOptions{ + XAuthRefreshToken: core.StringPtr("testString"), + ClusterID: core.StringPtr("testString"), + Region: core.StringPtr("testString"), + VersionLocatorID: core.StringPtr("testString"), + } + + response, err := catalogManagementService.DeleteOperators(deleteOperatorsOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + }) + }) + + Describe(`DeleteOfferingInstance - Delete a version instance`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`DeleteOfferingInstance(deleteOfferingInstanceOptions *DeleteOfferingInstanceOptions)`, func() { + Skip("Not testing") + deleteOfferingInstanceOptions := &catalogmanagementv1.DeleteOfferingInstanceOptions{ + InstanceIdentifier: core.StringPtr("testString"), + XAuthRefreshToken: core.StringPtr("testString"), + } + + response, err := catalogManagementService.DeleteOfferingInstance(deleteOfferingInstanceOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + }) + }) + + Describe(`DeleteVersion - Delete version`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`DeleteVersion(deleteVersionOptions *DeleteVersionOptions)`, func() { + deleteVersionOptions := &catalogmanagementv1.DeleteVersionOptions{ + VersionLocID: core.StringPtr(versionLocatorLink), + } - }) + response, err := catalogManagementService.DeleteVersion(deleteVersionOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) }) + }) - Describe(`GetObjectAudit - Get catalog object audit log`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`GetObjectAudit(getObjectAuditOptions *GetObjectAuditOptions)`, func() { + Describe(`DeleteOffering - Delete offering`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`DeleteOffering(deleteOfferingOptions *DeleteOfferingOptions)`, func() { + deleteOfferingOptions := &catalogmanagementv1.DeleteOfferingOptions{ + CatalogIdentifier: &catalogIDLink, + OfferingID: &offeringIDLink, + } - getObjectAuditOptions := &catalogmanagementv1.GetObjectAuditOptions{ - CatalogIdentifier: core.StringPtr("testString"), - ObjectIdentifier: core.StringPtr("testString"), - } + response, err := catalogManagementService.DeleteOffering(deleteOfferingOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + }) + }) - auditLog, response, err := catalogManagementService.GetObjectAudit(getObjectAuditOptions) + Describe(`DeleteCatalog - Delete catalog`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`DeleteCatalog(deleteCatalogOptions *DeleteCatalogOptions)`, func() { + deleteCatalogOptions := &catalogmanagementv1.DeleteCatalogOptions{ + CatalogIdentifier: &catalogIDLink, + } - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(auditLog).ToNot(BeNil()) + response, err := catalogManagementService.DeleteCatalog(deleteCatalogOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + }) + }) - }) + Describe(`CreateCatalog - Create a catalog`, func() { + BeforeEach(func() { + shouldSkipTest() }) + It(`CreateCatalog(createCatalogOptions *CreateCatalogOptions)`, func() { + featureModel := &catalogmanagementv1.Feature{ + Title: core.StringPtr("testString"), + TitleI18n: make(map[string]string), + Description: core.StringPtr("testString"), + DescriptionI18n: make(map[string]string), + } - Describe(`AccountPublishObject - Publish object to account`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`AccountPublishObject(accountPublishObjectOptions *AccountPublishObjectOptions)`, func() { + filterTermsModel := &catalogmanagementv1.FilterTerms{ + FilterTerms: []string{"testString"}, + } - accountPublishObjectOptions := &catalogmanagementv1.AccountPublishObjectOptions{ - CatalogIdentifier: core.StringPtr("testString"), - ObjectIdentifier: core.StringPtr("testString"), - } + categoryFilterModel := &catalogmanagementv1.CategoryFilter{ + Include: core.BoolPtr(true), + Filter: filterTermsModel, + } - response, err := catalogManagementService.AccountPublishObject(accountPublishObjectOptions) + idFilterModel := &catalogmanagementv1.IDFilter{ + Include: filterTermsModel, + Exclude: filterTermsModel, + } - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(202)) + filtersModel := &catalogmanagementv1.Filters{ + IncludeAll: core.BoolPtr(true), + CategoryFilters: make(map[string]catalogmanagementv1.CategoryFilter), + IDFilters: idFilterModel, + } + filtersModel.CategoryFilters["foo"] = *categoryFilterModel + + syndicationClusterModel := &catalogmanagementv1.SyndicationCluster{ + Region: core.StringPtr("testString"), + ID: core.StringPtr("testString"), + Name: core.StringPtr("testString"), + ResourceGroupName: core.StringPtr("testString"), + Type: core.StringPtr("testString"), + Namespaces: []string{"testString"}, + AllNamespaces: core.BoolPtr(true), + } - }) - }) + syndicationHistoryModel := &catalogmanagementv1.SyndicationHistory{ + Namespaces: []string{"testString"}, + Clusters: []catalogmanagementv1.SyndicationCluster{*syndicationClusterModel}, + LastRun: CreateMockDateTime("2019-01-01T12:00:00.000Z"), + } - Describe(`SharedPublishObject - Publish object to share with allow list`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`SharedPublishObject(sharedPublishObjectOptions *SharedPublishObjectOptions)`, func() { + syndicationAuthorizationModel := &catalogmanagementv1.SyndicationAuthorization{ + Token: core.StringPtr("testString"), + LastRun: CreateMockDateTime("2019-01-01T12:00:00.000Z"), + } - sharedPublishObjectOptions := &catalogmanagementv1.SharedPublishObjectOptions{ - CatalogIdentifier: core.StringPtr("testString"), - ObjectIdentifier: core.StringPtr("testString"), - } + syndicationResourceModel := &catalogmanagementv1.SyndicationResource{ + RemoveRelatedComponents: core.BoolPtr(true), + Clusters: []catalogmanagementv1.SyndicationCluster{*syndicationClusterModel}, + History: syndicationHistoryModel, + Authorization: syndicationAuthorizationModel, + } - response, err := catalogManagementService.SharedPublishObject(sharedPublishObjectOptions) + createCatalogOptions := &catalogmanagementv1.CreateCatalogOptions{ + ID: &catalogIDLink, + Rev: &catalogRevLink, + Label: core.StringPtr("testString"), + LabelI18n: make(map[string]string), + ShortDescription: core.StringPtr("testString"), + ShortDescriptionI18n: make(map[string]string), + CatalogIconURL: core.StringPtr("testString"), + Tags: []string{"testString"}, + Features: []catalogmanagementv1.Feature{*featureModel}, + Disabled: core.BoolPtr(true), + OwningAccount: core.StringPtr("testString"), + CatalogFilters: filtersModel, + SyndicationSettings: syndicationResourceModel, + Kind: core.StringPtr("vpe"), + Metadata: make(map[string]interface{}), + } - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(202)) + catalog, response, err := catalogManagementService.CreateCatalog(createCatalogOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(201)) + Expect(catalog).ToNot(BeNil()) - }) + catalogIDLink = *catalog.ID + fmt.Fprintf(GinkgoWriter, "Saved catalogIDLink value: %v\n", catalogIDLink) + catalogRevLink = *catalog.Rev + fmt.Fprintf(GinkgoWriter, "Saved catalogRevLink value: %v\n", catalogRevLink) }) + }) - Describe(`IBMPublishObject - Publish object to share with IBMers`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`IBMPublishObject(ibmPublishObjectOptions *IBMPublishObjectOptions)`, func() { + Describe(`CreateObject - Create catalog object`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`CreateObject(createObjectOptions *CreateObjectOptions)`, func() { + publishObjectModel := &catalogmanagementv1.PublishObject{ + PermitIBMPublicPublish: core.BoolPtr(true), + IBMApproved: core.BoolPtr(true), + PublicApproved: core.BoolPtr(true), + PortalApprovalRecord: core.StringPtr("testString"), + PortalURL: core.StringPtr("testString"), + } - ibmPublishObjectOptions := &catalogmanagementv1.IBMPublishObjectOptions{ - CatalogIdentifier: core.StringPtr("testString"), - ObjectIdentifier: core.StringPtr("testString"), - } + stateModel := &catalogmanagementv1.State{ + Current: core.StringPtr("testString"), + CurrentEntered: CreateMockDateTime("2019-01-01T12:00:00.000Z"), + Pending: core.StringPtr("testString"), + PendingRequested: CreateMockDateTime("2019-01-01T12:00:00.000Z"), + Previous: core.StringPtr("testString"), + } - response, err := catalogManagementService.IBMPublishObject(ibmPublishObjectOptions) + createObjectOptions := &catalogmanagementv1.CreateObjectOptions{ + CatalogIdentifier: &catalogIDLink, + ID: &objectIDLink, + Name: core.StringPtr("testString"), + Rev: &objectRevLink, + CRN: core.StringPtr("testString"), + URL: core.StringPtr("testString"), + ParentID: core.StringPtr("us-south"), + LabelI18n: make(map[string]string), + Label: core.StringPtr("testString"), + Tags: []string{"testString"}, + Created: CreateMockDateTime("2019-01-01T12:00:00.000Z"), + Updated: CreateMockDateTime("2019-01-01T12:00:00.000Z"), + ShortDescription: core.StringPtr("testString"), + ShortDescriptionI18n: make(map[string]string), + Kind: core.StringPtr("vpe"), + Publish: publishObjectModel, + State: stateModel, + CatalogID: &catalogIDLink, + CatalogName: core.StringPtr("testString"), + Data: make(map[string]interface{}), + } - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(202)) + catalogObject, response, err := catalogManagementService.CreateObject(createObjectOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(201)) + Expect(catalogObject).ToNot(BeNil()) - }) + objectIDLink = *catalogObject.ID + fmt.Fprintf(GinkgoWriter, "Saved objectIDLink value: %v\n", objectIDLink) + objectRevLink = *catalogObject.Rev + fmt.Fprintf(GinkgoWriter, "Saved objectRevLink value: %v\n", objectRevLink) }) + }) - Describe(`PublicPublishObject - Publish object to share with all users`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`PublicPublishObject(publicPublishObjectOptions *PublicPublishObjectOptions)`, func() { - - publicPublishObjectOptions := &catalogmanagementv1.PublicPublishObjectOptions{ - CatalogIdentifier: core.StringPtr("testString"), - ObjectIdentifier: core.StringPtr("testString"), - } - - response, err := catalogManagementService.PublicPublishObject(publicPublishObjectOptions) + Describe(`GetObject - Get catalog object`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`GetObject(getObjectOptions *GetObjectOptions)`, func() { + getObjectOptions := &catalogmanagementv1.GetObjectOptions{ + CatalogIdentifier: &catalogIDLink, + ObjectIdentifier: &objectIDLink, + } - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(202)) + catalogObject, response, err := catalogManagementService.GetObject(getObjectOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(catalogObject).ToNot(BeNil()) - }) + objectRevLink = *catalogObject.Rev + fmt.Fprintf(GinkgoWriter, "Saved objectRevLink value: %v\n", objectRevLink) }) + }) - Describe(`CreateObjectAccess - Add account ID to object access list`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`CreateObjectAccess(createObjectAccessOptions *CreateObjectAccessOptions)`, func() { + Describe(`ReplaceObject - Update catalog object`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`ReplaceObject(replaceObjectOptions *ReplaceObjectOptions)`, func() { + publishObjectModel := &catalogmanagementv1.PublishObject{ + PermitIBMPublicPublish: core.BoolPtr(true), + IBMApproved: core.BoolPtr(true), + PublicApproved: core.BoolPtr(true), + PortalApprovalRecord: core.StringPtr("testString"), + PortalURL: core.StringPtr("testString"), + } - createObjectAccessOptions := &catalogmanagementv1.CreateObjectAccessOptions{ - CatalogIdentifier: core.StringPtr("testString"), - ObjectIdentifier: core.StringPtr("testString"), - AccountIdentifier: core.StringPtr("testString"), - } + stateModel := &catalogmanagementv1.State{ + Current: core.StringPtr("testString"), + CurrentEntered: CreateMockDateTime("2019-01-01T12:00:00.000Z"), + Pending: core.StringPtr("testString"), + PendingRequested: CreateMockDateTime("2019-01-01T12:00:00.000Z"), + Previous: core.StringPtr("testString"), + } - response, err := catalogManagementService.CreateObjectAccess(createObjectAccessOptions) + replaceObjectOptions := &catalogmanagementv1.ReplaceObjectOptions{ + CatalogIdentifier: &catalogIDLink, + ObjectIdentifier: &objectIDLink, + ID: &objectIDLink, + Name: core.StringPtr("testString"), + Rev: &objectRevLink, + CRN: core.StringPtr("testString"), + URL: core.StringPtr("testString"), + ParentID: core.StringPtr("us-south"), + LabelI18n: make(map[string]string), + Label: core.StringPtr("testString"), + Tags: []string{"testString"}, + Created: CreateMockDateTime("2019-01-01T12:00:00.000Z"), + Updated: CreateMockDateTime("2019-01-01T12:00:00.000Z"), + ShortDescription: core.StringPtr("testString"), + ShortDescriptionI18n: make(map[string]string), + Kind: core.StringPtr("vpe"), + Publish: publishObjectModel, + State: stateModel, + CatalogID: &catalogIDLink, + CatalogName: core.StringPtr("testString"), + Data: make(map[string]interface{}), + } - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(201)) + catalogObject, response, err := catalogManagementService.ReplaceObject(replaceObjectOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(catalogObject).ToNot(BeNil()) - }) + objectRevLink = *catalogObject.Rev + fmt.Fprintf(GinkgoWriter, "Saved objectRevLink value: %v\n", objectRevLink) }) + }) - Describe(`GetObjectAccess - Check for account ID in object access list`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`GetObjectAccess(getObjectAccessOptions *GetObjectAccessOptions)`, func() { - - getObjectAccessOptions := &catalogmanagementv1.GetObjectAccessOptions{ - CatalogIdentifier: core.StringPtr("testString"), - ObjectIdentifier: core.StringPtr("testString"), - AccountIdentifier: core.StringPtr("testString"), - } - - objectAccess, response, err := catalogManagementService.GetObjectAccess(getObjectAccessOptions) + Describe(`SearchObjects - List objects across catalogs`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`SearchObjects(searchObjectsOptions *SearchObjectsOptions)`, func() { + searchObjectsOptions := &catalogmanagementv1.SearchObjectsOptions{ + Query: core.StringPtr("testString"), + Kind: core.StringPtr("vpe"), + Limit: core.Int64Ptr(int64(1000)), + Offset: core.Int64Ptr(int64(38)), + Collapse: core.BoolPtr(true), + Digest: core.BoolPtr(true), + } - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(objectAccess).ToNot(BeNil()) + objectSearchResult, response, err := catalogManagementService.SearchObjects(searchObjectsOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(objectSearchResult).ToNot(BeNil()) + }) + }) - }) + Describe(`ListObjects - List objects within a catalog`, func() { + BeforeEach(func() { + shouldSkipTest() }) + It(`ListObjects(listObjectsOptions *ListObjectsOptions)`, func() { + listObjectsOptions := &catalogmanagementv1.ListObjectsOptions{ + CatalogIdentifier: &catalogIDLink, + Limit: core.Int64Ptr(int64(1000)), + Offset: core.Int64Ptr(int64(38)), + Name: core.StringPtr("testString"), + Sort: core.StringPtr("name"), + } - Describe(`GetObjectAccessList - Get object access list`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`GetObjectAccessList(getObjectAccessListOptions *GetObjectAccessListOptions)`, func() { + objectListResult, response, err := catalogManagementService.ListObjects(listObjectsOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(objectListResult).ToNot(BeNil()) + }) + }) - getObjectAccessListOptions := &catalogmanagementv1.GetObjectAccessListOptions{ - CatalogIdentifier: core.StringPtr("testString"), - ObjectIdentifier: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(1000)), - Offset: core.Int64Ptr(int64(38)), - } + Describe(`ListObjectAudits - Get object audit logs`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`ListObjectAudits(listObjectAuditsOptions *ListObjectAuditsOptions) with pagination`, func() { + Skip("Not testing") + listObjectAuditsOptions := &catalogmanagementv1.ListObjectAuditsOptions{ + CatalogIdentifier: &catalogIDLink, + ObjectIdentifier: &objectIDLink, + Start: core.StringPtr(""), + Limit: core.Int64Ptr(int64(10)), + Lookupnames: core.BoolPtr(true), + } - objectAccessListResult, response, err := catalogManagementService.GetObjectAccessList(getObjectAccessListOptions) + listObjectAuditsOptions.Start = nil + listObjectAuditsOptions.Limit = core.Int64Ptr(1) + var allResults []catalogmanagementv1.AuditLogDigest + for { + auditLogs, response, err := catalogManagementService.ListObjectAudits(listObjectAuditsOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) - Expect(objectAccessListResult).ToNot(BeNil()) - - }) - }) + Expect(auditLogs).ToNot(BeNil()) + allResults = append(allResults, auditLogs.Audits...) - Describe(`AddObjectAccessList - Add accounts to object access list`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`AddObjectAccessList(addObjectAccessListOptions *AddObjectAccessListOptions)`, func() { + listObjectAuditsOptions.Start, err = auditLogs.GetNextStart() + Expect(err).To(BeNil()) - addObjectAccessListOptions := &catalogmanagementv1.AddObjectAccessListOptions{ - CatalogIdentifier: core.StringPtr("testString"), - ObjectIdentifier: core.StringPtr("testString"), - Accounts: []string{"testString"}, + if listObjectAuditsOptions.Start == nil { + break } + } + fmt.Fprintf(GinkgoWriter, "Retrieved a total of %d item(s) with pagination.\n", len(allResults)) + }) + It(`ListObjectAudits(listObjectAuditsOptions *ListObjectAuditsOptions) using ObjectAuditsPager`, func() { + Skip("Not testing") + listObjectAuditsOptions := &catalogmanagementv1.ListObjectAuditsOptions{ + CatalogIdentifier: &catalogIDLink, + ObjectIdentifier: &objectIDLink, + Limit: core.Int64Ptr(int64(10)), + Lookupnames: core.BoolPtr(true), + } - accessListBulkResponse, response, err := catalogManagementService.AddObjectAccessList(addObjectAccessListOptions) + // Test GetNext(). + pager, err := catalogManagementService.NewObjectAuditsPager(listObjectAuditsOptions) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + var allResults []catalogmanagementv1.AuditLogDigest + for pager.HasNext() { + nextPage, err := pager.GetNext() Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(accessListBulkResponse).ToNot(BeNil()) + Expect(nextPage).ToNot(BeNil()) + allResults = append(allResults, nextPage...) + } + + // Test GetAll(). + pager, err = catalogManagementService.NewObjectAuditsPager(listObjectAuditsOptions) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) - }) + allItems, err := pager.GetAll() + Expect(err).To(BeNil()) + Expect(allItems).ToNot(BeNil()) + + Expect(len(allItems)).To(Equal(len(allResults))) + fmt.Fprintf(GinkgoWriter, "ListObjectAudits() returned a total of %d item(s) using ObjectAuditsPager.\n", len(allResults)) }) - */ - Describe(`CreateOfferingInstance - Create an offering instance`, func() { + }) + + Describe(`GetObjectAudit - Get an object audit log entry`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`CreateOfferingInstance(createOfferingInstanceOptions *CreateOfferingInstanceOptions)`, func() { - Expect(testCatalogID).ToNot(BeEmpty()) - Expect(testOfferingID).ToNot(BeEmpty()) - - offeringInstanceOptions := catalogManagementService.NewCreateOfferingInstanceOptions(refreshToken) - offeringInstanceOptions.SetCatalogID(testCatalogID) - offeringInstanceOptions.SetOfferingID(testOfferingID) - offeringInstanceOptions.SetKindFormat("operator") - offeringInstanceOptions.SetVersion("0.0.2") - offeringInstanceOptions.SetClusterID(targetClusterID) - offeringInstanceOptions.SetClusterRegion("us-south") - offeringInstanceOptions.SetClusterNamespaces([]string{"sdk-test"}) - offeringInstanceOptions.SetSchematicsWorkspaceID("test-id") - offeringInstanceOptions.SetResourceGroupID("24a205592b2845c7a992efa55fe33ee0") - offeringInstanceOptions.SetChannel("stable") - offeringInstanceOptions.SetInstallPlan("automatic") - - offeringInstance, response, err := catalogManagementService.CreateOfferingInstance(offeringInstanceOptions) + It(`GetObjectAudit(getObjectAuditOptions *GetObjectAuditOptions)`, func() { + Skip("Not testing") + getObjectAuditOptions := &catalogmanagementv1.GetObjectAuditOptions{ + CatalogIdentifier: &catalogIDLink, + ObjectIdentifier: &objectIDLink, + AuditlogIdentifier: core.StringPtr("testString"), + Lookupnames: core.BoolPtr(true), + } + auditLog, response, err := catalogManagementService.GetObjectAudit(getObjectAuditOptions) Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(202)) - Expect(offeringInstance).ToNot(BeNil()) - Expect(*offeringInstance.LastOperation.State).To(Equal("in progress")) - fmt.Fprintf(GinkgoWriter, "CreateOfferingInstance() result:\n%s\n", common.ToJSON(offeringInstance)) - - Expect(offeringInstance.ID).ToNot(BeNil()) - testOfferingInstanceID = *offeringInstance.ID - testOfferingInstanceRev = *offeringInstance.Rev - Expect(testOfferingInstanceID).ToNot(BeEmpty()) + Expect(response.StatusCode).To(Equal(200)) + Expect(auditLog).ToNot(BeNil()) }) }) - Describe(`GetOfferingInstance - Get Offering Instrance`, func() { + + Describe(`ConsumableShareObject - Make object consumable for sharing`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`GetOfferingInstance(getOfferingInstanceOptions *GetOfferingInstanceOptions)`, func() { - Expect(testOfferingInstanceID).ToNot(BeEmpty()) - - getOfferingInstanceOptions := &catalogmanagementv1.GetOfferingInstanceOptions{ - InstanceIdentifier: &testOfferingInstanceID, + It(`ConsumableShareObject(consumableShareObjectOptions *ConsumableShareObjectOptions)`, func() { + Skip("Not testing") + consumableShareObjectOptions := &catalogmanagementv1.ConsumableShareObjectOptions{ + CatalogIdentifier: &catalogIDLink, + ObjectIdentifier: &objectIDLink, } - offeringInstance, response, err := catalogManagementService.GetOfferingInstance(getOfferingInstanceOptions) - - Expect(offeringInstance.Metadata).ToNot(BeNil()) + response, err := catalogManagementService.ConsumableShareObject(consumableShareObjectOptions) Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(offeringInstance).ToNot(BeNil()) - fmt.Fprintf(GinkgoWriter, "GetOfferingInstance() result:\n%s\n", common.ToJSON(offeringInstance)) + Expect(response.StatusCode).To(Equal(202)) }) }) - Describe(`PutOfferingInstance - Update Offering Instance`, func() { + Describe(`ShareObject - Allows object to be shared`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`PutOfferingInstance(putOfferingInstanceOptions *PutOfferingInstanceOptions)`, func() { - Expect(testOfferingInstanceID).ToNot(BeEmpty()) - - putOfferingInstanceOptions := catalogManagementService.NewPutOfferingInstanceOptions(testOfferingInstanceID, refreshToken) - putOfferingInstanceOptions.SetID(testOfferingInstanceID) - putOfferingInstanceOptions.SetRev(testOfferingInstanceRev) - putOfferingInstanceOptions.SetCatalogID(testCatalogID) - putOfferingInstanceOptions.SetOfferingID(testOfferingID) - putOfferingInstanceOptions.SetKindFormat("operator") - putOfferingInstanceOptions.SetVersion("0.0.2") - putOfferingInstanceOptions.SetClusterID(targetClusterID) - putOfferingInstanceOptions.SetClusterRegion("us-south") - putOfferingInstanceOptions.SetClusterNamespaces([]string{"sdk-test"}) - putOfferingInstanceOptions.SetChannel("beta") - putOfferingInstanceOptions.SetInstallPlan("manual") - - offeringInstance, response, err := catalogManagementService.PutOfferingInstance(putOfferingInstanceOptions) + It(`ShareObject(shareObjectOptions *ShareObjectOptions)`, func() { + Skip("Not testing") + shareObjectOptions := &catalogmanagementv1.ShareObjectOptions{ + CatalogIdentifier: &catalogIDLink, + ObjectIdentifier: &objectIDLink, + IBM: core.BoolPtr(true), + Public: core.BoolPtr(true), + Enabled: core.BoolPtr(true), + } + shareSetting, response, err := catalogManagementService.ShareObject(shareObjectOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) - Expect(offeringInstance).ToNot(BeNil()) - fmt.Fprintf(GinkgoWriter, "PutOfferingInstance() result:\n%s\n", common.ToJSON(offeringInstance)) + Expect(shareSetting).ToNot(BeNil()) }) }) - Describe(`DeleteOfferingInstance - Delete an offering instance`, func() { + Describe(`CreateObjectAccess - Add account ID to object access list`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`DeleteOfferingInstance(deleteOfferingInstanceOptions *DeleteOfferingInstanceOptions)`, func() { - Expect(testOfferingInstanceID).ToNot(BeEmpty()) - - deleteOfferingInstanceOptions := catalogManagementService.NewDeleteOfferingInstanceOptions(testOfferingInstanceID, refreshToken) - - response, err := catalogManagementService.DeleteOfferingInstance(deleteOfferingInstanceOptions) + It(`CreateObjectAccess(createObjectAccessOptions *CreateObjectAccessOptions)`, func() { + createObjectAccessOptions := &catalogmanagementv1.CreateObjectAccessOptions{ + CatalogIdentifier: &catalogIDLink, + ObjectIdentifier: &objectIDLink, + AccessIdentifier: core.StringPtr(accountID), + } + response, err := catalogManagementService.CreateObjectAccess(createObjectAccessOptions) Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(204)) - + Expect(response.StatusCode).To(Equal(201)) }) }) - /* Describe(`DeleteVersion - Delete version`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`DeleteVersion(deleteVersionOptions *DeleteVersionOptions)`, func() { - - deleteVersionOptions := &catalogmanagementv1.DeleteVersionOptions{ - VersionLocID: core.StringPtr("testString"), - } - - response, err := catalogManagementService.DeleteVersion(deleteVersionOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - - }) - }) - - Describe(`DeleteOperators - Delete operators`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`DeleteOperators(deleteOperatorsOptions *DeleteOperatorsOptions)`, func() { + Describe(`GetObjectAccessList - Get object access list`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`GetObjectAccessList(getObjectAccessListOptions *GetObjectAccessListOptions) with pagination`, func() { + Skip("Not testing") + getObjectAccessListOptions := &catalogmanagementv1.GetObjectAccessListOptions{ + CatalogIdentifier: &catalogIDLink, + ObjectIdentifier: &objectIDLink, + Start: core.StringPtr(""), + Limit: core.Int64Ptr(int64(10)), + } - deleteOperatorsOptions := &catalogmanagementv1.DeleteOperatorsOptions{ - XAuthRefreshToken: core.StringPtr("testString"), - ClusterID: core.StringPtr("testString"), - Region: core.StringPtr("testString"), - VersionLocatorID: core.StringPtr("testString"), - } + getObjectAccessListOptions.Start = nil + getObjectAccessListOptions.Limit = core.Int64Ptr(1) - response, err := catalogManagementService.DeleteOperators(deleteOperatorsOptions) + var allResults []catalogmanagementv1.Access + for { + accessListResult, response, err := catalogManagementService.GetObjectAccessList(getObjectAccessListOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(accessListResult).ToNot(BeNil()) + allResults = append(allResults, accessListResult.Resources...) - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) + getObjectAccessListOptions.Start, err = accessListResult.GetNextStart() + Expect(err).To(BeNil()) - }) - }) + if getObjectAccessListOptions.Start == nil { + break + } + } + fmt.Fprintf(GinkgoWriter, "Retrieved a total of %d item(s) with pagination.\n", len(allResults)) + }) + It(`GetObjectAccessList(getObjectAccessListOptions *GetObjectAccessListOptions) using GetObjectAccessListPager`, func() { + Skip("Not testing") + getObjectAccessListOptions := &catalogmanagementv1.GetObjectAccessListOptions{ + CatalogIdentifier: &catalogIDLink, + ObjectIdentifier: &objectIDLink, + Limit: core.Int64Ptr(int64(10)), + } - Describe(`DeleteOffering - Delete offering`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`DeleteOffering(deleteOfferingOptions *DeleteOfferingOptions)`, func() { + // Test GetNext(). + pager, err := catalogManagementService.NewGetObjectAccessListPager(getObjectAccessListOptions) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) - deleteOfferingOptions := &catalogmanagementv1.DeleteOfferingOptions{ - CatalogIdentifier: core.StringPtr("testString"), - OfferingID: core.StringPtr("testString"), - } + var allResults []catalogmanagementv1.Access + for pager.HasNext() { + nextPage, err := pager.GetNext() + Expect(err).To(BeNil()) + Expect(nextPage).ToNot(BeNil()) + allResults = append(allResults, nextPage...) + } - response, err := catalogManagementService.DeleteOffering(deleteOfferingOptions) + // Test GetAll(). + pager, err = catalogManagementService.NewGetObjectAccessListPager(getObjectAccessListOptions) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) + allItems, err := pager.GetAll() + Expect(err).To(BeNil()) + Expect(allItems).ToNot(BeNil()) - }) - }) + Expect(len(allItems)).To(Equal(len(allResults))) + fmt.Fprintf(GinkgoWriter, "GetObjectAccessList() returned a total of %d item(s) using GetObjectAccessListPager.\n", len(allResults)) + }) + }) - Describe(`DeleteObjectAccessList - Delete accounts from object access list`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`DeleteObjectAccessList(deleteObjectAccessListOptions *DeleteObjectAccessListOptions)`, func() { + Describe(`GetObjectAccess - Check for account ID in object access list`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`GetObjectAccess(getObjectAccessOptions *GetObjectAccessOptions)`, func() { + getObjectAccessOptions := &catalogmanagementv1.GetObjectAccessOptions{ + CatalogIdentifier: &catalogIDLink, + ObjectIdentifier: &objectIDLink, + AccessIdentifier: core.StringPtr(accountID), + } - deleteObjectAccessListOptions := &catalogmanagementv1.DeleteObjectAccessListOptions{ - CatalogIdentifier: core.StringPtr("testString"), - ObjectIdentifier: core.StringPtr("testString"), - Accounts: []string{"testString"}, - } + access, response, err := catalogManagementService.GetObjectAccess(getObjectAccessOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(access).ToNot(BeNil()) + }) + }) - accessListBulkResponse, response, err := catalogManagementService.DeleteObjectAccessList(deleteObjectAccessListOptions) + Describe(`GetObjectAccessListDeprecated - Get object access list`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`GetObjectAccessListDeprecated(getObjectAccessListDeprecatedOptions *GetObjectAccessListDeprecatedOptions)`, func() { + Skip("Not testing") + getObjectAccessListDeprecatedOptions := &catalogmanagementv1.GetObjectAccessListDeprecatedOptions{ + CatalogIdentifier: &catalogIDLink, + ObjectIdentifier: &objectIDLink, + Limit: core.Int64Ptr(int64(1000)), + Offset: core.Int64Ptr(int64(38)), + } - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(accessListBulkResponse).ToNot(BeNil()) + objectAccessListResult, response, err := catalogManagementService.GetObjectAccessListDeprecated(getObjectAccessListDeprecatedOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(objectAccessListResult).ToNot(BeNil()) + }) + }) - }) - }) + Describe(`AddObjectAccessList - Add accesses to object access list`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`AddObjectAccessList(addObjectAccessListOptions *AddObjectAccessListOptions)`, func() { + addObjectAccessListOptions := &catalogmanagementv1.AddObjectAccessListOptions{ + CatalogIdentifier: &catalogIDLink, + ObjectIdentifier: &objectIDLink, + Accesses: []string{accountID}, + } - Describe(`DeleteObjectAccess - Remove account ID from object access list`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`DeleteObjectAccess(deleteObjectAccessOptions *DeleteObjectAccessOptions)`, func() { + accessListBulkResponse, response, err := catalogManagementService.AddObjectAccessList(addObjectAccessListOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(201)) + Expect(accessListBulkResponse).ToNot(BeNil()) + }) + }) - deleteObjectAccessOptions := &catalogmanagementv1.DeleteObjectAccessOptions{ - CatalogIdentifier: core.StringPtr("testString"), - ObjectIdentifier: core.StringPtr("testString"), - AccountIdentifier: core.StringPtr("testString"), - } + Describe(`AccountPublishObject - Publish object to account`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`AccountPublishObject(accountPublishObjectOptions *AccountPublishObjectOptions)`, func() { + Skip("Not testing") + accountPublishObjectOptions := &catalogmanagementv1.AccountPublishObjectOptions{ + CatalogIdentifier: &catalogIDLink, + ObjectIdentifier: &objectIDLink, + } - response, err := catalogManagementService.DeleteObjectAccess(deleteObjectAccessOptions) + response, err := catalogManagementService.AccountPublishObject(accountPublishObjectOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(202)) + }) + }) - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) + Describe(`SharedPublishObject - Publish object to share with allow list`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`SharedPublishObject(sharedPublishObjectOptions *SharedPublishObjectOptions)`, func() { + Skip("Not testing") + sharedPublishObjectOptions := &catalogmanagementv1.SharedPublishObjectOptions{ + CatalogIdentifier: &catalogIDLink, + ObjectIdentifier: &objectIDLink, + } - }) - }) + response, err := catalogManagementService.SharedPublishObject(sharedPublishObjectOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(202)) + }) + }) - Describe(`DeleteObject - Delete catalog object`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`DeleteObject(deleteObjectOptions *DeleteObjectOptions)`, func() { + Describe(`IBMPublishObject - Publish object to share with IBMers`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`IBMPublishObject(ibmPublishObjectOptions *IBMPublishObjectOptions)`, func() { + Skip("Not testing") + ibmPublishObjectOptions := &catalogmanagementv1.IBMPublishObjectOptions{ + CatalogIdentifier: &catalogIDLink, + ObjectIdentifier: &objectIDLink, + } - deleteObjectOptions := &catalogmanagementv1.DeleteObjectOptions{ - CatalogIdentifier: core.StringPtr("testString"), - ObjectIdentifier: core.StringPtr("testString"), - } + response, err := catalogManagementService.IBMPublishObject(ibmPublishObjectOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(202)) + }) + }) - response, err := catalogManagementService.DeleteObject(deleteObjectOptions) + Describe(`PublicPublishObject - Publish object to share with all users`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`PublicPublishObject(publicPublishObjectOptions *PublicPublishObjectOptions)`, func() { + Skip("Not testing") + publicPublishObjectOptions := &catalogmanagementv1.PublicPublishObjectOptions{ + CatalogIdentifier: &catalogIDLink, + ObjectIdentifier: &objectIDLink, + } - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) + response, err := catalogManagementService.PublicPublishObject(publicPublishObjectOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(202)) + }) + }) - }) - }) + Describe(`DeleteObjectAccessList - Delete accesses from object access list`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`DeleteObjectAccessList(deleteObjectAccessListOptions *DeleteObjectAccessListOptions)`, func() { + deleteObjectAccessListOptions := &catalogmanagementv1.DeleteObjectAccessListOptions{ + CatalogIdentifier: &catalogIDLink, + ObjectIdentifier: &objectIDLink, + Accesses: []string{accountID}, + } - Describe(`DeleteLicenseEntitlement - Delete license entitlement`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`DeleteLicenseEntitlement(deleteLicenseEntitlementOptions *DeleteLicenseEntitlementOptions)`, func() { + accessListBulkResponse, response, err := catalogManagementService.DeleteObjectAccessList(deleteObjectAccessListOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(accessListBulkResponse).ToNot(BeNil()) + }) + }) - deleteLicenseEntitlementOptions := &catalogmanagementv1.DeleteLicenseEntitlementOptions{ - EntitlementID: core.StringPtr("testString"), - AccountID: core.StringPtr("testString"), - } + Describe(`DeleteObjectAccess - Remove account ID from object access list`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`DeleteObjectAccess(deleteObjectAccessOptions *DeleteObjectAccessOptions)`, func() { + deleteObjectAccessOptions := &catalogmanagementv1.DeleteObjectAccessOptions{ + CatalogIdentifier: &catalogIDLink, + ObjectIdentifier: &objectIDLink, + AccessIdentifier: core.StringPtr(accountID), + } - response, err := catalogManagementService.DeleteLicenseEntitlement(deleteLicenseEntitlementOptions) + response, err := catalogManagementService.DeleteObjectAccess(deleteObjectAccessOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + }) + }) - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) + Describe(`DeleteObject - Delete catalog object`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`DeleteObject(deleteObjectOptions *DeleteObjectOptions)`, func() { + deleteObjectOptions := &catalogmanagementv1.DeleteObjectOptions{ + CatalogIdentifier: &catalogIDLink, + ObjectIdentifier: &objectIDLink, + } - }) - }) - */ + response, err := catalogManagementService.DeleteObject(deleteObjectOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + }) + }) Describe(`DeleteCatalog - Delete catalog`, func() { BeforeEach(func() { shouldSkipTest() }) It(`DeleteCatalog(deleteCatalogOptions *DeleteCatalogOptions)`, func() { - Expect(testCatalogID).ToNot(BeEmpty()) - deleteCatalogOptions := &catalogmanagementv1.DeleteCatalogOptions{ - CatalogIdentifier: &testCatalogID, + CatalogIdentifier: &catalogIDLink, } response, err := catalogManagementService.DeleteCatalog(deleteCatalogOptions) - Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) - }) }) }) + +// +// Utility functions are declared in the unit test file +// diff --git a/catalogmanagementv1/catalog_management_v1_old2_integration_test.go b/catalogmanagementv1/catalog_management_v1_old2_integration_test.go deleted file mode 100644 index c689bb9b..00000000 --- a/catalogmanagementv1/catalog_management_v1_old2_integration_test.go +++ /dev/null @@ -1,2368 +0,0 @@ -// +build integration2 - -/** - * (C) Copyright IBM Corp. 2021. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package catalogmanagementv1_test - -import ( - "fmt" - "log" - "os" - "time" - - "github.com/IBM/go-sdk-core/v5/core" - "github.com/IBM/platform-services-go-sdk/catalogmanagementv1" - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -/** - * This file contains an integration test for the catalogmanagementv1 package. - * - * s: - * - * The integration test will automatically skip tests if the required config file is not available. - */ - -var _ = FDescribe(`CatalogManagementV1 Integration Tests`, func() { - - const ( - externalConfigFile = "../catalog_management.env" - expectedShortDesc = "test" - expectedURL = "https://cm.globalcatalog.test.cloud.ibm.com/api/v1-beta/catalogs/%s" - expectedOfferingsURL = "https://cm.globalcatalog.test.cloud.ibm.com/api/v1-beta/catalogs/%s/offerings" - fakeName = "bogus" - fakeVersionLocator = "bogus.bogus" - expectedOfferingName = "test-offering" - expectedOfferingURL = "https://cm.globalcatalog.test.cloud.ibm.com/api/v1-beta/catalogs/%s/offerings/%s" - fakeRevision = "rev_2.0" - ) - - var ( - err error - catalogManagementService *catalogmanagementv1.CatalogManagementV1 - serviceURL string - config map[string]string - - expectedLabel string = fmt.Sprintf("integration-test-%d", time.Now().Unix()) - accountID string - gitToken string - clusterID string - - catalogID string - offeringID string - objectID string - ) - - var shouldSkipTest = func() { - Skip("External configuration is not available, skipping tests...") - } - - FDescribe(`External configuration`, func() { - It("Successfully load the configuration", func() { - _, err = os.Stat(externalConfigFile) - if err != nil { - Skip("External configuration file not found, skipping tests: " + err.Error()) - } - - os.Setenv("IBM_CREDENTIALS_FILE", externalConfigFile) - config, err = core.GetServiceProperties(catalogmanagementv1.DefaultServiceName) - if err != nil { - Skip("Error loading service properties, skipping tests: " + err.Error()) - } - serviceURL = config["URL"] - if serviceURL == "" { - Skip("Unable to load service URL configuration property, skipping tests") - } - - accountID = config["ACCOUNT_ID"] - if accountID == "" { - Skip("Unable to load account ID configuration property, skipping tests") - } - - gitToken = config["GIT_TOKEN"] - if gitToken == "" { - Skip("Unable to load Git token configuration property, skipping tests") - } - - clusterID = config["CLUSTER_ID"] - if clusterID == "" { - Skip("Unable to load cluster ID configuration property, skipping tests") - } - - fmt.Printf("Service URL: %s\n", serviceURL) - shouldSkipTest = func() {} - }) - }) - - FDescribe(`Client initialization`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It("Successfully construct the service client instance", func() { - - catalogManagementServiceOptions := &catalogmanagementv1.CatalogManagementV1Options{} - - catalogManagementService, err = catalogmanagementv1.NewCatalogManagementV1UsingExternalConfig(catalogManagementServiceOptions) - - Expect(err).To(BeNil()) - Expect(catalogManagementService).ToNot(BeNil()) - Expect(catalogManagementService.Service.Options.URL).To(Equal(serviceURL)) - - core.SetLogger(core.NewLogger(core.LevelDebug, log.New(GinkgoWriter, "", log.LstdFlags), log.New(GinkgoWriter, "", log.LstdFlags))) - catalogManagementService.EnableRetries(4, 30*time.Second) - }) - }) - - FDescribe(`Run integration tests`, func() { - JustBeforeEach(func() { - shouldSkipTest() - - return - - listResult, _, _ := catalogManagementService.ListCatalogs(catalogManagementService.NewListCatalogsOptions()) - if listResult != nil && listResult.Resources != nil { - for _, resource := range listResult.Resources { - if *resource.Label == expectedLabel { - catalogManagementService.DeleteCatalog(catalogManagementService.NewDeleteCatalogOptions(*resource.ID)) - } - } - } - }) - - JustAfterEach(func() { - shouldSkipTest() - - return - - listResult, _, _ := catalogManagementService.ListCatalogs(catalogManagementService.NewListCatalogsOptions()) - if listResult != nil && listResult.Resources != nil { - for _, resource := range listResult.Resources { - if *resource.Label == expectedLabel { - catalogManagementService.DeleteCatalog(catalogManagementService.NewDeleteCatalogOptions(*resource.ID)) - } - } - } - }) - // *************** ACCOUNTS - FDescribe(`GetCatalogAccount - Get catalog account settings`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`GetCatalogAccount(getCatalogAccountOptions *GetCatalogAccountOptions)`, func() { - - getCatalogAccountOptions := &catalogmanagementv1.GetCatalogAccountOptions{} - - account, response, err := catalogManagementService.GetCatalogAccount(getCatalogAccountOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(account).ToNot(BeNil()) - Expect(*account.ID).To(Equal(accountID)) - Expect(len(account.AccountFilters.CategoryFilters)).To(BeZero()) - // NOTE1: Are these necessary? - // Expect(account.AccountFilters.IDFilters.Include).ToNot(BeNil()) - // Expect(account.AccountFilters.IDFilters.Exclude).ToNot(BeNil()) - }) - It("GetCatalogAccount - Fail to get a catalog that does not exist", func() { - getOptions := catalogManagementService.NewGetCatalogOptions(fakeName) - _, getResponse, err := catalogManagementService.GetCatalog(getOptions) - - Expect(err).ToNot(BeNil()) - Expect(getResponse.StatusCode).To(Equal(404)) - }) - }) - - // NOTE2: Can we run this? Doesn't this require another account to make the update? I guess it cannot update itself. - Describe(`UpdateCatalogAccount - Update account settings`, func() { - It(`UpdateCatalogAccount(updateCatalogAccountOptions *UpdateCatalogAccountOptions)`, func() { - - filterTermsModel := &catalogmanagementv1.FilterTerms{ - FilterTerms: []string{"filterTerm"}, - } - - categoryFilterModel := &catalogmanagementv1.CategoryFilter{ - Include: core.BoolPtr(true), - Filter: filterTermsModel, - } - - idFilterModel := &catalogmanagementv1.IDFilter{ - Include: filterTermsModel, - Exclude: filterTermsModel, - } - - filtersModel := &catalogmanagementv1.Filters{ - IncludeAll: core.BoolPtr(true), - CategoryFilters: make(map[string]catalogmanagementv1.CategoryFilter), - IDFilters: idFilterModel, - } - filtersModel.CategoryFilters["category"] = *categoryFilterModel - - updateCatalogAccountOptions := &catalogmanagementv1.UpdateCatalogAccountOptions{ - ID: &accountID, - HideIBMCloudCatalog: core.BoolPtr(true), - AccountFilters: filtersModel, - } - - response, err := catalogManagementService.UpdateCatalogAccount(updateCatalogAccountOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - - }) - }) - - FDescribe(`GetCatalogAccountAudit - Get catalog account audit log`, func() { - It(`GetCatalogAccountAudit(getCatalogAccountAuditOptions *GetCatalogAccountAuditOptions)`, func() { - - getCatalogAccountAuditOptions := &catalogmanagementv1.GetCatalogAccountAuditOptions{} - - auditLog, response, err := catalogManagementService.GetCatalogAccountAudit(getCatalogAccountAuditOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(auditLog).ToNot(BeNil()) - - }) - }) - - FDescribe(`GetCatalogAccountFilters - Get catalog account filters`, func() { - It(`GetCatalogAccountFilters(getCatalogAccountFiltersOptions *GetCatalogAccountFiltersOptions)`, func() { - - getCatalogAccountFiltersOptions := &catalogmanagementv1.GetCatalogAccountFiltersOptions{ - // NOTE3: Catalog: core.StringPtr("testString"), - } - - accumulatedFilters, response, err := catalogManagementService.GetCatalogAccountFilters(getCatalogAccountFiltersOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(accumulatedFilters).ToNot(BeNil()) - Expect(*accumulatedFilters.AccountFilters[0].IncludeAll).To(BeTrue()) - Expect(len(accumulatedFilters.AccountFilters[0].CategoryFilters)).To(BeZero()) - // NOTE4: GOTO NOTE1 - // Expect(accumulatedFilters.AccountFilters[0].IDFilters.Include).ToNot(BeNil()) - // Expect(accumulatedFilters.AccountFilters[0].IDFilters.Exclude).ToNot(BeNil()) - }) - }) - - // *************** CATALOGS - FDescribe(`CreateCatalog - Create a catalog`, func() { - - BeforeEach(func() { - shouldSkipTest() - }) - It(`CreateCatalog(createCatalogOptions *CreateCatalogOptions)`, func() { - - // NOTE5: What about these? - // featureModel := &catalogmanagementv1.Feature{ - // Title: core.StringPtr("title"), - // Description: core.StringPtr("description"), - // } - - // filterTermsModel := &catalogmanagementv1.FilterTerms{ - // FilterTerms: []string{"filterTerm"}, - // } - - // categoryFilterModel := &catalogmanagementv1.CategoryFilter{ - // Include: core.BoolPtr(true), - // Filter: filterTermsModel, - // } - - // idFilterModel := &catalogmanagementv1.IDFilter{ - // Include: filterTermsModel, - // Exclude: filterTermsModel, - // } - - // filtersModel := &catalogmanagementv1.Filters{ - // IncludeAll: core.BoolPtr(true), - // CategoryFilters: make(map[string]catalogmanagementv1.CategoryFilter), - // IDFilters: idFilterModel, - // } - // filtersModel.CategoryFilters["foo"] = *categoryFilterModel - - // syndicationClusterModel := &catalogmanagementv1.SyndicationCluster{ - // Region: core.StringPtr("US"), - // ID: core.StringPtr("testString"), - // Name: core.StringPtr("testString"), - // ResourceGroupName: core.StringPtr("testString"), - // Type: core.StringPtr("testString"), - // Namespaces: []string{"testString"}, - // AllNamespaces: core.BoolPtr(true), - // } - - // syndicationHistoryModel := &catalogmanagementv1.SyndicationHistory{ - // Namespaces: []string{"testString"}, - // Clusters: []catalogmanagementv1.SyndicationCluster{*syndicationClusterModel}, - // LastRun: CreateMockDateTime("2019-01-01T12:00:00.000Z"), - // } - - // syndicationAuthorizationModel := &catalogmanagementv1.SyndicationAuthorization{ - // Token: core.StringPtr("testString"), - // LastRun: CreateMockDateTime("2019-01-01T12:00:00.000Z"), - // } - - // syndicationResourceModel := &catalogmanagementv1.SyndicationResource{ - // RemoveRelatedComponents: core.BoolPtr(true), - // Clusters: []catalogmanagementv1.SyndicationCluster{*syndicationClusterModel}, - // History: syndicationHistoryModel, - // Authorization: syndicationAuthorizationModel, - // } - - createCatalogOptions := &catalogmanagementv1.CreateCatalogOptions{ - Label: core.StringPtr(expectedLabel), - ShortDescription: core.StringPtr(expectedShortDesc), - // CatalogIconURL: core.StringPtr("testString"), - // Tags: []string{"testString"}, - // Features: []catalogmanagementv1.Feature{*featureModel}, - // Disabled: core.BoolPtr(true), - // ResourceGroupID: core.StringPtr("testString"), - // OwningAccount: core.StringPtr("testString"), - // CatalogFilters: filtersModel, - // SyndicationSettings: syndicationResourceModel, - // Kind: core.StringPtr("testString"), - } - - catalog, response, err := catalogManagementService.CreateCatalog(createCatalogOptions) - - // catalogManagementService.DeleteCatalog(catalogManagementService.NewDeleteCatalogOptions(*catalog.ID)) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(201)) - Expect(catalog).ToNot(BeNil()) - - catalogID = *catalog.ID - - Expect(*catalog.Label).To(Equal(expectedLabel)) - Expect(*catalog.ShortDescription).To(Equal(expectedShortDesc)) - Expect(*catalog.URL).To(Equal(fmt.Sprintf(expectedURL, *catalog.ID))) - Expect(*catalog.OfferingsURL).To(Equal(fmt.Sprintf(expectedOfferingsURL, *catalog.ID))) - Expect(*catalog.OwningAccount).To(Equal(accountID)) - Expect(*catalog.CatalogFilters.IncludeAll).To(BeFalse()) - Expect(len(catalog.CatalogFilters.CategoryFilters)).To(BeZero()) - Expect(catalog.CatalogFilters.IDFilters.Include).To(BeNil()) - Expect(catalog.CatalogFilters.IDFilters.Exclude).To(BeNil()) - - }) - }) - - FDescribe(`ListCatalogs - Get list of catalogs`, func() { - It(`ListCatalogs(listCatalogsOptions *ListCatalogsOptions)`, func() { - const ( - expectedTotalCount = 1 - expectedResourceCount = 1 - ) - - catalogCount := 0 - catalogIndex := -1 - - // createOptions := catalogManagementService.NewCreateCatalogOptions() - // createOptions.SetLabel(expectedLabel) - // createOptions.SetShortDescription(expectedShortDesc) - // createResult, _, _ := catalogManagementService.CreateCatalog(createOptions) - - listCatalogsOptions := &catalogmanagementv1.ListCatalogsOptions{} - - catalogSearchResult, response, err := catalogManagementService.ListCatalogs(listCatalogsOptions) - - for i, resource := range catalogSearchResult.Resources { - if *resource.Label == expectedLabel { - catalogCount++ - catalogIndex = i - } - } - - // catalogManagementService.DeleteCatalog(catalogManagementService.NewDeleteCatalogOptions(*createResult.ID)) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(catalogSearchResult).ToNot(BeNil()) - - Expect(catalogCount).To(Equal(expectedTotalCount)) - Expect(*catalogSearchResult.Resources[catalogIndex].ID).To(Equal(catalogID)) - Expect(*catalogSearchResult.Resources[catalogIndex].Label).To(Equal(expectedLabel)) - Expect(*catalogSearchResult.Resources[catalogIndex].ShortDescription).To(Equal(expectedShortDesc)) - Expect(*catalogSearchResult.Resources[catalogIndex].URL).To(Equal(fmt.Sprintf(expectedURL, catalogID))) - Expect(*catalogSearchResult.Resources[catalogIndex].OfferingsURL).To(Equal(fmt.Sprintf(expectedOfferingsURL, catalogID))) - Expect(*catalogSearchResult.Resources[catalogIndex].OwningAccount).To(Equal(accountID)) - Expect(*catalogSearchResult.Resources[catalogIndex].CatalogFilters.IncludeAll).To(BeFalse()) - Expect(len(catalogSearchResult.Resources[catalogIndex].CatalogFilters.CategoryFilters)).To(BeZero()) - Expect(catalogSearchResult.Resources[catalogIndex].CatalogFilters.IDFilters.Include).To(BeNil()) - Expect(catalogSearchResult.Resources[catalogIndex].CatalogFilters.IDFilters.Exclude).To(BeNil()) - }) - }) - - FDescribe(`GetCatalog - Get catalog`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`GetCatalog(getCatalogOptions *GetCatalogOptions)`, func() { - Expect(catalogID).ToNot(BeEmpty()) - - getCatalogOptions := &catalogmanagementv1.GetCatalogOptions{ - CatalogIdentifier: &catalogID, - } - - catalog, response, err := catalogManagementService.GetCatalog(getCatalogOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(catalog).ToNot(BeNil()) - Expect(*catalog.ID).To(Equal(catalogID)) - Expect(*catalog.Label).To(Equal(expectedLabel)) - Expect(*catalog.ShortDescription).To(Equal(expectedShortDesc)) - Expect(*catalog.URL).To(Equal(fmt.Sprintf(expectedURL, catalogID))) - Expect(*catalog.OfferingsURL).To(Equal(fmt.Sprintf(expectedOfferingsURL, catalogID))) - Expect(*catalog.OwningAccount).To(Equal(accountID)) - Expect(*catalog.CatalogFilters.IncludeAll).To(BeFalse()) - Expect(len(catalog.CatalogFilters.CategoryFilters)).To(BeZero()) - Expect(catalog.CatalogFilters.IDFilters.Include).To(BeNil()) - Expect(catalog.CatalogFilters.IDFilters.Exclude).To(BeNil()) - }) - It("GetCatalog(getCatalogOptions *GetCatalogOptions) - Fail to get a catalog that does not exist", func() { - id := fakeName - getOptions := catalogManagementService.NewGetCatalogOptions(id) - _, getResponse, err := catalogManagementService.GetCatalog(getOptions) - - Expect(err).ToNot(BeNil()) - Expect(getResponse.StatusCode).To(Equal(404)) - }) - }) - - FDescribe(`ReplaceCatalog - Update catalog`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`ReplaceCatalog(replaceCatalogOptions *ReplaceCatalogOptions)`, func() { - - // featureModel := &catalogmanagementv1.Feature{ - // Title: core.StringPtr("testString"), - // Description: core.StringPtr("testString"), - // } - - // filterTermsModel := &catalogmanagementv1.FilterTerms{ - // FilterTerms: []string{"testString"}, - // } - - // categoryFilterModel := &catalogmanagementv1.CategoryFilter{ - // Include: core.BoolPtr(true), - // Filter: filterTermsModel, - // } - - // idFilterModel := &catalogmanagementv1.IDFilter{ - // Include: filterTermsModel, - // Exclude: filterTermsModel, - // } - - // filtersModel := &catalogmanagementv1.Filters{ - // IncludeAll: core.BoolPtr(true), - // CategoryFilters: make(map[string]catalogmanagementv1.CategoryFilter), - // IDFilters: idFilterModel, - // } - // filtersModel.CategoryFilters["foo"] = *categoryFilterModel - - // syndicationClusterModel := &catalogmanagementv1.SyndicationCluster{ - // Region: core.StringPtr("testString"), - // ID: core.StringPtr("testString"), - // Name: core.StringPtr("testString"), - // ResourceGroupName: core.StringPtr("testString"), - // Type: core.StringPtr("testString"), - // Namespaces: []string{"testString"}, - // AllNamespaces: core.BoolPtr(true), - // } - - // syndicationHistoryModel := &catalogmanagementv1.SyndicationHistory{ - // Namespaces: []string{"testString"}, - // Clusters: []catalogmanagementv1.SyndicationCluster{*syndicationClusterModel}, - // LastRun: CreateMockDateTime("2019-01-01T12:00:00.000Z"), - // } - - // syndicationAuthorizationModel := &catalogmanagementv1.SyndicationAuthorization{ - // Token: core.StringPtr("testString"), - // LastRun: CreateMockDateTime("2019-01-01T12:00:00.000Z"), - // } - - // syndicationResourceModel := &catalogmanagementv1.SyndicationResource{ - // RemoveRelatedComponents: core.BoolPtr(true), - // Clusters: []catalogmanagementv1.SyndicationCluster{*syndicationClusterModel}, - // History: syndicationHistoryModel, - // Authorization: syndicationAuthorizationModel, - // } - - replaceCatalogOptions := &catalogmanagementv1.ReplaceCatalogOptions{ - CatalogIdentifier: core.StringPtr(catalogID), - ID: core.StringPtr(catalogID), - // Rev: core.StringPtr("testString"), - // Label: core.StringPtr("testString"), - // ShortDescription: core.StringPtr("testString"), - // CatalogIconURL: core.StringPtr("testString"), - Tags: []string{"tag"}, - // Features: []catalogmanagementv1.Feature{*featureModel}, - // Disabled: core.BoolPtr(true), - // ResourceGroupID: core.StringPtr("testString"), - // OwningAccount: core.StringPtr("testString"), - // CatalogFilters: filtersModel, - // SyndicationSettings: syndicationResourceModel, - // Kind: core.StringPtr("testString"), - } - - catalog, response, err := catalogManagementService.ReplaceCatalog(replaceCatalogOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(catalog).ToNot(BeNil()) - }) - }) - - FDescribe(`GetCatalogAudit - Get catalog audit log`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`GetCatalogAudit(getCatalogAuditOptions *GetCatalogAuditOptions)`, func() { - - getCatalogAuditOptions := &catalogmanagementv1.GetCatalogAuditOptions{ - CatalogIdentifier: &catalogID, - } - - auditLog, response, err := catalogManagementService.GetCatalogAudit(getCatalogAuditOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(auditLog).ToNot(BeNil()) - - }) - }) - - // *************** OFFERINGS - FDescribe(`CreateOffering - Create offering`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`CreateOffering(createOfferingOptions *CreateOfferingOptions)`, func() { - - // ratingModel := &catalogmanagementv1.Rating{ - // OneStarCount: core.Int64Ptr(int64(38)), - // TwoStarCount: core.Int64Ptr(int64(38)), - // ThreeStarCount: core.Int64Ptr(int64(38)), - // FourStarCount: core.Int64Ptr(int64(38)), - // } - - // featureModel := &catalogmanagementv1.Feature{ - // Title: core.StringPtr("testString"), - // Description: core.StringPtr("testString"), - // } - - // configurationModel := &catalogmanagementv1.Configuration{ - // Key: core.StringPtr("testString"), - // Type: core.StringPtr("testString"), - // DefaultValue: core.StringPtr("testString"), - // ValueConstraint: core.StringPtr("testString"), - // Description: core.StringPtr("testString"), - // Required: core.BoolPtr(true), - // Options: []interface{}{"testString"}, - // Hidden: core.BoolPtr(true), - // } - - // validationModel := &catalogmanagementv1.Validation{ - // Validated: CreateMockDateTime("2019-01-01T12:00:00.000Z"), - // Requested: CreateMockDateTime("2019-01-01T12:00:00.000Z"), - // State: core.StringPtr("testString"), - // LastOperation: core.StringPtr("testString"), - // Target: make(map[string]interface{}), - // } - - // resourceModel := &catalogmanagementv1.Resource{ - // Type: core.StringPtr("mem"), - // Value: core.StringPtr("testString"), - // } - - // scriptModel := &catalogmanagementv1.Script{ - // Instructions: core.StringPtr("testString"), - // Script: core.StringPtr("testString"), - // ScriptPermission: core.StringPtr("testString"), - // DeleteScript: core.StringPtr("testString"), - // Scope: core.StringPtr("testString"), - // } - - // versionEntitlementModel := &catalogmanagementv1.VersionEntitlement{ - // ProviderName: core.StringPtr("testString"), - // ProviderID: core.StringPtr("testString"), - // ProductID: core.StringPtr("testString"), - // PartNumbers: []string{"testString"}, - // ImageRepoName: core.StringPtr("testString"), - // } - - // licenseModel := &catalogmanagementv1.License{ - // ID: core.StringPtr("testString"), - // Name: core.StringPtr("testString"), - // Type: core.StringPtr("testString"), - // URL: core.StringPtr("testString"), - // Description: core.StringPtr("testString"), - // } - - // stateModel := &catalogmanagementv1.State{ - // Current: core.StringPtr("testString"), - // CurrentEntered: CreateMockDateTime("2019-01-01T12:00:00.000Z"), - // Pending: core.StringPtr("testString"), - // PendingRequested: CreateMockDateTime("2019-01-01T12:00:00.000Z"), - // Previous: core.StringPtr("testString"), - // } - - // versionModel := &catalogmanagementv1.Version{ - // ID: core.StringPtr("testString"), - // Rev: core.StringPtr("testString"), - // CRN: core.StringPtr("testString"), - // Version: core.StringPtr("testString"), - // Sha: core.StringPtr("testString"), - // Created: CreateMockDateTime("2019-01-01T12:00:00.000Z"), - // Updated: CreateMockDateTime("2019-01-01T12:00:00.000Z"), - // OfferingID: core.StringPtr("testString"), - // CatalogID: core.StringPtr("testString"), - // KindID: core.StringPtr("testString"), - // Tags: []string{"testString"}, - // RepoURL: core.StringPtr("testString"), - // SourceURL: core.StringPtr("testString"), - // TgzURL: core.StringPtr("testString"), - // Configuration: []catalogmanagementv1.Configuration{*configurationModel}, - // Metadata: make(map[string]interface{}), - // Validation: validationModel, - // RequiredResources: []catalogmanagementv1.Resource{*resourceModel}, - // SingleInstance: core.BoolPtr(true), - // Install: scriptModel, - // PreInstall: []catalogmanagementv1.Script{*scriptModel}, - // Entitlement: versionEntitlementModel, - // Licenses: []catalogmanagementv1.License{*licenseModel}, - // ImageManifestURL: core.StringPtr("testString"), - // Deprecated: core.BoolPtr(true), - // PackageVersion: core.StringPtr("testString"), - // State: stateModel, - // VersionLocator: core.StringPtr("testString"), - // ConsoleURL: core.StringPtr("testString"), - // LongDescription: core.StringPtr("testString"), - // WhitelistedAccounts: []string{"testString"}, - // } - - // deploymentModel := &catalogmanagementv1.Deployment{ - // ID: core.StringPtr("testString"), - // Label: core.StringPtr("testString"), - // Name: core.StringPtr("testString"), - // ShortDescription: core.StringPtr("testString"), - // LongDescription: core.StringPtr("testString"), - // Metadata: make(map[string]interface{}), - // Tags: []string{"testString"}, - // Created: CreateMockDateTime("2019-01-01T12:00:00.000Z"), - // Updated: CreateMockDateTime("2019-01-01T12:00:00.000Z"), - // } - - // planModel := &catalogmanagementv1.Plan{ - // ID: core.StringPtr("testString"), - // Label: core.StringPtr("testString"), - // Name: core.StringPtr("testString"), - // ShortDescription: core.StringPtr("testString"), - // LongDescription: core.StringPtr("testString"), - // Metadata: make(map[string]interface{}), - // Tags: []string{"testString"}, - // AdditionalFeatures: []catalogmanagementv1.Feature{*featureModel}, - // Created: CreateMockDateTime("2019-01-01T12:00:00.000Z"), - // Updated: CreateMockDateTime("2019-01-01T12:00:00.000Z"), - // Deployments: []catalogmanagementv1.Deployment{*deploymentModel}, - // } - - // kindModel := &catalogmanagementv1.Kind{ - // ID: core.StringPtr("testString"), - // FormatKind: core.StringPtr("testString"), - // TargetKind: core.StringPtr("testString"), - // Metadata: make(map[string]interface{}), - // InstallDescription: core.StringPtr("testString"), - // Tags: []string{"testString"}, - // AdditionalFeatures: []catalogmanagementv1.Feature{*featureModel}, - // Created: CreateMockDateTime("2019-01-01T12:00:00.000Z"), - // Updated: CreateMockDateTime("2019-01-01T12:00:00.000Z"), - // Versions: []catalogmanagementv1.Version{*versionModel}, - // Plans: []catalogmanagementv1.Plan{*planModel}, - // } - - // repoInfoModel := &catalogmanagementv1.RepoInfo{ - // Token: core.StringPtr("testString"), - // Type: core.StringPtr("testString"), - // } - - createOfferingOptions := &catalogmanagementv1.CreateOfferingOptions{ - CatalogIdentifier: &catalogID, - // ID: core.StringPtr("testString"), - // Rev: core.StringPtr("testString"), - // URL: core.StringPtr("testString"), - // CRN: core.StringPtr("testString"), - Label: core.StringPtr(expectedLabel), - Name: core.StringPtr(expectedOfferingName), - // OfferingIconURL: core.StringPtr("testString"), - // OfferingDocsURL: core.StringPtr("testString"), - // OfferingSupportURL: core.StringPtr("testString"), - // Tags: []string{"testString"}, - // Keywords: []string{"testString"}, - // Rating: ratingModel, - // Created: CreateMockDateTime("2019-01-01T12:00:00.000Z"), - // Updated: CreateMockDateTime("2019-01-01T12:00:00.000Z"), - // ShortDescription: core.StringPtr("testString"), - // LongDescription: core.StringPtr("testString"), - // Features: []catalogmanagementv1.Feature{*featureModel}, - // Kinds: []catalogmanagementv1.Kind{*kindModel}, - // PermitRequestIBMPublicPublish: core.BoolPtr(true), - // IBMPublishApproved: core.BoolPtr(true), - // PublicPublishApproved: core.BoolPtr(true), - // PublicOriginalCRN: core.StringPtr("testString"), - // PublishPublicCRN: core.StringPtr("testString"), - // PortalApprovalRecord: core.StringPtr("testString"), - // PortalUIURL: core.StringPtr("testString"), - // CatalogID: core.StringPtr("testString"), - // CatalogName: core.StringPtr("testString"), - // Metadata: make(map[string]interface{}), - // Disclaimer: core.StringPtr("testString"), - // Hidden: core.BoolPtr(true), - // Provider: core.StringPtr("testString"), - // RepoInfo: repoInfoModel, - } - - offering, response, err := catalogManagementService.CreateOffering(createOfferingOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(201)) - Expect(offering).ToNot(BeNil()) - - offeringID = *offering.ID - - Expect(*offering.Name).To(Equal(expectedOfferingName)) - Expect(*offering.URL).To(Equal(fmt.Sprintf(expectedOfferingURL, catalogID, offeringID))) - Expect(*offering.Label).To(Equal(expectedLabel)) - }) - }) - - FDescribe(`GetOffering - Get offering`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`GetOffering(getOfferingOptions *GetOfferingOptions)`, func() { - getOfferingOptions := &catalogmanagementv1.GetOfferingOptions{ - CatalogIdentifier: core.StringPtr(catalogID), - OfferingID: core.StringPtr(offeringID), - } - - offering, response, err := catalogManagementService.GetOffering(getOfferingOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(offering).ToNot(BeNil()) - Expect(*offering.URL).To(Equal(fmt.Sprintf(expectedOfferingURL, catalogID, offeringID))) - }) - It(`GetOffering(getOfferingOptions *GetOfferingOptions) - Fail to get an offering that does not exist`, func() { - getOfferingOptions := &catalogmanagementv1.GetOfferingOptions{ - CatalogIdentifier: core.StringPtr(fakeName), - OfferingID: core.StringPtr(fakeName), - } - - offering, response, err := catalogManagementService.GetOffering(getOfferingOptions) - - Expect(err).ToNot(BeNil()) - Expect(response.StatusCode).To(Equal(404)) - Expect(offering).To(BeNil()) - }) - }) - - FDescribe(`ListOfferings - Get list of offerings`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`ListOfferings(listOfferingsOptions *ListOfferingsOptions)`, func() { - const ( - expectedLimit int64 = 100 - expectedTotalCount int64 = 1 - expectedResourceCount int64 = 1 - expectedResouceLen = 1 - expectedFirst = "/api/v1-beta/catalogs/%s/offerings?limit=100&sort=label" - expectedLast = "/api/v1-beta/catalogs/%s/offerings?limit=100&sort=label" - ) - - listOfferingsOptions := &catalogmanagementv1.ListOfferingsOptions{ - CatalogIdentifier: &catalogID, - } - - offeringSearchResult, response, err := catalogManagementService.ListOfferings(listOfferingsOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(offeringSearchResult).ToNot(BeNil()) - Expect(*offeringSearchResult.Offset).To(BeZero()) - Expect(*offeringSearchResult.Limit).To(Equal(expectedLimit)) - Expect(*offeringSearchResult.TotalCount).To(Equal(expectedTotalCount)) - Expect(*offeringSearchResult.ResourceCount).To(Equal(expectedResourceCount)) - Expect(*offeringSearchResult.First).To(Equal(fmt.Sprintf(expectedFirst, catalogID))) - Expect(*offeringSearchResult.Last).To(Equal(fmt.Sprintf(expectedLast, catalogID))) - Expect(len(offeringSearchResult.Resources)).To(Equal(expectedResouceLen)) - - Expect(*offeringSearchResult.Resources[0].ID).To(Equal(offeringID)) - Expect(*offeringSearchResult.Resources[0].URL).To(Equal(fmt.Sprintf(expectedOfferingURL, catalogID, offeringID))) - Expect(*offeringSearchResult.Resources[0].Label).To(Equal(expectedLabel)) - Expect(*offeringSearchResult.Resources[0].Name).To(Equal(expectedOfferingName)) - Expect(*offeringSearchResult.Resources[0].CatalogID).To(Equal(catalogID)) - Expect(*offeringSearchResult.Resources[0].CatalogName).To(Equal(expectedLabel)) - - }) - }) - - FDescribe(`GetConsumptionOfferings - Get consumption offerings`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`GetConsumptionOfferings(getConsumptionOfferingsOptions *GetConsumptionOfferingsOptions)`, func() { - - getConsumptionOfferingsOptions := &catalogmanagementv1.GetConsumptionOfferingsOptions{ - // Digest: core.BoolPtr(true), - // Catalog: &catalogID, - // Select: core.StringPtr("all"), - // IncludeHidden: core.BoolPtr(true), - // Limit: core.Int64Ptr(int64(1000)), - // Offset: core.Int64Ptr(int64(38)), - } - - offeringSearchResult, response, err := catalogManagementService.GetConsumptionOfferings(getConsumptionOfferingsOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(offeringSearchResult).ToNot(BeNil()) - Expect(*offeringSearchResult.Offset).To(BeZero()) - Expect(*offeringSearchResult.Limit).ToNot(BeZero()) - Expect(*offeringSearchResult.TotalCount).ToNot(BeZero()) - Expect(offeringSearchResult.Last).ToNot(BeNil()) - Expect(offeringSearchResult.Prev).To(BeNil()) - Expect(offeringSearchResult.Next).ToNot(BeNil()) - Expect(len(offeringSearchResult.Resources)).ToNot(BeZero()) - }) - }) - - Describe(`ImportOfferingVersion - Import offering version`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`ImportOfferingVersion(importOfferingVersionOptions *ImportOfferingVersionOptions)`, func() { - - importOfferingVersionOptions := &catalogmanagementv1.ImportOfferingVersionOptions{ - CatalogIdentifier: core.StringPtr(catalogID), - OfferingID: core.StringPtr(offeringID), - } - - offering, response, err := catalogManagementService.ImportOfferingVersion(importOfferingVersionOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(201)) - Expect(offering).ToNot(BeNil()) - }) - }) - - FDescribe(`ImportOffering - Import offering`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`ImportOffering(importOfferingOptions *ImportOfferingOptions)`, func() { - Expect(catalogID).ToNot(BeEmpty()) - - const ( - expectedOfferingName = "node-red-operator-certified" - expectedOfferingLabel = "Node-RED Operator" - expectedOfferingTargetKind = "roks" - expectedOfferingVersion = "0.0.2" - expectedOfferingVersions = 1 - expectedOfferingKinds = 1 - expectedOfferingShortDesc = "Node-RED is a programming tool for wiring together hardware devices, APIs and online services in new and interesting ways." - expectedOfferingURL = "https://cm.globalcatalog.test.cloud.ibm.com/api/v1-beta/catalogs/%s/offerings/%s" - expectedOfferingZipURL = "https://github.com/rhm-samples/node-red-operator/blob/nodered-1.2.8/node-red-operator/bundle/0.0.2/manifests/node-red-operator.v0.0.2.clusterserviceversion.yaml" - ) - - importOfferingOptions := &catalogmanagementv1.ImportOfferingOptions{ - CatalogIdentifier: core.StringPtr(catalogID), - // Tags: []string{"testString"}, - TargetKinds: []string{"roks"}, - // Content: CreateMockByteArray("This is a mock byte array value."), - Zipurl: core.StringPtr(expectedOfferingZipURL), - OfferingID: core.StringPtr(offeringID), - TargetVersion: core.StringPtr("0.0.2"), - // IncludeConfig: core.BoolPtr(true), - // IsVsi: core.BoolPtr(true), - RepoType: core.StringPtr("public_git"), - XAuthToken: core.StringPtr(gitToken), - } - - offering, response, err := catalogManagementService.ImportOffering(importOfferingOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(201)) - Expect(offering).ToNot(BeNil()) - - // Expect(response.StatusCode).To(Equal(201)) - // Expect(*offering.Name).To(Equal(expectedOfferingName)) - // Expect(*offering.URL).To(Equal(fmt.Sprintf(expectedOfferingURL, catalogID, offeringID))) - // Expect(*offering.Label).To(Equal(expectedOfferingLabel)) - // Expect(*offering.ShortDescription).To(Equal(expectedOfferingShortDesc)) - // Expect(*offering.CatalogName).To(Equal(expectedLabel)) - // Expect(*offering.CatalogID).To(Equal(catalogID)) - // Expect(len(offering.Kinds)).To(Equal(expectedOfferingKinds)) - // Expect(*offering.Kinds[0].TargetKind).To(Equal(expectedOfferingTargetKind)) - // Expect(len(offering.Kinds[0].Versions)).To(Equal(expectedOfferingVersions)) - // Expect(*offering.Kinds[0].Versions[0].Version).To(Equal(expectedOfferingVersion)) - - }) - }) - - Describe(`ReloadOffering - Reload offering`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`ReloadOffering(reloadOfferingOptions *ReloadOfferingOptions)`, func() { - - reloadOfferingOptions := &catalogmanagementv1.ReloadOfferingOptions{ - CatalogIdentifier: core.StringPtr("testString"), - OfferingID: core.StringPtr("testString"), - TargetVersion: core.StringPtr("testString"), - Tags: []string{"testString"}, - TargetKinds: []string{"testString"}, - Content: CreateMockByteArray("This is a mock byte array value."), - Zipurl: core.StringPtr("testString"), - RepoType: core.StringPtr("testString"), - } - - offering, response, err := catalogManagementService.ReloadOffering(reloadOfferingOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(201)) - Expect(offering).ToNot(BeNil()) - - }) - }) - - Describe(`ReplaceOffering - Update offering`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`ReplaceOffering(replaceOfferingOptions *ReplaceOfferingOptions)`, func() { - - // ratingModel := &catalogmanagementv1.Rating{ - // OneStarCount: core.Int64Ptr(int64(38)), - // TwoStarCount: core.Int64Ptr(int64(38)), - // ThreeStarCount: core.Int64Ptr(int64(38)), - // FourStarCount: core.Int64Ptr(int64(38)), - // } - - // featureModel := &catalogmanagementv1.Feature{ - // Title: core.StringPtr("testString"), - // Description: core.StringPtr("testString"), - // } - - // configurationModel := &catalogmanagementv1.Configuration{ - // Key: core.StringPtr("testString"), - // Type: core.StringPtr("testString"), - // DefaultValue: core.StringPtr("testString"), - // ValueConstraint: core.StringPtr("testString"), - // Description: core.StringPtr("testString"), - // Required: core.BoolPtr(true), - // Options: []interface{}{"testString"}, - // Hidden: core.BoolPtr(true), - // } - - // validationModel := &catalogmanagementv1.Validation{ - // Validated: CreateMockDateTime("2019-01-01T12:00:00.000Z"), - // Requested: CreateMockDateTime("2019-01-01T12:00:00.000Z"), - // State: core.StringPtr("testString"), - // LastOperation: core.StringPtr("testString"), - // Target: make(map[string]interface{}), - // } - - // resourceModel := &catalogmanagementv1.Resource{ - // Type: core.StringPtr("mem"), - // Value: core.StringPtr("testString"), - // } - - // scriptModel := &catalogmanagementv1.Script{ - // Instructions: core.StringPtr("testString"), - // Script: core.StringPtr("testString"), - // ScriptPermission: core.StringPtr("testString"), - // DeleteScript: core.StringPtr("testString"), - // Scope: core.StringPtr("testString"), - // } - - // versionEntitlementModel := &catalogmanagementv1.VersionEntitlement{ - // ProviderName: core.StringPtr("testString"), - // ProviderID: core.StringPtr("testString"), - // ProductID: core.StringPtr("testString"), - // PartNumbers: []string{"testString"}, - // ImageRepoName: core.StringPtr("testString"), - // } - - // licenseModel := &catalogmanagementv1.License{ - // ID: core.StringPtr("testString"), - // Name: core.StringPtr("testString"), - // Type: core.StringPtr("testString"), - // URL: core.StringPtr("testString"), - // Description: core.StringPtr("testString"), - // } - - // stateModel := &catalogmanagementv1.State{ - // Current: core.StringPtr("testString"), - // CurrentEntered: CreateMockDateTime("2019-01-01T12:00:00.000Z"), - // Pending: core.StringPtr("testString"), - // PendingRequested: CreateMockDateTime("2019-01-01T12:00:00.000Z"), - // Previous: core.StringPtr("testString"), - // } - - // versionModel := &catalogmanagementv1.Version{ - // ID: core.StringPtr("testString"), - // Rev: core.StringPtr("testString"), - // CRN: core.StringPtr("testString"), - // Version: core.StringPtr("testString"), - // Sha: core.StringPtr("testString"), - // Created: CreateMockDateTime("2019-01-01T12:00:00.000Z"), - // Updated: CreateMockDateTime("2019-01-01T12:00:00.000Z"), - // OfferingID: core.StringPtr("testString"), - // CatalogID: core.StringPtr("testString"), - // KindID: core.StringPtr("testString"), - // Tags: []string{"testString"}, - // RepoURL: core.StringPtr("testString"), - // SourceURL: core.StringPtr("testString"), - // TgzURL: core.StringPtr("testString"), - // Configuration: []catalogmanagementv1.Configuration{*configurationModel}, - // Metadata: make(map[string]interface{}), - // Validation: validationModel, - // RequiredResources: []catalogmanagementv1.Resource{*resourceModel}, - // SingleInstance: core.BoolPtr(true), - // Install: scriptModel, - // PreInstall: []catalogmanagementv1.Script{*scriptModel}, - // Entitlement: versionEntitlementModel, - // Licenses: []catalogmanagementv1.License{*licenseModel}, - // ImageManifestURL: core.StringPtr("testString"), - // Deprecated: core.BoolPtr(true), - // PackageVersion: core.StringPtr("testString"), - // State: stateModel, - // VersionLocator: core.StringPtr("testString"), - // ConsoleURL: core.StringPtr("testString"), - // LongDescription: core.StringPtr("testString"), - // WhitelistedAccounts: []string{"testString"}, - // } - - // deploymentModel := &catalogmanagementv1.Deployment{ - // ID: core.StringPtr("testString"), - // Label: core.StringPtr("testString"), - // Name: core.StringPtr("testString"), - // ShortDescription: core.StringPtr("testString"), - // LongDescription: core.StringPtr("testString"), - // Metadata: make(map[string]interface{}), - // Tags: []string{"testString"}, - // Created: CreateMockDateTime("2019-01-01T12:00:00.000Z"), - // Updated: CreateMockDateTime("2019-01-01T12:00:00.000Z"), - // } - - // planModel := &catalogmanagementv1.Plan{ - // ID: core.StringPtr("testString"), - // Label: core.StringPtr("testString"), - // Name: core.StringPtr("testString"), - // ShortDescription: core.StringPtr("testString"), - // LongDescription: core.StringPtr("testString"), - // Metadata: make(map[string]interface{}), - // Tags: []string{"testString"}, - // AdditionalFeatures: []catalogmanagementv1.Feature{*featureModel}, - // Created: CreateMockDateTime("2019-01-01T12:00:00.000Z"), - // Updated: CreateMockDateTime("2019-01-01T12:00:00.000Z"), - // Deployments: []catalogmanagementv1.Deployment{*deploymentModel}, - // } - - // kindModel := &catalogmanagementv1.Kind{ - // ID: core.StringPtr("testString"), - // FormatKind: core.StringPtr("testString"), - // TargetKind: core.StringPtr("testString"), - // Metadata: make(map[string]interface{}), - // InstallDescription: core.StringPtr("testString"), - // Tags: []string{"testString"}, - // AdditionalFeatures: []catalogmanagementv1.Feature{*featureModel}, - // Created: CreateMockDateTime("2019-01-01T12:00:00.000Z"), - // Updated: CreateMockDateTime("2019-01-01T12:00:00.000Z"), - // Versions: []catalogmanagementv1.Version{*versionModel}, - // Plans: []catalogmanagementv1.Plan{*planModel}, - // } - - // repoInfoModel := &catalogmanagementv1.RepoInfo{ - // Token: core.StringPtr("testString"), - // Type: core.StringPtr("testString"), - // } - - replaceOfferingOptions := &catalogmanagementv1.ReplaceOfferingOptions{ - CatalogIdentifier: core.StringPtr(catalogID), - OfferingID: core.StringPtr(offeringID), - ID: core.StringPtr(offeringID), - Rev: core.StringPtr("2-8a366bcd418e559674c83cb73bbd9bb6"), - // URL: core.StringPtr("testString"), - // CRN: core.StringPtr("testString"), - // Label: core.StringPtr("testString"), - // Name: core.StringPtr("testString"), - // OfferingIconURL: core.StringPtr("testString"), - // OfferingDocsURL: core.StringPtr("testString"), - // OfferingSupportURL: core.StringPtr("testString"), - Tags: []string{"tag"}, - // Keywords: []string{"testString"}, - // Rating: ratingModel, - // Created: CreateMockDateTime("2019-01-01T12:00:00.000Z"), - // Updated: CreateMockDateTime("2019-01-01T12:00:00.000Z"), - // ShortDescription: core.StringPtr("testString"), - // LongDescription: core.StringPtr("testString"), - // Features: []catalogmanagementv1.Feature{*featureModel}, - // Kinds: []catalogmanagementv1.Kind{*kindModel}, - // PermitRequestIBMPublicPublish: core.BoolPtr(true), - // IBMPublishApproved: core.BoolPtr(true), - // PublicPublishApproved: core.BoolPtr(true), - // PublicOriginalCRN: core.StringPtr("testString"), - // PublishPublicCRN: core.StringPtr("testString"), - // PortalApprovalRecord: core.StringPtr("testString"), - // PortalUIURL: core.StringPtr("testString"), - // CatalogID: core.StringPtr("testString"), - // CatalogName: core.StringPtr("testString"), - // Metadata: make(map[string]interface{}), - // Disclaimer: core.StringPtr("testString"), - // Hidden: core.BoolPtr(true), - // Provider: core.StringPtr("testString"), - // RepoInfo: repoInfoModel, - } - - offering, response, err := catalogManagementService.ReplaceOffering(replaceOfferingOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(offering).ToNot(BeNil()) - - }) - }) - - FDescribe(`GetOfferingAudit - Get offering audit log`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`GetOfferingAudit(getOfferingAuditOptions *GetOfferingAuditOptions)`, func() { - - getOfferingAuditOptions := &catalogmanagementv1.GetOfferingAuditOptions{ - CatalogIdentifier: core.StringPtr(catalogID), - OfferingID: core.StringPtr(offeringID), - } - - auditLog, response, err := catalogManagementService.GetOfferingAudit(getOfferingAuditOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(auditLog).ToNot(BeNil()) - - }) - }) - - Describe(`ReplaceOfferingIcon - Upload icon for offering`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`ReplaceOfferingIcon(replaceOfferingIconOptions *ReplaceOfferingIconOptions)`, func() { - - replaceOfferingIconOptions := &catalogmanagementv1.ReplaceOfferingIconOptions{ - CatalogIdentifier: core.StringPtr(catalogID), - OfferingID: core.StringPtr(offeringID), - FileName: core.StringPtr("test_icon.png"), - } - - offering, response, err := catalogManagementService.ReplaceOfferingIcon(replaceOfferingIconOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(offering).ToNot(BeNil()) - - }) - }) - - // NOTE: not permitted to approve promotion - Describe(`UpdateOfferingIBM - Allow offering to be published`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`UpdateOfferingIBM(updateOfferingIBMOptions *UpdateOfferingIBMOptions)`, func() { - - updateOfferingIBMOptions := &catalogmanagementv1.UpdateOfferingIBMOptions{ - CatalogIdentifier: core.StringPtr(catalogID), - OfferingID: core.StringPtr(offeringID), - ApprovalType: core.StringPtr("allow_request"), - Approved: core.StringPtr("true"), - } - - approvalResult, response, err := catalogManagementService.UpdateOfferingIBM(updateOfferingIBMOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(approvalResult).ToNot(BeNil()) - - }) - }) - - Describe(`GetOfferingUpdates - Get version updates`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`GetOfferingUpdates(getOfferingUpdatesOptions *GetOfferingUpdatesOptions)`, func() { - - getOfferingUpdatesOptions := &catalogmanagementv1.GetOfferingUpdatesOptions{ - CatalogIdentifier: core.StringPtr("testString"), - OfferingID: core.StringPtr("testString"), - Kind: core.StringPtr("testString"), - Version: core.StringPtr("testString"), - ClusterID: core.StringPtr("testString"), - Region: core.StringPtr("testString"), - ResourceGroupID: core.StringPtr("testString"), - Namespace: core.StringPtr("testString"), - } - - versionUpdateDescriptor, response, err := catalogManagementService.GetOfferingUpdates(getOfferingUpdatesOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(versionUpdateDescriptor).ToNot(BeNil()) - - }) - }) - - Describe(`GetOfferingAbout - Get version about information`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`GetOfferingAbout(getOfferingAboutOptions *GetOfferingAboutOptions)`, func() { - - getOfferingAboutOptions := &catalogmanagementv1.GetOfferingAboutOptions{ - VersionLocID: core.StringPtr("testString"), - } - - result, response, err := catalogManagementService.GetOfferingAbout(getOfferingAboutOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(result).ToNot(BeNil()) - - }) - }) - - Describe(`GetOfferingLicense - Get version license content`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`GetOfferingLicense(getOfferingLicenseOptions *GetOfferingLicenseOptions)`, func() { - - getOfferingLicenseOptions := &catalogmanagementv1.GetOfferingLicenseOptions{ - VersionLocID: core.StringPtr("testString"), - LicenseID: core.StringPtr("testString"), - } - - result, response, err := catalogManagementService.GetOfferingLicense(getOfferingLicenseOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(result).ToNot(BeNil()) - - }) - }) - - Describe(`GetOfferingContainerImages - Get version's container images`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`GetOfferingContainerImages(getOfferingContainerImagesOptions *GetOfferingContainerImagesOptions)`, func() { - - getOfferingContainerImagesOptions := &catalogmanagementv1.GetOfferingContainerImagesOptions{ - VersionLocID: core.StringPtr("testString"), - } - - imageManifest, response, err := catalogManagementService.GetOfferingContainerImages(getOfferingContainerImagesOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(imageManifest).ToNot(BeNil()) - - }) - }) - - Describe(`DeprecateVersion - Deprecate version`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`DeprecateVersion(deprecateVersionOptions *DeprecateVersionOptions)`, func() { - - deprecateVersionOptions := &catalogmanagementv1.DeprecateVersionOptions{ - VersionLocID: core.StringPtr("testString"), - } - - response, err := catalogManagementService.DeprecateVersion(deprecateVersionOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(202)) - - }) - }) - - Describe(`AccountPublishVersion - Publish version to account members`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`AccountPublishVersion(accountPublishVersionOptions *AccountPublishVersionOptions)`, func() { - - accountPublishVersionOptions := &catalogmanagementv1.AccountPublishVersionOptions{ - VersionLocID: core.StringPtr("testString"), - } - - response, err := catalogManagementService.AccountPublishVersion(accountPublishVersionOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(202)) - - }) - }) - - Describe(`IBMPublishVersion - Publish version to IBMers in public catalog`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`IBMPublishVersion(ibmPublishVersionOptions *IBMPublishVersionOptions)`, func() { - - ibmPublishVersionOptions := &catalogmanagementv1.IBMPublishVersionOptions{ - VersionLocID: core.StringPtr("testString"), - } - - response, err := catalogManagementService.IBMPublishVersion(ibmPublishVersionOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(202)) - - }) - }) - - Describe(`PublicPublishVersion - Publish version to all users in public catalog`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`PublicPublishVersion(publicPublishVersionOptions *PublicPublishVersionOptions)`, func() { - - publicPublishVersionOptions := &catalogmanagementv1.PublicPublishVersionOptions{ - VersionLocID: core.StringPtr("testString"), - } - - response, err := catalogManagementService.PublicPublishVersion(publicPublishVersionOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(202)) - - }) - }) - - Describe(`CommitVersion - Commit version`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`CommitVersion(commitVersionOptions *CommitVersionOptions)`, func() { - - commitVersionOptions := &catalogmanagementv1.CommitVersionOptions{ - VersionLocID: core.StringPtr("testString"), - } - - response, err := catalogManagementService.CommitVersion(commitVersionOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - - }) - }) - - Describe(`CopyVersion - Copy version to new target kind`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`CopyVersion(copyVersionOptions *CopyVersionOptions)`, func() { - - copyVersionOptions := &catalogmanagementv1.CopyVersionOptions{ - VersionLocID: core.StringPtr("testString"), - Tags: []string{"testString"}, - TargetKinds: []string{"testString"}, - Content: CreateMockByteArray("This is a mock byte array value."), - } - - response, err := catalogManagementService.CopyVersion(copyVersionOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - - }) - }) - - Describe(`GetOfferingWorkingCopy - Create working copy of version`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`GetOfferingWorkingCopy(getOfferingWorkingCopyOptions *GetOfferingWorkingCopyOptions)`, func() { - - getOfferingWorkingCopyOptions := &catalogmanagementv1.GetOfferingWorkingCopyOptions{ - VersionLocID: core.StringPtr("testString"), - } - - version, response, err := catalogManagementService.GetOfferingWorkingCopy(getOfferingWorkingCopyOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(version).ToNot(BeNil()) - - }) - }) - - Describe(`GetVersion - Get offering/kind/version 'branch'`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`GetVersion(getVersionOptions *GetVersionOptions)`, func() { - - getVersionOptions := &catalogmanagementv1.GetVersionOptions{ - VersionLocID: core.StringPtr("testString"), - } - - offering, response, err := catalogManagementService.GetVersion(getVersionOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(offering).ToNot(BeNil()) - - }) - }) - - // *************** CLUSTERS - FDescribe(`GetCluster - Get kubernetes cluster`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`GetCluster(getClusterOptions *GetClusterOptions)`, func() { - - getClusterOptions := &catalogmanagementv1.GetClusterOptions{ - ClusterID: core.StringPtr(clusterID), - Region: core.StringPtr("US"), - XAuthRefreshToken: core.StringPtr(gitToken), - } - - clusterInfo, response, err := catalogManagementService.GetCluster(getClusterOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(clusterInfo).ToNot(BeNil()) - Expect(*clusterInfo.ID).To(Equal(clusterID)) - }) - }) - - Describe(`GetNamespaces - Get cluster namespaces`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`GetNamespaces(getNamespacesOptions *GetNamespacesOptions)`, func() { - - getNamespacesOptions := &catalogmanagementv1.GetNamespacesOptions{ - ClusterID: core.StringPtr(clusterID), - Region: core.StringPtr("US"), - XAuthRefreshToken: core.StringPtr(gitToken), - // Limit: core.Int64Ptr(int64(1000)), - // Offset: core.Int64Ptr(int64(38)), - } - - namespaceSearchResult, response, err := catalogManagementService.GetNamespaces(getNamespacesOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(namespaceSearchResult).ToNot(BeNil()) - - }) - }) - - Describe(`DeployOperators - Deploy operators`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`DeployOperators(deployOperatorsOptions *DeployOperatorsOptions)`, func() { - - deployOperatorsOptions := &catalogmanagementv1.DeployOperatorsOptions{ - XAuthRefreshToken: core.StringPtr("testString"), - ClusterID: core.StringPtr("testString"), - Region: core.StringPtr("testString"), - Namespaces: []string{"testString"}, - AllNamespaces: core.BoolPtr(true), - VersionLocatorID: core.StringPtr("testString"), - } - - operatorDeployResult, response, err := catalogManagementService.DeployOperators(deployOperatorsOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(operatorDeployResult).ToNot(BeNil()) - - }) - }) - - Describe(`ListOperators - List operators`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`ListOperators(listOperatorsOptions *ListOperatorsOptions)`, func() { - - listOperatorsOptions := &catalogmanagementv1.ListOperatorsOptions{ - XAuthRefreshToken: core.StringPtr("testString"), - ClusterID: core.StringPtr("testString"), - Region: core.StringPtr("testString"), - VersionLocatorID: core.StringPtr("testString"), - } - - operatorDeployResult, response, err := catalogManagementService.ListOperators(listOperatorsOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(operatorDeployResult).ToNot(BeNil()) - - }) - }) - - Describe(`ReplaceOperators - Update operators`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`ReplaceOperators(replaceOperatorsOptions *ReplaceOperatorsOptions)`, func() { - - replaceOperatorsOptions := &catalogmanagementv1.ReplaceOperatorsOptions{ - XAuthRefreshToken: core.StringPtr("testString"), - ClusterID: core.StringPtr("testString"), - Region: core.StringPtr("testString"), - Namespaces: []string{"testString"}, - AllNamespaces: core.BoolPtr(true), - VersionLocatorID: core.StringPtr("testString"), - } - - operatorDeployResult, response, err := catalogManagementService.ReplaceOperators(replaceOperatorsOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(operatorDeployResult).ToNot(BeNil()) - - }) - }) - - Describe(`InstallVersion - Install version`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`InstallVersion(installVersionOptions *InstallVersionOptions)`, func() { - - deployRequestBodySchematicsModel := &catalogmanagementv1.DeployRequestBodySchematics{ - Name: core.StringPtr("testString"), - Description: core.StringPtr("testString"), - Tags: []string{"testString"}, - ResourceGroupID: core.StringPtr("testString"), - } - - installVersionOptions := &catalogmanagementv1.InstallVersionOptions{ - VersionLocID: core.StringPtr("testString"), - XAuthRefreshToken: core.StringPtr("testString"), - ClusterID: core.StringPtr("testString"), - Region: core.StringPtr("testString"), - Namespace: core.StringPtr("testString"), - OverrideValues: make(map[string]interface{}), - EntitlementApikey: core.StringPtr("testString"), - Schematics: deployRequestBodySchematicsModel, - Script: core.StringPtr("testString"), - ScriptID: core.StringPtr("testString"), - VersionLocatorID: core.StringPtr("testString"), - VcenterID: core.StringPtr("testString"), - VcenterUser: core.StringPtr("testString"), - VcenterPassword: core.StringPtr("testString"), - VcenterLocation: core.StringPtr("testString"), - VcenterDatastore: core.StringPtr("testString"), - } - - response, err := catalogManagementService.InstallVersion(installVersionOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(202)) - - }) - }) - - Describe(`PreinstallVersion - Pre-install version`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`PreinstallVersion(preinstallVersionOptions *PreinstallVersionOptions)`, func() { - - deployRequestBodySchematicsModel := &catalogmanagementv1.DeployRequestBodySchematics{ - Name: core.StringPtr("testString"), - Description: core.StringPtr("testString"), - Tags: []string{"testString"}, - ResourceGroupID: core.StringPtr("testString"), - } - - preinstallVersionOptions := &catalogmanagementv1.PreinstallVersionOptions{ - VersionLocID: core.StringPtr("testString"), - XAuthRefreshToken: core.StringPtr("testString"), - ClusterID: core.StringPtr("testString"), - Region: core.StringPtr("testString"), - Namespace: core.StringPtr("testString"), - OverrideValues: make(map[string]interface{}), - EntitlementApikey: core.StringPtr("testString"), - Schematics: deployRequestBodySchematicsModel, - Script: core.StringPtr("testString"), - ScriptID: core.StringPtr("testString"), - VersionLocatorID: core.StringPtr("testString"), - VcenterID: core.StringPtr("testString"), - VcenterUser: core.StringPtr("testString"), - VcenterPassword: core.StringPtr("testString"), - VcenterLocation: core.StringPtr("testString"), - VcenterDatastore: core.StringPtr("testString"), - } - - response, err := catalogManagementService.PreinstallVersion(preinstallVersionOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(202)) - - }) - }) - - Describe(`GetPreinstall - Get version pre-install status`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`GetPreinstall(getPreinstallOptions *GetPreinstallOptions)`, func() { - - getPreinstallOptions := &catalogmanagementv1.GetPreinstallOptions{ - VersionLocID: core.StringPtr("testString"), - XAuthRefreshToken: core.StringPtr("testString"), - ClusterID: core.StringPtr("testString"), - Region: core.StringPtr("testString"), - Namespace: core.StringPtr("testString"), - } - - installStatus, response, err := catalogManagementService.GetPreinstall(getPreinstallOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(installStatus).ToNot(BeNil()) - - }) - }) - - Describe(`ValidateInstall - Validate offering`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`ValidateInstall(validateInstallOptions *ValidateInstallOptions)`, func() { - - deployRequestBodySchematicsModel := &catalogmanagementv1.DeployRequestBodySchematics{ - Name: core.StringPtr("testString"), - Description: core.StringPtr("testString"), - Tags: []string{"testString"}, - ResourceGroupID: core.StringPtr("testString"), - } - - validateInstallOptions := &catalogmanagementv1.ValidateInstallOptions{ - VersionLocID: core.StringPtr("testString"), - XAuthRefreshToken: core.StringPtr("testString"), - ClusterID: core.StringPtr("testString"), - Region: core.StringPtr("testString"), - Namespace: core.StringPtr("testString"), - OverrideValues: make(map[string]interface{}), - EntitlementApikey: core.StringPtr("testString"), - Schematics: deployRequestBodySchematicsModel, - Script: core.StringPtr("testString"), - ScriptID: core.StringPtr("testString"), - VersionLocatorID: core.StringPtr("testString"), - VcenterID: core.StringPtr("testString"), - VcenterUser: core.StringPtr("testString"), - VcenterPassword: core.StringPtr("testString"), - VcenterLocation: core.StringPtr("testString"), - VcenterDatastore: core.StringPtr("testString"), - } - - response, err := catalogManagementService.ValidateInstall(validateInstallOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(202)) - - }) - }) - - Describe(`GetValidationStatus - Get offering install status`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`GetValidationStatus(getValidationStatusOptions *GetValidationStatusOptions)`, func() { - - getValidationStatusOptions := &catalogmanagementv1.GetValidationStatusOptions{ - VersionLocID: core.StringPtr("testString"), - XAuthRefreshToken: core.StringPtr("testString"), - } - - validation, response, err := catalogManagementService.GetValidationStatus(getValidationStatusOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(validation).ToNot(BeNil()) - - }) - }) - - Describe(`GetOverrideValues - Get override values`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`GetOverrideValues(getOverrideValuesOptions *GetOverrideValuesOptions)`, func() { - - getOverrideValuesOptions := &catalogmanagementv1.GetOverrideValuesOptions{ - VersionLocID: core.StringPtr("testString"), - } - - result, response, err := catalogManagementService.GetOverrideValues(getOverrideValuesOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(result).ToNot(BeNil()) - - }) - }) - - Describe(`SearchObjects - List objects across catalogs`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`SearchObjects(searchObjectsOptions *SearchObjectsOptions)`, func() { - - searchObjectsOptions := &catalogmanagementv1.SearchObjectsOptions{ - Query: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(1000)), - Offset: core.Int64Ptr(int64(38)), - Collapse: core.BoolPtr(true), - Digest: core.BoolPtr(true), - } - - objectSearchResult, response, err := catalogManagementService.SearchObjects(searchObjectsOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(objectSearchResult).ToNot(BeNil()) - - }) - }) - - Describe(`ListObjects - List objects within a catalog`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`ListObjects(listObjectsOptions *ListObjectsOptions)`, func() { - - listObjectsOptions := &catalogmanagementv1.ListObjectsOptions{ - CatalogIdentifier: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(1000)), - Offset: core.Int64Ptr(int64(38)), - Name: core.StringPtr("testString"), - Sort: core.StringPtr("testString"), - } - - objectListResult, response, err := catalogManagementService.ListObjects(listObjectsOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(objectListResult).ToNot(BeNil()) - - }) - }) - - Describe(`CreateObject - Create catalog object`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`CreateObject(createObjectOptions *CreateObjectOptions)`, func() { - - // publishObjectModel := &catalogmanagementv1.PublishObject{ - // PermitIBMPublicPublish: core.BoolPtr(true), - // IBMApproved: core.BoolPtr(true), - // PublicApproved: core.BoolPtr(true), - // PortalApprovalRecord: core.StringPtr("testString"), - // PortalURL: core.StringPtr("testString"), - // } - - // stateModel := &catalogmanagementv1.State{ - // Current: core.StringPtr("testString"), - // CurrentEntered: CreateMockDateTime("2019-01-01T12:00:00.000Z"), - // Pending: core.StringPtr("testString"), - // PendingRequested: CreateMockDateTime("2019-01-01T12:00:00.000Z"), - // Previous: core.StringPtr("testString"), - // } - - createObjectOptions := &catalogmanagementv1.CreateObjectOptions{ - CatalogIdentifier: core.StringPtr(catalogID), - // ID: core.StringPtr("testString"), - Name: core.StringPtr(fakeName), - // Rev: core.StringPtr("testString"), - // CRN: core.StringPtr("testString"), - // URL: core.StringPtr("testString"), - // ParentID: core.StringPtr("testString"), - // LabelI18n: core.StringPtr("testString"), - Label: core.StringPtr(expectedLabel), - // Tags: []string{"testString"}, - // Created: CreateMockDateTime("2019-01-01T12:00:00.000Z"), - // Updated: CreateMockDateTime("2019-01-01T12:00:00.000Z"), - // ShortDescription: core.StringPtr("testString"), - // ShortDescriptionI18n: core.StringPtr("testString"), - Kind: core.StringPtr("terraform"), - // Publish: publishObjectModel, - // State: stateModel, - // CatalogID: core.StringPtr("testString"), - // CatalogName: core.StringPtr("testString"), - // Data: make(map[string]interface{}), - } - - catalogObject, response, err := catalogManagementService.CreateObject(createObjectOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(201)) - Expect(catalogObject).ToNot(BeNil()) - - }) - }) - - Describe(`GetObject - Get catalog object`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`GetObject(getObjectOptions *GetObjectOptions)`, func() { - - getObjectOptions := &catalogmanagementv1.GetObjectOptions{ - CatalogIdentifier: core.StringPtr("testString"), - ObjectIdentifier: core.StringPtr("testString"), - } - - catalogObject, response, err := catalogManagementService.GetObject(getObjectOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(catalogObject).ToNot(BeNil()) - - }) - }) - - Describe(`ReplaceObject - Update catalog object`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`ReplaceObject(replaceObjectOptions *ReplaceObjectOptions)`, func() { - - publishObjectModel := &catalogmanagementv1.PublishObject{ - PermitIBMPublicPublish: core.BoolPtr(true), - IBMApproved: core.BoolPtr(true), - PublicApproved: core.BoolPtr(true), - PortalApprovalRecord: core.StringPtr("testString"), - PortalURL: core.StringPtr("testString"), - } - - stateModel := &catalogmanagementv1.State{ - Current: core.StringPtr("testString"), - CurrentEntered: CreateMockDateTime("2019-01-01T12:00:00.000Z"), - Pending: core.StringPtr("testString"), - PendingRequested: CreateMockDateTime("2019-01-01T12:00:00.000Z"), - Previous: core.StringPtr("testString"), - } - - replaceObjectOptions := &catalogmanagementv1.ReplaceObjectOptions{ - CatalogIdentifier: core.StringPtr("testString"), - ObjectIdentifier: core.StringPtr("testString"), - ID: core.StringPtr("testString"), - Name: core.StringPtr("testString"), - Rev: core.StringPtr("testString"), - CRN: core.StringPtr("testString"), - URL: core.StringPtr("testString"), - ParentID: core.StringPtr("testString"), - LabelI18n: core.StringPtr("testString"), - Label: core.StringPtr("testString"), - Tags: []string{"testString"}, - Created: CreateMockDateTime("2019-01-01T12:00:00.000Z"), - Updated: CreateMockDateTime("2019-01-01T12:00:00.000Z"), - ShortDescription: core.StringPtr("testString"), - ShortDescriptionI18n: core.StringPtr("testString"), - Kind: core.StringPtr("testString"), - Publish: publishObjectModel, - State: stateModel, - CatalogID: core.StringPtr("testString"), - CatalogName: core.StringPtr("testString"), - Data: make(map[string]interface{}), - } - - catalogObject, response, err := catalogManagementService.ReplaceObject(replaceObjectOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(catalogObject).ToNot(BeNil()) - - }) - }) - - Describe(`GetObjectAudit - Get catalog object audit log`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`GetObjectAudit(getObjectAuditOptions *GetObjectAuditOptions)`, func() { - - getObjectAuditOptions := &catalogmanagementv1.GetObjectAuditOptions{ - CatalogIdentifier: core.StringPtr("testString"), - ObjectIdentifier: core.StringPtr("testString"), - } - - auditLog, response, err := catalogManagementService.GetObjectAudit(getObjectAuditOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(auditLog).ToNot(BeNil()) - - }) - }) - - Describe(`AccountPublishObject - Publish object to account`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`AccountPublishObject(accountPublishObjectOptions *AccountPublishObjectOptions)`, func() { - - accountPublishObjectOptions := &catalogmanagementv1.AccountPublishObjectOptions{ - CatalogIdentifier: core.StringPtr("testString"), - ObjectIdentifier: core.StringPtr("testString"), - } - - response, err := catalogManagementService.AccountPublishObject(accountPublishObjectOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(202)) - - }) - }) - - Describe(`SharedPublishObject - Publish object to share with allow list`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`SharedPublishObject(sharedPublishObjectOptions *SharedPublishObjectOptions)`, func() { - - sharedPublishObjectOptions := &catalogmanagementv1.SharedPublishObjectOptions{ - CatalogIdentifier: core.StringPtr("testString"), - ObjectIdentifier: core.StringPtr("testString"), - } - - response, err := catalogManagementService.SharedPublishObject(sharedPublishObjectOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(202)) - - }) - }) - - Describe(`IBMPublishObject - Publish object to share with IBMers`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`IBMPublishObject(ibmPublishObjectOptions *IBMPublishObjectOptions)`, func() { - - ibmPublishObjectOptions := &catalogmanagementv1.IBMPublishObjectOptions{ - CatalogIdentifier: core.StringPtr("testString"), - ObjectIdentifier: core.StringPtr("testString"), - } - - response, err := catalogManagementService.IBMPublishObject(ibmPublishObjectOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(202)) - - }) - }) - - Describe(`PublicPublishObject - Publish object to share with all users`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`PublicPublishObject(publicPublishObjectOptions *PublicPublishObjectOptions)`, func() { - - publicPublishObjectOptions := &catalogmanagementv1.PublicPublishObjectOptions{ - CatalogIdentifier: core.StringPtr("testString"), - ObjectIdentifier: core.StringPtr("testString"), - } - - response, err := catalogManagementService.PublicPublishObject(publicPublishObjectOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(202)) - - }) - }) - - Describe(`CreateObjectAccess - Add account ID to object access list`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`CreateObjectAccess(createObjectAccessOptions *CreateObjectAccessOptions)`, func() { - - createObjectAccessOptions := &catalogmanagementv1.CreateObjectAccessOptions{ - CatalogIdentifier: core.StringPtr("testString"), - ObjectIdentifier: core.StringPtr("testString"), - AccountIdentifier: core.StringPtr("testString"), - } - - response, err := catalogManagementService.CreateObjectAccess(createObjectAccessOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(201)) - - }) - }) - - Describe(`GetObjectAccess - Check for account ID in object access list`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`GetObjectAccess(getObjectAccessOptions *GetObjectAccessOptions)`, func() { - - getObjectAccessOptions := &catalogmanagementv1.GetObjectAccessOptions{ - CatalogIdentifier: core.StringPtr("testString"), - ObjectIdentifier: core.StringPtr("testString"), - AccountIdentifier: core.StringPtr("testString"), - } - - objectAccess, response, err := catalogManagementService.GetObjectAccess(getObjectAccessOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(objectAccess).ToNot(BeNil()) - - }) - }) - - Describe(`GetObjectAccessList - Get object access list`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`GetObjectAccessList(getObjectAccessListOptions *GetObjectAccessListOptions)`, func() { - - getObjectAccessListOptions := &catalogmanagementv1.GetObjectAccessListOptions{ - CatalogIdentifier: core.StringPtr("testString"), - ObjectIdentifier: core.StringPtr("testString"), - Limit: core.Int64Ptr(int64(1000)), - Offset: core.Int64Ptr(int64(38)), - } - - objectAccessListResult, response, err := catalogManagementService.GetObjectAccessList(getObjectAccessListOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(objectAccessListResult).ToNot(BeNil()) - - }) - }) - - Describe(`AddObjectAccessList - Add accounts to object access list`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`AddObjectAccessList(addObjectAccessListOptions *AddObjectAccessListOptions)`, func() { - - addObjectAccessListOptions := &catalogmanagementv1.AddObjectAccessListOptions{ - CatalogIdentifier: core.StringPtr("testString"), - ObjectIdentifier: core.StringPtr("testString"), - Accounts: []string{"testString"}, - } - - accessListBulkResponse, response, err := catalogManagementService.AddObjectAccessList(addObjectAccessListOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(accessListBulkResponse).ToNot(BeNil()) - - }) - }) - - Describe(`CreateOfferingInstance - Create an offering resource instance`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`CreateOfferingInstance(createOfferingInstanceOptions *CreateOfferingInstanceOptions)`, func() { - - createOfferingInstanceOptions := &catalogmanagementv1.CreateOfferingInstanceOptions{ - XAuthRefreshToken: core.StringPtr("testString"), - ID: core.StringPtr("testString"), - URL: core.StringPtr("testString"), - CRN: core.StringPtr("testString"), - Label: core.StringPtr("testString"), - CatalogID: core.StringPtr("testString"), - OfferingID: core.StringPtr("testString"), - KindFormat: core.StringPtr("testString"), - Version: core.StringPtr("testString"), - ClusterID: core.StringPtr("testString"), - ClusterRegion: core.StringPtr("testString"), - ClusterNamespaces: []string{"testString"}, - ClusterAllNamespaces: core.BoolPtr(true), - } - - offeringInstance, response, err := catalogManagementService.CreateOfferingInstance(createOfferingInstanceOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(201)) - Expect(offeringInstance).ToNot(BeNil()) - - }) - }) - - Describe(`GetOfferingInstance - Get Offering Instance`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`GetOfferingInstance(getOfferingInstanceOptions *GetOfferingInstanceOptions)`, func() { - - getOfferingInstanceOptions := &catalogmanagementv1.GetOfferingInstanceOptions{ - InstanceIdentifier: core.StringPtr("testString"), - } - - offeringInstance, response, err := catalogManagementService.GetOfferingInstance(getOfferingInstanceOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(offeringInstance).ToNot(BeNil()) - - }) - }) - - Describe(`PutOfferingInstance - Update Offering Instance`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`PutOfferingInstance(putOfferingInstanceOptions *PutOfferingInstanceOptions)`, func() { - - putOfferingInstanceOptions := &catalogmanagementv1.PutOfferingInstanceOptions{ - InstanceIdentifier: core.StringPtr("testString"), - XAuthRefreshToken: core.StringPtr("testString"), - ID: core.StringPtr("testString"), - URL: core.StringPtr("testString"), - CRN: core.StringPtr("testString"), - Label: core.StringPtr("testString"), - CatalogID: core.StringPtr("testString"), - OfferingID: core.StringPtr("testString"), - KindFormat: core.StringPtr("testString"), - Version: core.StringPtr("testString"), - ClusterID: core.StringPtr("testString"), - ClusterRegion: core.StringPtr("testString"), - ClusterNamespaces: []string{"testString"}, - ClusterAllNamespaces: core.BoolPtr(true), - } - - offeringInstance, response, err := catalogManagementService.PutOfferingInstance(putOfferingInstanceOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(offeringInstance).ToNot(BeNil()) - - }) - }) - - // *************** DELETE - Describe(`DeleteVersion - Delete version`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`DeleteVersion(deleteVersionOptions *DeleteVersionOptions)`, func() { - - deleteVersionOptions := &catalogmanagementv1.DeleteVersionOptions{ - VersionLocID: core.StringPtr("testString"), - } - - response, err := catalogManagementService.DeleteVersion(deleteVersionOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - - }) - }) - - Describe(`DeleteOperators - Delete operators`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`DeleteOperators(deleteOperatorsOptions *DeleteOperatorsOptions)`, func() { - - deleteOperatorsOptions := &catalogmanagementv1.DeleteOperatorsOptions{ - XAuthRefreshToken: core.StringPtr("testString"), - ClusterID: core.StringPtr("testString"), - Region: core.StringPtr("testString"), - VersionLocatorID: core.StringPtr("testString"), - } - - response, err := catalogManagementService.DeleteOperators(deleteOperatorsOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - - }) - }) - - Describe(`DeleteOfferingInstance - Delete a version instance`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`DeleteOfferingInstance(deleteOfferingInstanceOptions *DeleteOfferingInstanceOptions)`, func() { - - deleteOfferingInstanceOptions := &catalogmanagementv1.DeleteOfferingInstanceOptions{ - InstanceIdentifier: core.StringPtr("testString"), - XAuthRefreshToken: core.StringPtr("testString"), - } - - response, err := catalogManagementService.DeleteOfferingInstance(deleteOfferingInstanceOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - - }) - }) - - FDescribe(`DeleteOffering - Delete offering`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`DeleteOffering(deleteOfferingOptions *DeleteOfferingOptions)`, func() { - - deleteOfferingOptions := &catalogmanagementv1.DeleteOfferingOptions{ - CatalogIdentifier: &catalogID, - OfferingID: &offeringID, - } - - response, err := catalogManagementService.DeleteOffering(deleteOfferingOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - - }) - It(`DeleteOffering(deleteOfferingOptions *DeleteOfferingOptions) - Fail to delete an offering that does not exist`, func() { - - deleteOfferingOptions := &catalogmanagementv1.DeleteOfferingOptions{ - CatalogIdentifier: core.StringPtr(fakeName), - OfferingID: core.StringPtr(fakeName), - } - - response, err := catalogManagementService.DeleteOffering(deleteOfferingOptions) - - Expect(err).ToNot(BeNil()) - Expect(response.StatusCode).To(Equal(404)) - }) - }) - - Describe(`DeleteObjectAccessList - Delete accounts from object access list`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`DeleteObjectAccessList(deleteObjectAccessListOptions *DeleteObjectAccessListOptions)`, func() { - - deleteObjectAccessListOptions := &catalogmanagementv1.DeleteObjectAccessListOptions{ - CatalogIdentifier: core.StringPtr("testString"), - ObjectIdentifier: core.StringPtr("testString"), - Accounts: []string{"testString"}, - } - - accessListBulkResponse, response, err := catalogManagementService.DeleteObjectAccessList(deleteObjectAccessListOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(accessListBulkResponse).ToNot(BeNil()) - - }) - }) - - Describe(`DeleteObjectAccess - Remove account ID from object access list`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`DeleteObjectAccess(deleteObjectAccessOptions *DeleteObjectAccessOptions)`, func() { - - deleteObjectAccessOptions := &catalogmanagementv1.DeleteObjectAccessOptions{ - CatalogIdentifier: core.StringPtr("testString"), - ObjectIdentifier: core.StringPtr("testString"), - AccountIdentifier: core.StringPtr("testString"), - } - - response, err := catalogManagementService.DeleteObjectAccess(deleteObjectAccessOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - - }) - }) - - Describe(`DeleteObject - Delete catalog object`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`DeleteObject(deleteObjectOptions *DeleteObjectOptions)`, func() { - - deleteObjectOptions := &catalogmanagementv1.DeleteObjectOptions{ - CatalogIdentifier: core.StringPtr(catalogID), - ObjectIdentifier: core.StringPtr(objectID), - } - - response, err := catalogManagementService.DeleteObject(deleteObjectOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - - }) - }) - - FDescribe(`DeleteCatalog - Delete catalog`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - FIt(`DeleteCatalog(deleteCatalogOptions *DeleteCatalogOptions)`, func() { - - deleteCatalogOptions := &catalogmanagementv1.DeleteCatalogOptions{ - CatalogIdentifier: &catalogID, - } - - response, err := catalogManagementService.DeleteCatalog(deleteCatalogOptions) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - }) - It(`DeleteCatalog(deleteCatalogOptions *DeleteCatalogOptions) - Fail to delete a catalog that does not exist`, func() { - - deleteCatalogOptions := &catalogmanagementv1.DeleteCatalogOptions{ - CatalogIdentifier: core.StringPtr(fakeName), - } - - response, err := catalogManagementService.DeleteCatalog(deleteCatalogOptions) - - Expect(err).ToNot(BeNil()) - Expect(response.StatusCode).To(Equal(404)) - }) - }) - }) - -}) - -// -// Utility functions are declared in the unit test file -// diff --git a/catalogmanagementv1/catalog_management_v1_old_integration_test.go b/catalogmanagementv1/catalog_management_v1_old_integration_test.go deleted file mode 100644 index 52c129a0..00000000 --- a/catalogmanagementv1/catalog_management_v1_old_integration_test.go +++ /dev/null @@ -1,1069 +0,0 @@ -//go:build integration2 -// +build integration2 - -/** - * (C) Copyright IBM Corp. 2020. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package catalogmanagementv1_test - -import ( - "fmt" - "log" - "os" - "time" - - "github.com/IBM/go-sdk-core/v5/core" - "github.com/IBM/platform-services-go-sdk/catalogmanagementv1" - common "github.com/IBM/platform-services-go-sdk/common" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -var _ = Describe("Catalog Management - Integration Tests (OLD)", func() { - const ( - externalConfigFile = "../catalog_mgmt.env" - expectedShortDesc = "test" - expectedURL = "https://cm.globalcatalog.test.cloud.ibm.com/api/v1-beta/catalogs/%s" - expectedOfferingsURL = "https://cm.globalcatalog.test.cloud.ibm.com/api/v1-beta/catalogs/%s/offerings" - fakeName = "bogus" - fakeVersionLocator = "bogus.bogus" - expectedOfferingName = "test-offering" - expectedOfferingURL = "https://cm.globalcatalog.test.cloud.ibm.com/api/v1-beta/catalogs/%s/offerings/%s" - ) - - var ( - service *catalogmanagementv1.CatalogManagementV1 - gitToken string - accountID string - configLoaded bool = false - expectedLabel = fmt.Sprintf("integration-test-%d", time.Now().Unix()) - ) - - var shouldSkipTest = func() { - if !configLoaded { - Skip("External configuration is not available, skipping...") - } - } - - It("Successfully load the configuration", func() { - if _, err := os.Stat(externalConfigFile); err == nil { - if err = os.Setenv("IBM_CREDENTIALS_FILE", externalConfigFile); err == nil { - configLoaded = true - } - } - - if !configLoaded { - Skip("External configuration could not be loaded, skipping...") - } - }) - - It(`Successfully created CatalogManagementV1 service instance`, func() { - var err error - var config map[string]string - - shouldSkipTest() - - service, err = catalogmanagementv1.NewCatalogManagementV1UsingExternalConfig( - &catalogmanagementv1.CatalogManagementV1Options{}, - ) - - Expect(err).To(BeNil()) - Expect(service).ToNot(BeNil()) - - core.SetLogger(core.NewLogger(core.LevelDebug, log.New(GinkgoWriter, "", log.LstdFlags), log.New(GinkgoWriter, "", log.LstdFlags))) - service.EnableRetries(4, 30*time.Second) - - config, err = core.GetServiceProperties(catalogmanagementv1.DefaultServiceName) - - if err != nil { - configLoaded = false - } - - Expect(err).To(BeNil()) - gitToken = config["GIT_TOKEN"] - Expect(gitToken).ToNot(BeEmpty()) - - accountID = config["ACCOUNT_ID"] - Expect(accountID).ToNot(BeEmpty()) - }) - - Describe("Run integration tests", func() { - JustBeforeEach(func() { - shouldSkipTest() - - listResult, _, _ := service.ListCatalogs(service.NewListCatalogsOptions()) - if listResult != nil && listResult.Resources != nil { - for _, resource := range listResult.Resources { - if *resource.Label == expectedLabel { - service.DeleteCatalog(service.NewDeleteCatalogOptions(*resource.ID)) - } - } - } - }) - - JustAfterEach(func() { - shouldSkipTest() - - listResult, _, _ := service.ListCatalogs(service.NewListCatalogsOptions()) - if listResult != nil && listResult.Resources != nil { - for _, resource := range listResult.Resources { - if *resource.Label == expectedLabel { - service.DeleteCatalog(service.NewDeleteCatalogOptions(*resource.ID)) - } - } - } - }) - - It("Get catalog account", func() { - shouldSkipTest() - - options := service.NewGetCatalogAccountOptions() - result, response, err := service.GetCatalogAccount(options) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(*result.ID).To(Equal(accountID)) - Expect(*result.AccountFilters.IncludeAll).To(BeTrue()) - Expect(len(result.AccountFilters.CategoryFilters)).To(BeZero()) - Expect(result.AccountFilters.IDFilters.Include).ToNot(BeNil()) - Expect(result.AccountFilters.IDFilters.Exclude).ToNot(BeNil()) - }) - - It("Get catalog account filters", func() { - shouldSkipTest() - - options := service.NewGetCatalogAccountFiltersOptions() - result, response, err := service.GetCatalogAccountFilters(options) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(*result.AccountFilters[0].IncludeAll).To(BeTrue()) - Expect(len(result.AccountFilters[0].CategoryFilters)).To(BeZero()) - Expect(result.AccountFilters[0].IDFilters.Include).ToNot(BeNil()) - Expect(result.AccountFilters[0].IDFilters.Exclude).ToNot(BeNil()) - }) - - It("Get list of catalogs", func() { - const ( - expectedTotalCount = 1 - expectedResourceCount = 1 - ) - - catalogCount := 0 - catalogIndex := -1 - - shouldSkipTest() - - createOptions := service.NewCreateCatalogOptions() - createOptions.SetLabel(expectedLabel) - createOptions.SetShortDescription(expectedShortDesc) - createResult, _, _ := service.CreateCatalog(createOptions) - - listOptions := service.NewListCatalogsOptions() - listResult, listResponse, err := service.ListCatalogs(listOptions) - if listResult != nil && listResult.Resources != nil { - for i, resource := range listResult.Resources { - if *resource.Label == expectedLabel { - catalogCount++ - catalogIndex = i - } - } - } - - service.DeleteCatalog(service.NewDeleteCatalogOptions(*createResult.ID)) - - Expect(err).To(BeNil()) - Expect(listResponse.StatusCode).To(Equal(200)) - Expect(listResult).ToNot(BeNil()) - fmt.Fprintf(GinkgoWriter, "ListCatalogs() result:\n%s\n", common.ToJSON(listResult)) - - Expect(catalogCount).To(Equal(expectedTotalCount)) - Expect(*listResult.Resources[catalogIndex].Label).To(Equal(expectedLabel)) - Expect(*listResult.Resources[catalogIndex].ShortDescription).To(Equal(expectedShortDesc)) - Expect(*listResult.Resources[catalogIndex].URL).To(Equal(fmt.Sprintf(expectedURL, *createResult.ID))) - Expect(*listResult.Resources[catalogIndex].OfferingsURL).To(Equal(fmt.Sprintf(expectedOfferingsURL, *createResult.ID))) - Expect(*listResult.Resources[catalogIndex].OwningAccount).To(Equal(accountID)) - Expect(*listResult.Resources[catalogIndex].CatalogFilters.IncludeAll).To(BeFalse()) - Expect(len(listResult.Resources[catalogIndex].CatalogFilters.CategoryFilters)).To(BeZero()) - Expect(listResult.Resources[catalogIndex].CatalogFilters.IDFilters.Include).To(BeNil()) - Expect(listResult.Resources[catalogIndex].CatalogFilters.IDFilters.Exclude).To(BeNil()) - }) - - It("Create a catalog", func() { - shouldSkipTest() - - options := service.NewCreateCatalogOptions() - options.SetLabel(expectedLabel) - options.SetShortDescription(expectedShortDesc) - result, response, err := service.CreateCatalog(options) - - service.DeleteCatalog(service.NewDeleteCatalogOptions(*result.ID)) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(201)) - Expect(result).ToNot(BeNil()) - fmt.Fprintf(GinkgoWriter, "CreateCatalog() result:\n%s\n", common.ToJSON(result)) - - Expect(*result.Label).To(Equal(expectedLabel)) - Expect(*result.ShortDescription).To(Equal(expectedShortDesc)) - Expect(*result.URL).To(Equal(fmt.Sprintf(expectedURL, *result.ID))) - Expect(*result.OfferingsURL).To(Equal(fmt.Sprintf(expectedOfferingsURL, *result.ID))) - Expect(*result.OwningAccount).To(Equal(accountID)) - Expect(*result.CatalogFilters.IncludeAll).To(BeFalse()) - Expect(len(result.CatalogFilters.CategoryFilters)).To(BeZero()) - Expect(result.CatalogFilters.IDFilters.Include).To(BeNil()) - Expect(result.CatalogFilters.IDFilters.Exclude).To(BeNil()) - }) - - It("Get a catalog", func() { - shouldSkipTest() - - createOptions := service.NewCreateCatalogOptions() - createOptions.SetLabel(expectedLabel) - createOptions.SetShortDescription(expectedShortDesc) - createResult, _, err := service.CreateCatalog(createOptions) - - Expect(err).To(BeNil()) - - id := *createResult.ID - - getOptions := service.NewGetCatalogOptions(id) - getResult, getResponse, err := service.GetCatalog(getOptions) - - service.DeleteCatalog(service.NewDeleteCatalogOptions(id)) - - Expect(err).To(BeNil()) - Expect(getResponse.StatusCode).To(Equal(200)) - Expect(*getResult.Label).To(Equal(expectedLabel)) - Expect(*getResult.ShortDescription).To(Equal(expectedShortDesc)) - Expect(*getResult.URL).To(Equal(fmt.Sprintf(expectedURL, id))) - Expect(*getResult.OfferingsURL).To(Equal(fmt.Sprintf(expectedOfferingsURL, id))) - Expect(*getResult.OwningAccount).To(Equal(accountID)) - Expect(*getResult.CatalogFilters.IncludeAll).To(BeFalse()) - Expect(len(getResult.CatalogFilters.CategoryFilters)).To(BeZero()) - Expect(getResult.CatalogFilters.IDFilters.Include).To(BeNil()) - Expect(getResult.CatalogFilters.IDFilters.Exclude).To(BeNil()) - }) - - It("Fail to get a catalog that does not exist", func() { - shouldSkipTest() - - id := fakeName - getOptions := service.NewGetCatalogOptions(id) - _, getResponse, err := service.GetCatalog(getOptions) - - Expect(err).ToNot(BeNil()) - Expect(getResponse.StatusCode).To(Equal(404)) - }) - - It("Update a catalog", func() { - const ( - expectedLabelUpdated = "test2" - expectedShortDescUpdated = "integration-test-update" - ) - - shouldSkipTest() - - createOptions := service.NewCreateCatalogOptions() - createOptions.SetLabel(expectedLabel) - createOptions.SetShortDescription(expectedShortDesc) - createResult, _, err := service.CreateCatalog(createOptions) - - Expect(err).To(BeNil()) - - id := *createResult.ID - - replaceOptions := service.NewReplaceCatalogOptions(id) - replaceOptions.SetCatalogIdentifier(id) - replaceOptions.SetID(id) - replaceOptions.SetLabel(expectedLabelUpdated) - replaceOptions.SetShortDescription(expectedShortDescUpdated) - replaceResult, replaceResponse, err := service.ReplaceCatalog(replaceOptions) - - service.DeleteCatalog(service.NewDeleteCatalogOptions(id)) - - Expect(err).To(BeNil()) - Expect(replaceResponse.StatusCode).To(Equal(200)) - Expect(replaceResult).ToNot(BeNil()) - // fmt.Printf("replaceResult: %+v\n", replaceResult) - Expect(*replaceResult.Label).To(Equal(expectedLabelUpdated)) - Expect(*replaceResult.ShortDescription).To(Equal(expectedShortDescUpdated)) - // Expect(*replaceResult.URL).To(Equal(fmt.Sprintf(expectedURL, id))) - // Expect(*replaceResult.OfferingsURL).To(Equal(fmt.Sprintf(expectedOfferingsURL, id))) - // Expect(*replaceResult.OwningAccount).To(Equal(accountID)) - Expect(*replaceResult.CatalogFilters.IncludeAll).To(BeTrue()) - Expect(len(replaceResult.CatalogFilters.CategoryFilters)).To(BeZero()) - Expect(replaceResult.CatalogFilters.IDFilters.Include).To(BeNil()) - Expect(replaceResult.CatalogFilters.IDFilters.Exclude).To(BeNil()) - }) - - It("Fail to update a catalog that does not exist", func() { - shouldSkipTest() - - id := fakeName - replaceOptions := service.NewReplaceCatalogOptions(id) - replaceOptions.SetCatalogIdentifier(id) - replaceOptions.SetID(id) - _, replaceResponse, err := service.ReplaceCatalog(replaceOptions) - - Expect(err).ToNot(BeNil()) - Expect(replaceResponse.StatusCode).To(Equal(404)) - }) - - It("Delete a catalog", func() { - shouldSkipTest() - - createOptions := service.NewCreateCatalogOptions() - createOptions.SetLabel(expectedLabel) - createOptions.SetShortDescription(expectedShortDesc) - createResult, _, err := service.CreateCatalog(createOptions) - - Expect(err).To(BeNil()) - - id := *createResult.ID - - deleteResponse, deleteErr := service.DeleteCatalog(service.NewDeleteCatalogOptions(id)) - Expect(deleteErr).To(BeNil()) - Expect(deleteResponse.StatusCode).To(Equal(200)) - - getOptions := service.NewGetCatalogOptions(id) - _, getResponse, getErr := service.GetCatalog(getOptions) - - Expect(getErr).ToNot(BeNil()) - Expect(getResponse.StatusCode).To(Equal(403)) - }) - - It("Fail to delete a catalog that does not exist", func() { - shouldSkipTest() - - id := fakeName - deleteResponse, deleteErr := service.DeleteCatalog(service.NewDeleteCatalogOptions(id)) - - Expect(deleteErr).To(BeNil()) - Expect(deleteResponse.StatusCode).To(Equal(200)) - }) - - It("Create an offering", func() { - shouldSkipTest() - - catalogOptions := service.NewCreateCatalogOptions() - catalogOptions.SetLabel(expectedLabel) - catalogResult, _, err := service.CreateCatalog(catalogOptions) - - Expect(err).To(BeNil()) - - catalogID := *catalogResult.ID - - offeringOptions := service.NewCreateOfferingOptions(catalogID) - offeringOptions.SetName(expectedOfferingName) - offeringOptions.SetLabel(expectedLabel) - offeringResult, offeringResponse, err := service.CreateOffering(offeringOptions) - - service.DeleteCatalog(service.NewDeleteCatalogOptions(catalogID)) - - Expect(err).To(BeNil()) - - offeringID := *offeringResult.ID - - Expect(offeringResponse.StatusCode).To(Equal(201)) - Expect(*offeringResult.Name).To(Equal(expectedOfferingName)) - Expect(*offeringResult.URL).To(Equal(fmt.Sprintf(expectedOfferingURL, catalogID, offeringID))) - Expect(*offeringResult.Label).To(Equal(expectedLabel)) - }) - - It("Get an offering", func() { - shouldSkipTest() - - catalogOptions := service.NewCreateCatalogOptions() - catalogOptions.SetLabel(expectedLabel) - catalogResult, _, err := service.CreateCatalog(catalogOptions) - - Expect(err).To(BeNil()) - - catalogID := *catalogResult.ID - - offeringOptions := service.NewCreateOfferingOptions(catalogID) - offeringOptions.SetName(expectedOfferingName) - offeringOptions.SetLabel(expectedLabel) - offeringResult, _, err := service.CreateOffering(offeringOptions) - - Expect(err).To(BeNil()) - - offeringID := *offeringResult.ID - - getOptions := service.NewGetOfferingOptions(catalogID, offeringID) - getResult, getResponse, err := service.GetOffering(getOptions) - - service.DeleteCatalog(service.NewDeleteCatalogOptions(catalogID)) - - Expect(err).To(BeNil()) - Expect(getResponse.StatusCode).To(Equal(200)) - Expect(*getResult.Name).To(Equal(expectedOfferingName)) - Expect(*getResult.URL).To(Equal(fmt.Sprintf(expectedOfferingURL, catalogID, offeringID))) - Expect(*getResult.Label).To(Equal(expectedLabel)) - }) - - It("Fail to get an offering that does not exist", func() { - shouldSkipTest() - - catalogOptions := service.NewCreateCatalogOptions() - catalogOptions.SetLabel(expectedLabel) - catalogResult, _, err := service.CreateCatalog(catalogOptions) - - Expect(err).To(BeNil()) - - catalogID := *catalogResult.ID - offeringID := fakeName - - getOptions := service.NewGetOfferingOptions(catalogID, offeringID) - _, getResponse, err := service.GetOffering(getOptions) - - service.DeleteCatalog(service.NewDeleteCatalogOptions(catalogID)) - - Expect(err).ToNot(BeNil()) - Expect(getResponse.StatusCode).To(Equal(404)) - - _, getResponse, err = service.GetOffering(getOptions) - - Expect(err).ToNot(BeNil()) - Expect(getResponse.StatusCode).To(Equal(403)) - }) - - It("List offerings", func() { - const ( - expectedLimit int64 = 100 - expectedTotalCount int64 = 1 - expectedResourceCount int64 = 1 - expectedResouceLen = 1 - expectedFirst = "/api/v1-beta/catalogs/%s/offerings?limit=100&sort=label" - expectedLast = "/api/v1-beta/catalogs/%s/offerings?limit=100&sort=label" - ) - - shouldSkipTest() - - catalogOptions := service.NewCreateCatalogOptions() - catalogOptions.SetLabel(expectedLabel) - catalogResult, _, err := service.CreateCatalog(catalogOptions) - - Expect(err).To(BeNil()) - - catalogID := *catalogResult.ID - - offeringOptions := service.NewCreateOfferingOptions(catalogID) - offeringOptions.SetName(expectedOfferingName) - offeringOptions.SetLabel(expectedLabel) - offeringResult, _, err := service.CreateOffering(offeringOptions) - - Expect(err).To(BeNil()) - - offeringID := *offeringResult.ID - - listOptions := service.NewListOfferingsOptions(catalogID) - listResult, listResponse, err := service.ListOfferings(listOptions) - - service.DeleteCatalog(service.NewDeleteCatalogOptions(catalogID)) - - Expect(err).To(BeNil()) - Expect(listResponse.StatusCode).To(Equal(200)) - Expect(*listResult.Offset).To(BeZero()) - Expect(*listResult.Limit).To(Equal(expectedLimit)) - Expect(*listResult.TotalCount).To(Equal(expectedTotalCount)) - Expect(*listResult.ResourceCount).To(Equal(expectedResourceCount)) - Expect(*listResult.First).To(Equal(fmt.Sprintf(expectedFirst, catalogID))) - Expect(*listResult.Last).To(Equal(fmt.Sprintf(expectedLast, catalogID))) - Expect(len(listResult.Resources)).To(Equal(expectedResouceLen)) - - Expect(*listResult.Resources[0].ID).To(Equal(offeringID)) - Expect(*listResult.Resources[0].URL).To(Equal(fmt.Sprintf(expectedOfferingURL, catalogID, offeringID))) - Expect(*listResult.Resources[0].Label).To(Equal(expectedLabel)) - Expect(*listResult.Resources[0].Name).To(Equal(expectedOfferingName)) - Expect(*listResult.Resources[0].CatalogID).To(Equal(catalogID)) - Expect(*listResult.Resources[0].CatalogName).To(Equal(expectedLabel)) - - }) - - It("Delete an offering", func() { - shouldSkipTest() - - catalogOptions := service.NewCreateCatalogOptions() - catalogOptions.SetLabel(expectedLabel) - catalogResult, _, err := service.CreateCatalog(catalogOptions) - - Expect(err).To(BeNil()) - - catalogID := *catalogResult.ID - - offeringOptions := service.NewCreateOfferingOptions(catalogID) - offeringOptions.SetName(expectedOfferingName) - offeringOptions.SetLabel(expectedLabel) - offeringResult, _, err := service.CreateOffering(offeringOptions) - - Expect(err).To(BeNil()) - - offeringID := *offeringResult.ID - - deleteResponse, err := service.DeleteOffering(service.NewDeleteOfferingOptions(catalogID, offeringID)) - Expect(err).To(BeNil()) - Expect(deleteResponse.StatusCode).To(Equal(200)) - - _, getResponse, err := service.GetOffering(service.NewGetOfferingOptions(catalogID, offeringID)) - - Expect(err).ToNot(BeNil()) - Expect(getResponse.StatusCode).To(Equal(404)) - - service.DeleteCatalog(service.NewDeleteCatalogOptions(catalogID)) - }) - - It("Fail to delete an offering that does not exist", func() { - shouldSkipTest() - - catalogOptions := service.NewCreateCatalogOptions() - catalogOptions.SetLabel(expectedLabel) - catalogResult, _, err := service.CreateCatalog(catalogOptions) - - Expect(err).To(BeNil()) - - catalogID := *catalogResult.ID - offeringID := fakeName - - deleteResponse, err := service.DeleteOffering(service.NewDeleteOfferingOptions(catalogID, offeringID)) - Expect(err).To(BeNil()) - Expect(deleteResponse.StatusCode).To(Equal(200)) - - service.DeleteCatalog(service.NewDeleteCatalogOptions(catalogID)) - - deleteResponse, err = service.DeleteOffering(service.NewDeleteOfferingOptions(catalogID, offeringID)) - Expect(err).ToNot(BeNil()) - Expect(deleteResponse.StatusCode).To(Equal(403)) - }) - - It("Update an offering", func() { - const ( - expectedLabelUpdate = "test-update" - expectedShortDesc = "test-desc" - expectedShortDescUpdate = "test-desc-update" - ) - - shouldSkipTest() - - catalogOptions := service.NewCreateCatalogOptions() - catalogOptions.SetLabel(expectedLabel) - catalogResult, _, err := service.CreateCatalog(catalogOptions) - - Expect(err).To(BeNil()) - - catalogID := *catalogResult.ID - - offeringOptions := service.NewCreateOfferingOptions(catalogID) - offeringOptions.SetName(expectedOfferingName) - offeringOptions.SetLabel(expectedLabel) - offeringOptions.SetShortDescription(expectedShortDesc) - offeringResult, _, err := service.CreateOffering(offeringOptions) - - Expect(err).To(BeNil()) - - offeringID := *offeringResult.ID - rev := *offeringResult.Rev - - updateOptions := service.NewReplaceOfferingOptions(catalogID, offeringID) - updateOptions.SetID(offeringID) - updateOptions.SetLabel(expectedLabelUpdate) - updateOptions.SetShortDescription(expectedShortDescUpdate) - updateOptions.SetRev(rev) - updateResult, updateResponse, err := service.ReplaceOffering(updateOptions) - - service.DeleteCatalog(service.NewDeleteCatalogOptions(catalogID)) - - Expect(err).To(BeNil()) - Expect(updateResponse.StatusCode).To(Equal(200)) - Expect(*updateResult.ShortDescription).To(Equal(expectedShortDescUpdate)) - Expect(*updateResult.URL).To(Equal(fmt.Sprintf(expectedOfferingURL, catalogID, offeringID))) - Expect(*updateResult.Label).To(Equal(expectedLabelUpdate)) - }) - - It("Fail to update an offering that does not exist", func() { - shouldSkipTest() - - catalogOptions := service.NewCreateCatalogOptions() - catalogOptions.SetLabel(expectedLabel) - catalogResult, _, err := service.CreateCatalog(catalogOptions) - - Expect(err).To(BeNil()) - - catalogID := *catalogResult.ID - offeringID := fakeName - rev := fakeName - - updateOptions := service.NewReplaceOfferingOptions(catalogID, offeringID) - updateOptions.SetID(offeringID) - updateOptions.SetRev(rev) - _, updateResponse, err := service.ReplaceOffering(updateOptions) - - service.DeleteCatalog(service.NewDeleteCatalogOptions(catalogID)) - - Expect(err).ToNot(BeNil()) - Expect(updateResponse.StatusCode).To(Equal(404)) - - _, updateResponse, err = service.ReplaceOffering(updateOptions) - Expect(err).ToNot(BeNil()) - Expect(updateResponse.StatusCode).To(Equal(403)) - }) - - It("Get list of offerings for consumption", func() { - shouldSkipTest() - - options := service.NewGetConsumptionOfferingsOptions() - result, response, err := service.GetConsumptionOfferings(options) - - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(*result.Offset).To(BeZero()) - Expect(*result.Limit).ToNot(BeZero()) - Expect(*result.TotalCount).ToNot(BeZero()) - Expect(result.Last).ToNot(BeNil()) - Expect(result.Prev).To(BeNil()) - Expect(result.Next).ToNot(BeNil()) - Expect(len(result.Resources)).ToNot(BeZero()) - }) - - // It("Import an offering", func() { - // const ( - // expectedOfferingName = "jenkins-operator" - // expectedOfferingLabel = "Jenkins Operator" - // expectedOfferingTargetKind = "roks" - // expectedOfferingVersion = "0.4.0" - // expectedOfferingVersions = 1 - // expectedOfferingKinds = 1 - // expectedOfferingShortDesc = "Kubernetes native operator which fully manages Jenkins on Openshift." - // expectedOfferingURL = "https://cm.globalcatalog.test.cloud.ibm.com/api/v1-beta/catalogs/%s/offerings/%s" - // // expectedOfferingZipURL = "https://github.com/operator-framework/community-operators/blob/master/community-operators/jenkins-operator/0.4.0/jenkins-operator.v0.4.0.clusterserviceversion.yaml" - // expectedOfferingZipURL = "https://github.com/operator-framework/community-operators/blob/master/community-operators/jenkins-operator/0.4.0/manifests/jenkins-operator.v0.4.0.clusterserviceversion.yaml" - // ) - - // shouldSkipTest() - - // catalogOptions := service.NewCreateCatalogOptions() - // catalogOptions.SetLabel(expectedLabel) - // catalogResult, _, err := service.CreateCatalog(catalogOptions) - - // Expect(err).To(BeNil()) - - // catalogID := *catalogResult.ID - - // offeringOptions := service.NewImportOfferingOptions(catalogID) - // offeringOptions.SetZipurl(expectedOfferingZipURL) - // offeringOptions.SetXAuthToken(gitToken) - // offeringResult, offeringResponse, err := service.ImportOffering(offeringOptions) - - // service.DeleteCatalog(service.NewDeleteCatalogOptions(catalogID)) - - // Expect(err).To(BeNil()) - - // offeringID := *offeringResult.ID - - // Expect(offeringResponse.StatusCode).To(Equal(201)) - // Expect(*offeringResult.Name).To(Equal(expectedOfferingName)) - // Expect(*offeringResult.URL).To(Equal(fmt.Sprintf(expectedOfferingURL, catalogID, offeringID))) - // Expect(*offeringResult.Label).To(Equal(expectedOfferingLabel)) - // Expect(*offeringResult.ShortDescription).To(Equal(expectedOfferingShortDesc)) - // Expect(*offeringResult.CatalogName).To(Equal(expectedLabel)) - // Expect(*offeringResult.CatalogID).To(Equal(catalogID)) - // Expect(len(offeringResult.Kinds)).To(Equal(expectedOfferingKinds)) - // Expect(*offeringResult.Kinds[0].TargetKind).To(Equal(expectedOfferingTargetKind)) - // Expect(len(offeringResult.Kinds[0].Versions)).To(Equal(expectedOfferingVersions)) - // Expect(*offeringResult.Kinds[0].Versions[0].Version).To(Equal(expectedOfferingVersion)) - // Expect(*offeringResult.Kinds[0].Versions[0].TgzURL).To(Equal(expectedOfferingZipURL)) - // }) - - // It("Import new version to offering", func() { - // const ( - // expectedOfferingName = "jenkins-operator" - // expectedOfferingLabel = "Jenkins Operator" - // expectedOfferingTargetKind = "roks" - // expectedOfferingKinds = 1 - // expectedOfferingVersions = 2 - // expectedOfferingVersion1 = "0.3.31" - // expectedOfferingVersion2 = "0.4.0" - // expectedOfferingShortDesc = "Kubernetes native operator which fully manages Jenkins on Openshift." - // expectedOfferingURL = "https://cm.globalcatalog.test.cloud.ibm.com/api/v1-beta/catalogs/%s/offerings/%s" - // expectedOfferingZipURL = "https://github.com/operator-framework/community-operators/blob/master/community-operators/jenkins-operator/0.3.31/jenkins-operator.v0.3.31.clusterserviceversion.yaml" - // expectedOfferingZipURLUpdate = "https://github.com/operator-framework/community-operators/blob/master/community-operators/jenkins-operator/0.4.0/jenkins-operator.v0.4.0.clusterserviceversion.yaml" - // ) - - // shouldSkipTest() - - // catalogOptions := service.NewCreateCatalogOptions() - // catalogOptions.SetLabel(expectedLabel) - // catalogResult, _, err := service.CreateCatalog(catalogOptions) - - // Expect(err).To(BeNil()) - - // catalogID := *catalogResult.ID - - // offeringOptions := service.NewImportOfferingOptions(catalogID) - // offeringOptions.SetZipurl(expectedOfferingZipURL) - // offeringOptions.SetXAuthToken(gitToken) - // offeringResult, _, err := service.ImportOffering(offeringOptions) - - // Expect(err).To(BeNil()) - - // offeringID := *offeringResult.ID - - // importOptions := service.NewImportOfferingVersionOptions(catalogID, offeringID) - // importOptions.SetZipurl(expectedOfferingZipURLUpdate) - // importResult, importResponse, err := service.ImportOfferingVersion(importOptions) - - // service.DeleteCatalog(service.NewDeleteCatalogOptions(catalogID)) - - // Expect(err).To(BeNil()) - // Expect(importResponse.StatusCode).To(Equal(201)) - // Expect(*importResult.Name).To(Equal(expectedOfferingName)) - // Expect(*importResult.URL).To(Equal(fmt.Sprintf(expectedOfferingURL, catalogID, offeringID))) - // Expect(*importResult.Label).To(Equal(expectedOfferingLabel)) - // Expect(*importResult.ShortDescription).To(Equal(expectedOfferingShortDesc)) - // Expect(*importResult.CatalogName).To(Equal(expectedLabel)) - // Expect(*importResult.CatalogID).To(Equal(catalogID)) - // Expect(len(importResult.Kinds)).To(Equal(expectedOfferingKinds)) - // Expect(*importResult.Kinds[0].TargetKind).To(Equal(expectedOfferingTargetKind)) - // Expect(len(importResult.Kinds[0].Versions)).To(Equal(expectedOfferingVersions)) - // Expect(*importResult.Kinds[0].Versions[0].Version).To(Equal(expectedOfferingVersion1)) - // Expect(*importResult.Kinds[0].Versions[0].TgzURL).To(Equal(expectedOfferingZipURL)) - // Expect(*importResult.Kinds[0].Versions[1].Version).To(Equal(expectedOfferingVersion2)) - // Expect(*importResult.Kinds[0].Versions[1].TgzURL).To(Equal(expectedOfferingZipURLUpdate)) - // }) - - It("Fail to import new version to offering that does not exist", func() { - const expectedOfferingZipURLUpdate = "https://github.com/operator-framework/community-operators/blob/master/community-operators/jenkins-operator/0.4.0/jenkins-operator.v0.4.0.clusterserviceversion.yaml" - - shouldSkipTest() - - catalogOptions := service.NewCreateCatalogOptions() - catalogOptions.SetLabel(expectedLabel) - catalogResult, _, err := service.CreateCatalog(catalogOptions) - - Expect(err).To(BeNil()) - - catalogID := *catalogResult.ID - - offeringID := fakeName - - importOptions := service.NewImportOfferingVersionOptions(catalogID, offeringID) - importOptions.SetZipurl(expectedOfferingZipURLUpdate) - _, importResponse, err := service.ImportOfferingVersion(importOptions) - - service.DeleteCatalog(service.NewDeleteCatalogOptions(catalogID)) - - Expect(err).ToNot(BeNil()) - Expect(importResponse.StatusCode).To(Equal(404)) - - _, importResponse, err = service.ImportOfferingVersion(importOptions) - Expect(err).ToNot(BeNil()) - Expect(importResponse.StatusCode).To(Equal(403)) - }) - - // It("Reload an offering", func() { - // const ( - // expectedOfferingName = "jenkins-operator" - // expectedOfferingLabel = "Jenkins Operator" - // expectedOfferingTargetKind = "roks" - // expectedOfferingVersion = "0.4.0" - // expectedOfferingVersions = 1 - // expectedOfferingKinds = 1 - // expectedOfferingShortDesc = "Kubernetes native operator which fully manages Jenkins on Openshift." - // expectedOfferingURL = "https://cm.globalcatalog.test.cloud.ibm.com/api/v1-beta/catalogs/%s/offerings/%s" - // expectedOfferingZipURL = "https://github.com/operator-framework/community-operators/blob/master/community-operators/jenkins-operator/0.4.0/jenkins-operator.v0.4.0.clusterserviceversion.yaml" - // ) - - // shouldSkipTest() - - // catalogOptions := service.NewCreateCatalogOptions() - // catalogOptions.SetLabel(expectedLabel) - // catalogResult, _, err := service.CreateCatalog(catalogOptions) - - // Expect(err).To(BeNil()) - - // catalogID := *catalogResult.ID - - // offeringOptions := service.NewImportOfferingOptions(catalogID) - // offeringOptions.SetZipurl(expectedOfferingZipURL) - // offeringOptions.SetXAuthToken(gitToken) - // offeringResult, _, err := service.ImportOffering(offeringOptions) - - // Expect(err).To(BeNil()) - - // offeringID := *offeringResult.ID - - // reloadOptions := service.NewReloadOfferingOptions(catalogID, offeringID, expectedOfferingVersion) - // reloadOptions.SetZipurl(expectedOfferingZipURL) - // reloadResult, reloadResponse, err := service.ReloadOffering(reloadOptions) - - // service.DeleteCatalog(service.NewDeleteCatalogOptions(catalogID)) - - // Expect(err).To(BeNil()) - // Expect(reloadResponse.StatusCode).To(Equal(200)) - // Expect(*reloadResult.Name).To(Equal(expectedOfferingName)) - // Expect(*reloadResult.URL).To(Equal(fmt.Sprintf(expectedOfferingURL, catalogID, offeringID))) - // Expect(*reloadResult.Label).To(Equal(expectedOfferingLabel)) - // Expect(*reloadResult.ShortDescription).To(Equal(expectedOfferingShortDesc)) - // Expect(*reloadResult.CatalogName).To(Equal(expectedLabel)) - // Expect(*reloadResult.CatalogID).To(Equal(catalogID)) - // Expect(len(reloadResult.Kinds)).To(Equal(expectedOfferingKinds)) - // Expect(*reloadResult.Kinds[0].TargetKind).To(Equal(expectedOfferingTargetKind)) - // Expect(len(reloadResult.Kinds[0].Versions)).To(Equal(expectedOfferingVersions)) - // Expect(*reloadResult.Kinds[0].Versions[0].Version).To(Equal(expectedOfferingVersion)) - // Expect(*reloadResult.Kinds[0].Versions[0].TgzURL).To(Equal(expectedOfferingZipURL)) - // }) - - It("Fail to reload an offering that does not exist", func() { - const ( - expectedOfferingVersion = "0.4.0" - expectedOfferingZipURL = "https://github.com/operator-framework/community-operators/blob/master/community-operators/jenkins-operator/0.4.0/jenkins-operator.v0.4.0.clusterserviceversion.yaml" - ) - - shouldSkipTest() - - catalogOptions := service.NewCreateCatalogOptions() - catalogOptions.SetLabel(expectedLabel) - catalogResult, _, err := service.CreateCatalog(catalogOptions) - - Expect(err).To(BeNil()) - - catalogID := *catalogResult.ID - offeringID := fakeName - - reloadOptions := service.NewReloadOfferingOptions(catalogID, offeringID, expectedOfferingVersion) - reloadOptions.SetZipurl(expectedOfferingZipURL) - _, reloadResponse, err := service.ReloadOffering(reloadOptions) - - service.DeleteCatalog(service.NewDeleteCatalogOptions(catalogID)) - - Expect(err).ToNot(BeNil()) - Expect(reloadResponse.StatusCode).To(Equal(404)) - - _, reloadResponse, err = service.ReloadOffering(reloadOptions) - Expect(err).ToNot(BeNil()) - Expect(reloadResponse.StatusCode).To(Equal(403)) - }) - - // It("Get a version", func() { - // const ( - // expectedOfferingName = "jenkins-operator" - // expectedOfferingLabel = "Jenkins Operator" - // expectedOfferingTargetKind = "roks" - // expectedOfferingVersion = "0.4.0" - // expectedOfferingVersions = 1 - // expectedOfferingKinds = 1 - // expectedOfferingShortDesc = "Kubernetes native operator which fully manages Jenkins on Openshift." - // expectedOfferingURL = "https://cm.globalcatalog.test.cloud.ibm.com/api/v1-beta/catalogs/%s/offerings/%s" - // expectedOfferingZipURL = "https://github.com/operator-framework/community-operators/blob/master/community-operators/jenkins-operator/0.4.0/jenkins-operator.v0.4.0.clusterserviceversion.yaml" - // ) - - // shouldSkipTest() - - // catalogOptions := service.NewCreateCatalogOptions() - // catalogOptions.SetLabel(expectedLabel) - // catalogResult, _, err := service.CreateCatalog(catalogOptions) - - // Expect(err).To(BeNil()) - - // catalogID := *catalogResult.ID - - // offeringOptions := service.NewImportOfferingOptions(catalogID) - // offeringOptions.SetZipurl(expectedOfferingZipURL) - // offeringOptions.SetXAuthToken(gitToken) - // offeringResult, _, err := service.ImportOffering(offeringOptions) - - // Expect(err).To(BeNil()) - - // offeringID := *offeringResult.ID - // versionLocator := *offeringResult.Kinds[0].Versions[0].VersionLocator - - // versionOptions := service.NewGetVersionOptions(versionLocator) - // versionResult, versionResponse, err := service.GetVersion(versionOptions) - - // service.DeleteCatalog(service.NewDeleteCatalogOptions(catalogID)) - - // Expect(err).To(BeNil()) - // Expect(versionResponse.StatusCode).To(Equal(200)) - // Expect(*versionResult.Name).To(Equal(expectedOfferingName)) - // Expect(*versionResult.URL).To(Equal(fmt.Sprintf(expectedOfferingURL, catalogID, offeringID))) - // Expect(*versionResult.Label).To(Equal(expectedOfferingLabel)) - // Expect(*versionResult.ShortDescription).To(Equal(expectedOfferingShortDesc)) - // Expect(*versionResult.CatalogName).To(Equal(expectedLabel)) - // Expect(*versionResult.CatalogID).To(Equal(catalogID)) - // Expect(len(versionResult.Kinds)).To(Equal(expectedOfferingKinds)) - // Expect(*versionResult.Kinds[0].TargetKind).To(Equal(expectedOfferingTargetKind)) - // Expect(len(versionResult.Kinds[0].Versions)).To(Equal(expectedOfferingVersions)) - // Expect(*versionResult.Kinds[0].Versions[0].Version).To(Equal(expectedOfferingVersion)) - // Expect(*versionResult.Kinds[0].Versions[0].TgzURL).To(Equal(expectedOfferingZipURL)) - // }) - - It("Fail to get a version that does not exist", func() { - shouldSkipTest() - - versionOptions := service.NewGetVersionOptions(fakeVersionLocator) - _, versionResponse, err := service.GetVersion(versionOptions) - - Expect(err).ToNot(BeNil()) - Expect(versionResponse.StatusCode).To(Equal(404)) - }) - - // It("Delete a version", func() { - // const expectedOfferingZipURL = "https://github.com/operator-framework/community-operators/blob/master/community-operators/jenkins-operator/0.4.0/jenkins-operator.v0.4.0.clusterserviceversion.yaml" - - // shouldSkipTest() - - // catalogOptions := service.NewCreateCatalogOptions() - // catalogOptions.SetLabel(expectedLabel) - // catalogResult, _, err := service.CreateCatalog(catalogOptions) - - // Expect(err).To(BeNil()) - - // catalogID := *catalogResult.ID - - // offeringOptions := service.NewImportOfferingOptions(catalogID) - // offeringOptions.SetZipurl(expectedOfferingZipURL) - // offeringOptions.SetXAuthToken(gitToken) - // offeringResult, _, err := service.ImportOffering(offeringOptions) - - // Expect(err).To(BeNil()) - - // versionLocator := *offeringResult.Kinds[0].Versions[0].VersionLocator - - // deleteOptions := service.NewDeleteVersionOptions(versionLocator) - // deleteResponse, err := service.DeleteVersion(deleteOptions) - - // service.DeleteCatalog(service.NewDeleteCatalogOptions(catalogID)) - - // Expect(err).To(BeNil()) - // Expect(deleteResponse.StatusCode).To(Equal(200)) - // }) - - It("Failed to delete a version that does not exist", func() { - shouldSkipTest() - - deleteOptions := service.NewDeleteVersionOptions(fakeVersionLocator) - deleteResponse, err := service.DeleteVersion(deleteOptions) - - Expect(err).ToNot(BeNil()) - Expect(deleteResponse.StatusCode).To(Equal(404)) - }) - - // It("Get version about", func() { - // const expectedOfferingZipURL = "https://github.com/operator-framework/community-operators/blob/master/community-operators/jenkins-operator/0.4.0/jenkins-operator.v0.4.0.clusterserviceversion.yaml" - - // shouldSkipTest() - - // catalogOptions := service.NewCreateCatalogOptions() - // catalogOptions.SetLabel(expectedLabel) - // catalogResult, _, err := service.CreateCatalog(catalogOptions) - - // Expect(err).To(BeNil()) - - // catalogID := *catalogResult.ID - - // offeringOptions := service.NewImportOfferingOptions(catalogID) - // offeringOptions.SetZipurl(expectedOfferingZipURL) - // offeringOptions.SetXAuthToken(gitToken) - // offeringResult, _, err := service.ImportOffering(offeringOptions) - - // Expect(err).To(BeNil()) - - // versionLocator := *offeringResult.Kinds[0].Versions[0].VersionLocator - - // getOptions := service.NewGetOfferingAboutOptions(versionLocator) - // getResult, getResponse, err := service.GetOfferingAbout(getOptions) - - // service.DeleteCatalog(service.NewDeleteCatalogOptions(catalogID)) - - // Expect(err).To(BeNil()) - // Expect(getResponse.StatusCode).To(Equal(200)) - // Expect(len(*getResult)).ToNot(BeZero()) - // }) - - It("Fail to get version about for a version that does not exist", func() { - shouldSkipTest() - - getOptions := service.NewGetOfferingAboutOptions(fakeVersionLocator) - _, getResponse, err := service.GetOfferingAbout(getOptions) - - Expect(err).ToNot(BeNil()) - Expect(getResponse.StatusCode).To(Equal(404)) - }) - - // It("Get version updates", func() { - // const ( - // expectedOfferingUpdates = 1 - // expectedOfferingVersion2 = "0.4.0" - // expectedOfferingZipURL = "https://github.com/operator-framework/community-operators/blob/master/community-operators/jenkins-operator/0.3.31/jenkins-operator.v0.3.31.clusterserviceversion.yaml" - // expectedOfferingZipURLUpdate = "https://github.com/operator-framework/community-operators/blob/master/community-operators/jenkins-operator/0.4.0/jenkins-operator.v0.4.0.clusterserviceversion.yaml" - // ) - - // shouldSkipTest() - - // catalogOptions := service.NewCreateCatalogOptions() - // catalogOptions.SetLabel(expectedLabel) - // catalogResult, _, err := service.CreateCatalog(catalogOptions) - - // Expect(err).To(BeNil()) - - // catalogID := *catalogResult.ID - - // offeringOptions := service.NewImportOfferingOptions(catalogID) - // offeringOptions.SetZipurl(expectedOfferingZipURL) - // offeringOptions.SetXAuthToken(gitToken) - // offeringResult, _, err := service.ImportOffering(offeringOptions) - - // Expect(err).To(BeNil()) - - // offeringID := *offeringResult.ID - // versionLocator1 := *offeringResult.Kinds[0].Versions[0].VersionLocator - - // importOptions := service.NewImportOfferingVersionOptions(catalogID, offeringID) - // importOptions.SetZipurl(expectedOfferingZipURLUpdate) - // importResult, _, err := service.ImportOfferingVersion(importOptions) - - // Expect(err).To(BeNil()) - - // versionLocator2 := *importResult.Kinds[0].Versions[1].VersionLocator - - // getOptions := service.NewGetOfferingUpdatesOptions(versionLocator1) - // getResult, getResponse, err := service.GetOfferingUpdates(getOptions) - - // service.DeleteCatalog(service.NewDeleteCatalogOptions(catalogID)) - - // Expect(err).To(BeNil()) - // Expect(getResponse.StatusCode).To(Equal(200)) - // Expect(len(getResult)).To(Equal(expectedOfferingUpdates)) - // Expect(*getResult[0].VersionLocator).To(Equal(versionLocator2)) - // Expect(*getResult[0].Version).To(Equal(expectedOfferingVersion2)) - // Expect(*getResult[0].PackageVersion).To(Equal(expectedOfferingVersion2)) - // Expect(*getResult[0].CanUpdate).To(BeTrue()) - // }) - - It("Fail to get version updates for version that does not exist", func() { - shouldSkipTest() - - getOptions := service.NewGetOfferingUpdatesOptions(fakeVersionLocator, "bogus", "bogus") - _, getResponse, err := service.GetOfferingUpdates(getOptions) - - Expect(err).ToNot(BeNil()) - Expect(getResponse.StatusCode).To(Equal(404)) - }) - - }) -}) diff --git a/catalogmanagementv1/catalog_management_v1_suite_test.go b/catalogmanagementv1/catalog_management_v1_suite_test.go index a3ad4c81..a2a32ba7 100644 --- a/catalogmanagementv1/catalog_management_v1_suite_test.go +++ b/catalogmanagementv1/catalog_management_v1_suite_test.go @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2021. + * (C) Copyright IBM Corp. 2022. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/catalogmanagementv1/catalog_management_v1_test.go b/catalogmanagementv1/catalog_management_v1_test.go index 3dd637a1..dd502ff4 100644 --- a/catalogmanagementv1/catalog_management_v1_test.go +++ b/catalogmanagementv1/catalog_management_v1_test.go @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2021. + * (C) Copyright IBM Corp. 2022. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,7 +31,6 @@ import ( "github.com/go-openapi/strfmt" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - . "github.com/onsi/gomega/gstruct" ) var _ = Describe(`CatalogManagementV1`, func() { @@ -176,7 +175,7 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(req.Method).To(Equal("GET")) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, `} this is not valid json {`) + fmt.Fprint(res, `} this is not valid json {`) })) }) It(`Invoke GetCatalogAccount with error: Operation response processing error`, func() { @@ -225,7 +224,7 @@ var _ = Describe(`CatalogManagementV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"id": "ID", "hide_IBM_cloud_catalog": false, "account_filters": {"include_all": true, "category_filters": {"mapKey": {"include": false, "filter": {"filter_terms": ["FilterTerms"]}}}, "id_filters": {"include": {"filter_terms": ["FilterTerms"]}, "exclude": {"filter_terms": ["FilterTerms"]}}}}`) + fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "hide_IBM_cloud_catalog": false, "account_filters": {"include_all": true, "category_filters": {"mapKey": {"include": false, "filter": {"filter_terms": ["FilterTerms"]}}}, "id_filters": {"include": {"filter_terms": ["FilterTerms"]}, "exclude": {"filter_terms": ["FilterTerms"]}}}}`) })) }) It(`Invoke GetCatalogAccount successfully with retries`, func() { @@ -278,7 +277,7 @@ var _ = Describe(`CatalogManagementV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"id": "ID", "hide_IBM_cloud_catalog": false, "account_filters": {"include_all": true, "category_filters": {"mapKey": {"include": false, "filter": {"filter_terms": ["FilterTerms"]}}}, "id_filters": {"include": {"filter_terms": ["FilterTerms"]}, "exclude": {"filter_terms": ["FilterTerms"]}}}}`) + fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "hide_IBM_cloud_catalog": false, "account_filters": {"include_all": true, "category_filters": {"mapKey": {"include": false, "filter": {"filter_terms": ["FilterTerms"]}}}, "id_filters": {"include": {"filter_terms": ["FilterTerms"]}, "exclude": {"filter_terms": ["FilterTerms"]}}}}`) })) }) It(`Invoke GetCatalogAccount successfully`, func() { @@ -364,8 +363,174 @@ var _ = Describe(`CatalogManagementV1`, func() { }) }) }) + Describe(`UpdateCatalogAccount(updateCatalogAccountOptions *UpdateCatalogAccountOptions) - Operation response error`, func() { + updateCatalogAccountPath := "/catalogaccount" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(updateCatalogAccountPath)) + Expect(req.Method).To(Equal("PUT")) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke UpdateCatalogAccount with error: Operation response processing error`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Construct an instance of the FilterTerms model + filterTermsModel := new(catalogmanagementv1.FilterTerms) + filterTermsModel.FilterTerms = []string{"testString"} + + // Construct an instance of the CategoryFilter model + categoryFilterModel := new(catalogmanagementv1.CategoryFilter) + categoryFilterModel.Include = core.BoolPtr(true) + categoryFilterModel.Filter = filterTermsModel + + // Construct an instance of the IDFilter model + idFilterModel := new(catalogmanagementv1.IDFilter) + idFilterModel.Include = filterTermsModel + idFilterModel.Exclude = filterTermsModel + + // Construct an instance of the Filters model + filtersModel := new(catalogmanagementv1.Filters) + filtersModel.IncludeAll = core.BoolPtr(true) + filtersModel.CategoryFilters = make(map[string]catalogmanagementv1.CategoryFilter) + filtersModel.IDFilters = idFilterModel + filtersModel.CategoryFilters["foo"] = *categoryFilterModel + + // Construct an instance of the UpdateCatalogAccountOptions model + updateCatalogAccountOptionsModel := new(catalogmanagementv1.UpdateCatalogAccountOptions) + updateCatalogAccountOptionsModel.ID = core.StringPtr("testString") + updateCatalogAccountOptionsModel.Rev = core.StringPtr("testString") + updateCatalogAccountOptionsModel.HideIBMCloudCatalog = core.BoolPtr(true) + updateCatalogAccountOptionsModel.AccountFilters = filtersModel + updateCatalogAccountOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := catalogManagementService.UpdateCatalogAccount(updateCatalogAccountOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + catalogManagementService.EnableRetries(0, 0) + result, response, operationErr = catalogManagementService.UpdateCatalogAccount(updateCatalogAccountOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) Describe(`UpdateCatalogAccount(updateCatalogAccountOptions *UpdateCatalogAccountOptions)`, func() { updateCatalogAccountPath := "/catalogaccount" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(updateCatalogAccountPath)) + Expect(req.Method).To(Equal("PUT")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "hide_IBM_cloud_catalog": false, "account_filters": {"include_all": true, "category_filters": {"mapKey": {"include": false, "filter": {"filter_terms": ["FilterTerms"]}}}, "id_filters": {"include": {"filter_terms": ["FilterTerms"]}, "exclude": {"filter_terms": ["FilterTerms"]}}}}`) + })) + }) + It(`Invoke UpdateCatalogAccount successfully with retries`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + catalogManagementService.EnableRetries(0, 0) + + // Construct an instance of the FilterTerms model + filterTermsModel := new(catalogmanagementv1.FilterTerms) + filterTermsModel.FilterTerms = []string{"testString"} + + // Construct an instance of the CategoryFilter model + categoryFilterModel := new(catalogmanagementv1.CategoryFilter) + categoryFilterModel.Include = core.BoolPtr(true) + categoryFilterModel.Filter = filterTermsModel + + // Construct an instance of the IDFilter model + idFilterModel := new(catalogmanagementv1.IDFilter) + idFilterModel.Include = filterTermsModel + idFilterModel.Exclude = filterTermsModel + + // Construct an instance of the Filters model + filtersModel := new(catalogmanagementv1.Filters) + filtersModel.IncludeAll = core.BoolPtr(true) + filtersModel.CategoryFilters = make(map[string]catalogmanagementv1.CategoryFilter) + filtersModel.IDFilters = idFilterModel + filtersModel.CategoryFilters["foo"] = *categoryFilterModel + + // Construct an instance of the UpdateCatalogAccountOptions model + updateCatalogAccountOptionsModel := new(catalogmanagementv1.UpdateCatalogAccountOptions) + updateCatalogAccountOptionsModel.ID = core.StringPtr("testString") + updateCatalogAccountOptionsModel.Rev = core.StringPtr("testString") + updateCatalogAccountOptionsModel.HideIBMCloudCatalog = core.BoolPtr(true) + updateCatalogAccountOptionsModel.AccountFilters = filtersModel + updateCatalogAccountOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := catalogManagementService.UpdateCatalogAccountWithContext(ctx, updateCatalogAccountOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + catalogManagementService.DisableRetries() + result, response, operationErr := catalogManagementService.UpdateCatalogAccount(updateCatalogAccountOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = catalogManagementService.UpdateCatalogAccountWithContext(ctx, updateCatalogAccountOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) Context(`Using mock server endpoint`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { @@ -391,7 +556,10 @@ var _ = Describe(`CatalogManagementV1`, func() { } fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + // Set mock response + res.Header().Set("Content-type", "application/json") res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "hide_IBM_cloud_catalog": false, "account_filters": {"include_all": true, "category_filters": {"mapKey": {"include": false, "filter": {"filter_terms": ["FilterTerms"]}}}, "id_filters": {"include": {"filter_terms": ["FilterTerms"]}, "exclude": {"filter_terms": ["FilterTerms"]}}}}`) })) }) It(`Invoke UpdateCatalogAccount successfully`, func() { @@ -403,9 +571,10 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - response, operationErr := catalogManagementService.UpdateCatalogAccount(nil) + result, response, operationErr := catalogManagementService.UpdateCatalogAccount(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) + Expect(result).To(BeNil()) // Construct an instance of the FilterTerms model filterTermsModel := new(catalogmanagementv1.FilterTerms) @@ -431,14 +600,17 @@ var _ = Describe(`CatalogManagementV1`, func() { // Construct an instance of the UpdateCatalogAccountOptions model updateCatalogAccountOptionsModel := new(catalogmanagementv1.UpdateCatalogAccountOptions) updateCatalogAccountOptionsModel.ID = core.StringPtr("testString") + updateCatalogAccountOptionsModel.Rev = core.StringPtr("testString") updateCatalogAccountOptionsModel.HideIBMCloudCatalog = core.BoolPtr(true) updateCatalogAccountOptionsModel.AccountFilters = filtersModel updateCatalogAccountOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - response, operationErr = catalogManagementService.UpdateCatalogAccount(updateCatalogAccountOptionsModel) + result, response, operationErr = catalogManagementService.UpdateCatalogAccount(updateCatalogAccountOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + }) It(`Invoke UpdateCatalogAccount with error: Operation request error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ @@ -472,38 +644,101 @@ var _ = Describe(`CatalogManagementV1`, func() { // Construct an instance of the UpdateCatalogAccountOptions model updateCatalogAccountOptionsModel := new(catalogmanagementv1.UpdateCatalogAccountOptions) updateCatalogAccountOptionsModel.ID = core.StringPtr("testString") + updateCatalogAccountOptionsModel.Rev = core.StringPtr("testString") updateCatalogAccountOptionsModel.HideIBMCloudCatalog = core.BoolPtr(true) updateCatalogAccountOptionsModel.AccountFilters = filtersModel updateCatalogAccountOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := catalogManagementService.SetServiceURL("") Expect(err).To(BeNil()) - response, operationErr := catalogManagementService.UpdateCatalogAccount(updateCatalogAccountOptionsModel) + result, response, operationErr := catalogManagementService.UpdateCatalogAccount(updateCatalogAccountOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke UpdateCatalogAccount successfully`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Construct an instance of the FilterTerms model + filterTermsModel := new(catalogmanagementv1.FilterTerms) + filterTermsModel.FilterTerms = []string{"testString"} + + // Construct an instance of the CategoryFilter model + categoryFilterModel := new(catalogmanagementv1.CategoryFilter) + categoryFilterModel.Include = core.BoolPtr(true) + categoryFilterModel.Filter = filterTermsModel + + // Construct an instance of the IDFilter model + idFilterModel := new(catalogmanagementv1.IDFilter) + idFilterModel.Include = filterTermsModel + idFilterModel.Exclude = filterTermsModel + + // Construct an instance of the Filters model + filtersModel := new(catalogmanagementv1.Filters) + filtersModel.IncludeAll = core.BoolPtr(true) + filtersModel.CategoryFilters = make(map[string]catalogmanagementv1.CategoryFilter) + filtersModel.IDFilters = idFilterModel + filtersModel.CategoryFilters["foo"] = *categoryFilterModel + + // Construct an instance of the UpdateCatalogAccountOptions model + updateCatalogAccountOptionsModel := new(catalogmanagementv1.UpdateCatalogAccountOptions) + updateCatalogAccountOptionsModel.ID = core.StringPtr("testString") + updateCatalogAccountOptionsModel.Rev = core.StringPtr("testString") + updateCatalogAccountOptionsModel.HideIBMCloudCatalog = core.BoolPtr(true) + updateCatalogAccountOptionsModel.AccountFilters = filtersModel + updateCatalogAccountOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := catalogManagementService.UpdateCatalogAccount(updateCatalogAccountOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) }) - Describe(`GetCatalogAccountAudit(getCatalogAccountAuditOptions *GetCatalogAccountAuditOptions) - Operation response error`, func() { - getCatalogAccountAuditPath := "/catalogaccount/audit" + Describe(`ListCatalogAccountAudits(listCatalogAccountAuditsOptions *ListCatalogAccountAuditsOptions) - Operation response error`, func() { + listCatalogAccountAuditsPath := "/catalogaccount/audits" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getCatalogAccountAuditPath)) + Expect(req.URL.EscapedPath()).To(Equal(listCatalogAccountAuditsPath)) Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + // TODO: Add check for lookupnames query parameter res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, `} this is not valid json {`) + fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetCatalogAccountAudit with error: Operation response processing error`, func() { + It(`Invoke ListCatalogAccountAudits with error: Operation response processing error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -511,18 +746,21 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the GetCatalogAccountAuditOptions model - getCatalogAccountAuditOptionsModel := new(catalogmanagementv1.GetCatalogAccountAuditOptions) - getCatalogAccountAuditOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListCatalogAccountAuditsOptions model + listCatalogAccountAuditsOptionsModel := new(catalogmanagementv1.ListCatalogAccountAuditsOptions) + listCatalogAccountAuditsOptionsModel.Start = core.StringPtr("testString") + listCatalogAccountAuditsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listCatalogAccountAuditsOptionsModel.Lookupnames = core.BoolPtr(true) + listCatalogAccountAuditsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := catalogManagementService.GetCatalogAccountAudit(getCatalogAccountAuditOptionsModel) + result, response, operationErr := catalogManagementService.ListCatalogAccountAudits(listCatalogAccountAuditsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again catalogManagementService.EnableRetries(0, 0) - result, response, operationErr = catalogManagementService.GetCatalogAccountAudit(getCatalogAccountAuditOptionsModel) + result, response, operationErr = catalogManagementService.ListCatalogAccountAudits(listCatalogAccountAuditsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -532,27 +770,30 @@ var _ = Describe(`CatalogManagementV1`, func() { }) }) }) - Describe(`GetCatalogAccountAudit(getCatalogAccountAuditOptions *GetCatalogAccountAuditOptions)`, func() { - getCatalogAccountAuditPath := "/catalogaccount/audit" + Describe(`ListCatalogAccountAudits(listCatalogAccountAuditsOptions *ListCatalogAccountAuditsOptions)`, func() { + listCatalogAccountAuditsPath := "/catalogaccount/audits" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getCatalogAccountAuditPath)) + Expect(req.URL.EscapedPath()).To(Equal(listCatalogAccountAuditsPath)) Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + // TODO: Add check for lookupnames query parameter // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"list": [{"id": "ID", "created": "2019-01-01T12:00:00.000Z", "change_type": "ChangeType", "target_type": "TargetType", "target_id": "TargetID", "who_delegate_email": "WhoDelegateEmail", "message": "Message"}]}`) + fmt.Fprintf(res, "%s", `{"start": "Start", "limit": 5, "total_count": 10, "resource_count": 13, "first": {"href": "Href", "start": "Start"}, "next": {"href": "Href", "start": "Start"}, "prev": {"href": "Href", "start": "Start"}, "last": {"href": "Href", "start": "Start"}, "audits": [{"id": "ID", "_rev": "Rev", "created": "2019-01-01T12:00:00.000Z", "change_type": "ChangeType", "target_type": "TargetType", "target_id": "TargetID", "who_email": "WhoEmail", "who_delegate_email": "WhoDelegateEmail", "message": "Message"}]}`) })) }) - It(`Invoke GetCatalogAccountAudit successfully with retries`, func() { + It(`Invoke ListCatalogAccountAudits successfully with retries`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -561,20 +802,23 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) catalogManagementService.EnableRetries(0, 0) - // Construct an instance of the GetCatalogAccountAuditOptions model - getCatalogAccountAuditOptionsModel := new(catalogmanagementv1.GetCatalogAccountAuditOptions) - getCatalogAccountAuditOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListCatalogAccountAuditsOptions model + listCatalogAccountAuditsOptionsModel := new(catalogmanagementv1.ListCatalogAccountAuditsOptions) + listCatalogAccountAuditsOptionsModel.Start = core.StringPtr("testString") + listCatalogAccountAuditsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listCatalogAccountAuditsOptionsModel.Lookupnames = core.BoolPtr(true) + listCatalogAccountAuditsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := catalogManagementService.GetCatalogAccountAuditWithContext(ctx, getCatalogAccountAuditOptionsModel) + _, _, operationErr := catalogManagementService.ListCatalogAccountAuditsWithContext(ctx, listCatalogAccountAuditsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again catalogManagementService.DisableRetries() - result, response, operationErr := catalogManagementService.GetCatalogAccountAudit(getCatalogAccountAuditOptionsModel) + result, response, operationErr := catalogManagementService.ListCatalogAccountAudits(listCatalogAccountAuditsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -582,7 +826,7 @@ var _ = Describe(`CatalogManagementV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = catalogManagementService.GetCatalogAccountAuditWithContext(ctx, getCatalogAccountAuditOptionsModel) + _, _, operationErr = catalogManagementService.ListCatalogAccountAuditsWithContext(ctx, listCatalogAccountAuditsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -596,16 +840,19 @@ var _ = Describe(`CatalogManagementV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getCatalogAccountAuditPath)) + Expect(req.URL.EscapedPath()).To(Equal(listCatalogAccountAuditsPath)) Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + // TODO: Add check for lookupnames query parameter // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"list": [{"id": "ID", "created": "2019-01-01T12:00:00.000Z", "change_type": "ChangeType", "target_type": "TargetType", "target_id": "TargetID", "who_delegate_email": "WhoDelegateEmail", "message": "Message"}]}`) + fmt.Fprintf(res, "%s", `{"start": "Start", "limit": 5, "total_count": 10, "resource_count": 13, "first": {"href": "Href", "start": "Start"}, "next": {"href": "Href", "start": "Start"}, "prev": {"href": "Href", "start": "Start"}, "last": {"href": "Href", "start": "Start"}, "audits": [{"id": "ID", "_rev": "Rev", "created": "2019-01-01T12:00:00.000Z", "change_type": "ChangeType", "target_type": "TargetType", "target_id": "TargetID", "who_email": "WhoEmail", "who_delegate_email": "WhoDelegateEmail", "message": "Message"}]}`) })) }) - It(`Invoke GetCatalogAccountAudit successfully`, func() { + It(`Invoke ListCatalogAccountAudits successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -614,23 +861,26 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := catalogManagementService.GetCatalogAccountAudit(nil) + result, response, operationErr := catalogManagementService.ListCatalogAccountAudits(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetCatalogAccountAuditOptions model - getCatalogAccountAuditOptionsModel := new(catalogmanagementv1.GetCatalogAccountAuditOptions) - getCatalogAccountAuditOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListCatalogAccountAuditsOptions model + listCatalogAccountAuditsOptionsModel := new(catalogmanagementv1.ListCatalogAccountAuditsOptions) + listCatalogAccountAuditsOptionsModel.Start = core.StringPtr("testString") + listCatalogAccountAuditsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listCatalogAccountAuditsOptionsModel.Lookupnames = core.BoolPtr(true) + listCatalogAccountAuditsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = catalogManagementService.GetCatalogAccountAudit(getCatalogAccountAuditOptionsModel) + result, response, operationErr = catalogManagementService.ListCatalogAccountAudits(listCatalogAccountAuditsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetCatalogAccountAudit with error: Operation request error`, func() { + It(`Invoke ListCatalogAccountAudits with error: Operation request error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -638,13 +888,16 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the GetCatalogAccountAuditOptions model - getCatalogAccountAuditOptionsModel := new(catalogmanagementv1.GetCatalogAccountAuditOptions) - getCatalogAccountAuditOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListCatalogAccountAuditsOptions model + listCatalogAccountAuditsOptionsModel := new(catalogmanagementv1.ListCatalogAccountAuditsOptions) + listCatalogAccountAuditsOptionsModel.Start = core.StringPtr("testString") + listCatalogAccountAuditsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listCatalogAccountAuditsOptionsModel.Lookupnames = core.BoolPtr(true) + listCatalogAccountAuditsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := catalogManagementService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := catalogManagementService.GetCatalogAccountAudit(getCatalogAccountAuditOptionsModel) + result, response, operationErr := catalogManagementService.ListCatalogAccountAudits(listCatalogAccountAuditsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) @@ -663,7 +916,7 @@ var _ = Describe(`CatalogManagementV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetCatalogAccountAudit successfully`, func() { + It(`Invoke ListCatalogAccountAudits successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -671,12 +924,15 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the GetCatalogAccountAuditOptions model - getCatalogAccountAuditOptionsModel := new(catalogmanagementv1.GetCatalogAccountAuditOptions) - getCatalogAccountAuditOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListCatalogAccountAuditsOptions model + listCatalogAccountAuditsOptionsModel := new(catalogmanagementv1.ListCatalogAccountAuditsOptions) + listCatalogAccountAuditsOptionsModel.Start = core.StringPtr("testString") + listCatalogAccountAuditsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listCatalogAccountAuditsOptionsModel.Lookupnames = core.BoolPtr(true) + listCatalogAccountAuditsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := catalogManagementService.GetCatalogAccountAudit(getCatalogAccountAuditOptionsModel) + result, response, operationErr := catalogManagementService.ListCatalogAccountAudits(listCatalogAccountAuditsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -687,13 +943,324 @@ var _ = Describe(`CatalogManagementV1`, func() { testServer.Close() }) }) - }) - Describe(`GetCatalogAccountFilters(getCatalogAccountFiltersOptions *GetCatalogAccountFiltersOptions) - Operation response error`, func() { - getCatalogAccountFiltersPath := "/catalogaccount/filters" - Context(`Using mock server endpoint with invalid JSON response`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() + Context(`Test pagination helper method on response`, func() { + It(`Invoke GetNextStart successfully`, func() { + responseObject := new(catalogmanagementv1.AuditLogs) + nextObject := new(catalogmanagementv1.PaginationTokenLink) + nextObject.Start = core.StringPtr("abc-123") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(Equal(core.StringPtr("abc-123"))) + }) + It(`Invoke GetNextStart without a "Next" property in the response`, func() { + responseObject := new(catalogmanagementv1.AuditLogs) + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + Context(`Using mock server endpoint - paginated response`, func() { + BeforeEach(func() { + var requestNumber int = 0 + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listCatalogAccountAuditsPath)) + Expect(req.Method).To(Equal("GET")) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + requestNumber++ + if requestNumber == 1 { + fmt.Fprintf(res, "%s", `{"next":{"start":"1"},"total_count":2,"limit":1,"audits":[{"id":"ID","_rev":"Rev","created":"2019-01-01T12:00:00.000Z","change_type":"ChangeType","target_type":"TargetType","target_id":"TargetID","who_email":"WhoEmail","who_delegate_email":"WhoDelegateEmail","message":"Message"}]}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"audits":[{"id":"ID","_rev":"Rev","created":"2019-01-01T12:00:00.000Z","change_type":"ChangeType","target_type":"TargetType","target_id":"TargetID","who_email":"WhoEmail","who_delegate_email":"WhoDelegateEmail","message":"Message"}]}`) + } else { + res.WriteHeader(400) + } + })) + }) + It(`Use CatalogAccountAuditsPager.GetNext successfully`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + listCatalogAccountAuditsOptionsModel := &catalogmanagementv1.ListCatalogAccountAuditsOptions{ + Limit: core.Int64Ptr(int64(10)), + Lookupnames: core.BoolPtr(true), + } + + pager, err := catalogManagementService.NewCatalogAccountAuditsPager(listCatalogAccountAuditsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []catalogmanagementv1.AuditLogDigest + for pager.HasNext() { + nextPage, err := pager.GetNext() + Expect(err).To(BeNil()) + Expect(nextPage).ToNot(BeNil()) + allResults = append(allResults, nextPage...) + } + Expect(len(allResults)).To(Equal(2)) + }) + It(`Use CatalogAccountAuditsPager.GetAll successfully`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + listCatalogAccountAuditsOptionsModel := &catalogmanagementv1.ListCatalogAccountAuditsOptions{ + Limit: core.Int64Ptr(int64(10)), + Lookupnames: core.BoolPtr(true), + } + + pager, err := catalogManagementService.NewCatalogAccountAuditsPager(listCatalogAccountAuditsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + allResults, err := pager.GetAll() + Expect(err).To(BeNil()) + Expect(allResults).ToNot(BeNil()) + Expect(len(allResults)).To(Equal(2)) + }) + }) + }) + Describe(`GetCatalogAccountAudit(getCatalogAccountAuditOptions *GetCatalogAccountAuditOptions) - Operation response error`, func() { + getCatalogAccountAuditPath := "/catalogaccount/audits/testString" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getCatalogAccountAuditPath)) + Expect(req.Method).To(Equal("GET")) + // TODO: Add check for lookupnames query parameter + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke GetCatalogAccountAudit with error: Operation response processing error`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Construct an instance of the GetCatalogAccountAuditOptions model + getCatalogAccountAuditOptionsModel := new(catalogmanagementv1.GetCatalogAccountAuditOptions) + getCatalogAccountAuditOptionsModel.AuditlogIdentifier = core.StringPtr("testString") + getCatalogAccountAuditOptionsModel.Lookupnames = core.BoolPtr(true) + getCatalogAccountAuditOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := catalogManagementService.GetCatalogAccountAudit(getCatalogAccountAuditOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + catalogManagementService.EnableRetries(0, 0) + result, response, operationErr = catalogManagementService.GetCatalogAccountAudit(getCatalogAccountAuditOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetCatalogAccountAudit(getCatalogAccountAuditOptions *GetCatalogAccountAuditOptions)`, func() { + getCatalogAccountAuditPath := "/catalogaccount/audits/testString" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getCatalogAccountAuditPath)) + Expect(req.Method).To(Equal("GET")) + + // TODO: Add check for lookupnames query parameter + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "created": "2019-01-01T12:00:00.000Z", "change_type": "ChangeType", "target_type": "TargetType", "target_id": "TargetID", "who_email": "WhoEmail", "who_delegate_email": "WhoDelegateEmail", "message": "Message", "gid": "Gid", "who_id": "WhoID", "who_name": "WhoName", "who_delegate_id": "WhoDelegateID", "who_delegate_name": "WhoDelegateName", "data": "anyValue"}`) + })) + }) + It(`Invoke GetCatalogAccountAudit successfully with retries`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + catalogManagementService.EnableRetries(0, 0) + + // Construct an instance of the GetCatalogAccountAuditOptions model + getCatalogAccountAuditOptionsModel := new(catalogmanagementv1.GetCatalogAccountAuditOptions) + getCatalogAccountAuditOptionsModel.AuditlogIdentifier = core.StringPtr("testString") + getCatalogAccountAuditOptionsModel.Lookupnames = core.BoolPtr(true) + getCatalogAccountAuditOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := catalogManagementService.GetCatalogAccountAuditWithContext(ctx, getCatalogAccountAuditOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + catalogManagementService.DisableRetries() + result, response, operationErr := catalogManagementService.GetCatalogAccountAudit(getCatalogAccountAuditOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = catalogManagementService.GetCatalogAccountAuditWithContext(ctx, getCatalogAccountAuditOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getCatalogAccountAuditPath)) + Expect(req.Method).To(Equal("GET")) + + // TODO: Add check for lookupnames query parameter + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "created": "2019-01-01T12:00:00.000Z", "change_type": "ChangeType", "target_type": "TargetType", "target_id": "TargetID", "who_email": "WhoEmail", "who_delegate_email": "WhoDelegateEmail", "message": "Message", "gid": "Gid", "who_id": "WhoID", "who_name": "WhoName", "who_delegate_id": "WhoDelegateID", "who_delegate_name": "WhoDelegateName", "data": "anyValue"}`) + })) + }) + It(`Invoke GetCatalogAccountAudit successfully`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := catalogManagementService.GetCatalogAccountAudit(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetCatalogAccountAuditOptions model + getCatalogAccountAuditOptionsModel := new(catalogmanagementv1.GetCatalogAccountAuditOptions) + getCatalogAccountAuditOptionsModel.AuditlogIdentifier = core.StringPtr("testString") + getCatalogAccountAuditOptionsModel.Lookupnames = core.BoolPtr(true) + getCatalogAccountAuditOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = catalogManagementService.GetCatalogAccountAudit(getCatalogAccountAuditOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetCatalogAccountAudit with error: Operation validation and request error`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Construct an instance of the GetCatalogAccountAuditOptions model + getCatalogAccountAuditOptionsModel := new(catalogmanagementv1.GetCatalogAccountAuditOptions) + getCatalogAccountAuditOptionsModel.AuditlogIdentifier = core.StringPtr("testString") + getCatalogAccountAuditOptionsModel.Lookupnames = core.BoolPtr(true) + getCatalogAccountAuditOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := catalogManagementService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := catalogManagementService.GetCatalogAccountAudit(getCatalogAccountAuditOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the GetCatalogAccountAuditOptions model with no property values + getCatalogAccountAuditOptionsModelNew := new(catalogmanagementv1.GetCatalogAccountAuditOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = catalogManagementService.GetCatalogAccountAudit(getCatalogAccountAuditOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke GetCatalogAccountAudit successfully`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Construct an instance of the GetCatalogAccountAuditOptions model + getCatalogAccountAuditOptionsModel := new(catalogmanagementv1.GetCatalogAccountAuditOptions) + getCatalogAccountAuditOptionsModel.AuditlogIdentifier = core.StringPtr("testString") + getCatalogAccountAuditOptionsModel.Lookupnames = core.BoolPtr(true) + getCatalogAccountAuditOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := catalogManagementService.GetCatalogAccountAudit(getCatalogAccountAuditOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetCatalogAccountFilters(getCatalogAccountFiltersOptions *GetCatalogAccountFiltersOptions) - Operation response error`, func() { + getCatalogAccountFiltersPath := "/catalogaccount/filters" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() // Verify the contents of the request Expect(req.URL.EscapedPath()).To(Equal(getCatalogAccountFiltersPath)) @@ -701,7 +1268,7 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(req.URL.Query()["catalog"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, `} this is not valid json {`) + fmt.Fprint(res, `} this is not valid json {`) })) }) It(`Invoke GetCatalogAccountFilters with error: Operation response processing error`, func() { @@ -752,7 +1319,7 @@ var _ = Describe(`CatalogManagementV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"account_filters": [{"include_all": true, "category_filters": {"mapKey": {"include": false, "filter": {"filter_terms": ["FilterTerms"]}}}, "id_filters": {"include": {"filter_terms": ["FilterTerms"]}, "exclude": {"filter_terms": ["FilterTerms"]}}}], "catalog_filters": [{"catalog": {"id": "ID", "name": "Name"}, "filters": {"include_all": true, "category_filters": {"mapKey": {"include": false, "filter": {"filter_terms": ["FilterTerms"]}}}, "id_filters": {"include": {"filter_terms": ["FilterTerms"]}, "exclude": {"filter_terms": ["FilterTerms"]}}}}]}`) + fmt.Fprintf(res, "%s", `{"hide_IBM_cloud_catalog": false, "account_filters": [{"include_all": true, "category_filters": {"mapKey": {"include": false, "filter": {"filter_terms": ["FilterTerms"]}}}, "id_filters": {"include": {"filter_terms": ["FilterTerms"]}, "exclude": {"filter_terms": ["FilterTerms"]}}}], "catalog_filters": [{"catalog": {"id": "ID", "name": "Name"}, "filters": {"include_all": true, "category_filters": {"mapKey": {"include": false, "filter": {"filter_terms": ["FilterTerms"]}}}, "id_filters": {"include": {"filter_terms": ["FilterTerms"]}, "exclude": {"filter_terms": ["FilterTerms"]}}}}]}`) })) }) It(`Invoke GetCatalogAccountFilters successfully with retries`, func() { @@ -807,7 +1374,7 @@ var _ = Describe(`CatalogManagementV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"account_filters": [{"include_all": true, "category_filters": {"mapKey": {"include": false, "filter": {"filter_terms": ["FilterTerms"]}}}, "id_filters": {"include": {"filter_terms": ["FilterTerms"]}, "exclude": {"filter_terms": ["FilterTerms"]}}}], "catalog_filters": [{"catalog": {"id": "ID", "name": "Name"}, "filters": {"include_all": true, "category_filters": {"mapKey": {"include": false, "filter": {"filter_terms": ["FilterTerms"]}}}, "id_filters": {"include": {"filter_terms": ["FilterTerms"]}, "exclude": {"filter_terms": ["FilterTerms"]}}}}]}`) + fmt.Fprintf(res, "%s", `{"hide_IBM_cloud_catalog": false, "account_filters": [{"include_all": true, "category_filters": {"mapKey": {"include": false, "filter": {"filter_terms": ["FilterTerms"]}}}, "id_filters": {"include": {"filter_terms": ["FilterTerms"]}, "exclude": {"filter_terms": ["FilterTerms"]}}}], "catalog_filters": [{"catalog": {"id": "ID", "name": "Name"}, "filters": {"include_all": true, "category_filters": {"mapKey": {"include": false, "filter": {"filter_terms": ["FilterTerms"]}}}, "id_filters": {"include": {"filter_terms": ["FilterTerms"]}, "exclude": {"filter_terms": ["FilterTerms"]}}}}]}`) })) }) It(`Invoke GetCatalogAccountFilters successfully`, func() { @@ -908,7 +1475,7 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(req.Method).To(Equal("GET")) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, `} this is not valid json {`) + fmt.Fprint(res, `} this is not valid json {`) })) }) It(`Invoke ListCatalogs with error: Operation response processing error`, func() { @@ -957,7 +1524,7 @@ var _ = Describe(`CatalogManagementV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"total_count": 10, "resources": [{"id": "ID", "_rev": "Rev", "label": "Label", "short_description": "ShortDescription", "catalog_icon_url": "CatalogIconURL", "tags": ["Tags"], "url": "URL", "crn": "CRN", "offerings_url": "OfferingsURL", "features": [{"title": "Title", "description": "Description"}], "disabled": true, "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "resource_group_id": "ResourceGroupID", "owning_account": "OwningAccount", "catalog_filters": {"include_all": true, "category_filters": {"mapKey": {"include": false, "filter": {"filter_terms": ["FilterTerms"]}}}, "id_filters": {"include": {"filter_terms": ["FilterTerms"]}, "exclude": {"filter_terms": ["FilterTerms"]}}}, "syndication_settings": {"remove_related_components": false, "clusters": [{"region": "Region", "id": "ID", "name": "Name", "resource_group_name": "ResourceGroupName", "type": "Type", "namespaces": ["Namespaces"], "all_namespaces": false}], "history": {"namespaces": ["Namespaces"], "clusters": [{"region": "Region", "id": "ID", "name": "Name", "resource_group_name": "ResourceGroupName", "type": "Type", "namespaces": ["Namespaces"], "all_namespaces": false}], "last_run": "2019-01-01T12:00:00.000Z"}, "authorization": {"token": "Token", "last_run": "2019-01-01T12:00:00.000Z"}}, "kind": "Kind"}]}`) + fmt.Fprintf(res, "%s", `{"total_count": 10, "resources": [{"id": "ID", "_rev": "Rev", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "short_description": "ShortDescription", "short_description_i18n": {"mapKey": "Inner"}, "catalog_icon_url": "CatalogIconURL", "tags": ["Tags"], "url": "URL", "crn": "CRN", "offerings_url": "OfferingsURL", "features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "disabled": true, "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "resource_group_id": "ResourceGroupID", "owning_account": "OwningAccount", "catalog_filters": {"include_all": true, "category_filters": {"mapKey": {"include": false, "filter": {"filter_terms": ["FilterTerms"]}}}, "id_filters": {"include": {"filter_terms": ["FilterTerms"]}, "exclude": {"filter_terms": ["FilterTerms"]}}}, "syndication_settings": {"remove_related_components": false, "clusters": [{"region": "Region", "id": "ID", "name": "Name", "resource_group_name": "ResourceGroupName", "type": "Type", "namespaces": ["Namespaces"], "all_namespaces": false}], "history": {"namespaces": ["Namespaces"], "clusters": [{"region": "Region", "id": "ID", "name": "Name", "resource_group_name": "ResourceGroupName", "type": "Type", "namespaces": ["Namespaces"], "all_namespaces": false}], "last_run": "2019-01-01T12:00:00.000Z"}, "authorization": {"token": "Token", "last_run": "2019-01-01T12:00:00.000Z"}}, "kind": "Kind", "metadata": {"mapKey": "anyValue"}}]}`) })) }) It(`Invoke ListCatalogs successfully with retries`, func() { @@ -1010,7 +1577,7 @@ var _ = Describe(`CatalogManagementV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"total_count": 10, "resources": [{"id": "ID", "_rev": "Rev", "label": "Label", "short_description": "ShortDescription", "catalog_icon_url": "CatalogIconURL", "tags": ["Tags"], "url": "URL", "crn": "CRN", "offerings_url": "OfferingsURL", "features": [{"title": "Title", "description": "Description"}], "disabled": true, "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "resource_group_id": "ResourceGroupID", "owning_account": "OwningAccount", "catalog_filters": {"include_all": true, "category_filters": {"mapKey": {"include": false, "filter": {"filter_terms": ["FilterTerms"]}}}, "id_filters": {"include": {"filter_terms": ["FilterTerms"]}, "exclude": {"filter_terms": ["FilterTerms"]}}}, "syndication_settings": {"remove_related_components": false, "clusters": [{"region": "Region", "id": "ID", "name": "Name", "resource_group_name": "ResourceGroupName", "type": "Type", "namespaces": ["Namespaces"], "all_namespaces": false}], "history": {"namespaces": ["Namespaces"], "clusters": [{"region": "Region", "id": "ID", "name": "Name", "resource_group_name": "ResourceGroupName", "type": "Type", "namespaces": ["Namespaces"], "all_namespaces": false}], "last_run": "2019-01-01T12:00:00.000Z"}, "authorization": {"token": "Token", "last_run": "2019-01-01T12:00:00.000Z"}}, "kind": "Kind"}]}`) + fmt.Fprintf(res, "%s", `{"total_count": 10, "resources": [{"id": "ID", "_rev": "Rev", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "short_description": "ShortDescription", "short_description_i18n": {"mapKey": "Inner"}, "catalog_icon_url": "CatalogIconURL", "tags": ["Tags"], "url": "URL", "crn": "CRN", "offerings_url": "OfferingsURL", "features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "disabled": true, "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "resource_group_id": "ResourceGroupID", "owning_account": "OwningAccount", "catalog_filters": {"include_all": true, "category_filters": {"mapKey": {"include": false, "filter": {"filter_terms": ["FilterTerms"]}}}, "id_filters": {"include": {"filter_terms": ["FilterTerms"]}, "exclude": {"filter_terms": ["FilterTerms"]}}}, "syndication_settings": {"remove_related_components": false, "clusters": [{"region": "Region", "id": "ID", "name": "Name", "resource_group_name": "ResourceGroupName", "type": "Type", "namespaces": ["Namespaces"], "all_namespaces": false}], "history": {"namespaces": ["Namespaces"], "clusters": [{"region": "Region", "id": "ID", "name": "Name", "resource_group_name": "ResourceGroupName", "type": "Type", "namespaces": ["Namespaces"], "all_namespaces": false}], "last_run": "2019-01-01T12:00:00.000Z"}, "authorization": {"token": "Token", "last_run": "2019-01-01T12:00:00.000Z"}}, "kind": "Kind", "metadata": {"mapKey": "anyValue"}}]}`) })) }) It(`Invoke ListCatalogs successfully`, func() { @@ -1108,7 +1675,7 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(req.Method).To(Equal("POST")) res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, `} this is not valid json {`) + fmt.Fprint(res, `} this is not valid json {`) })) }) It(`Invoke CreateCatalog with error: Operation response processing error`, func() { @@ -1122,7 +1689,9 @@ var _ = Describe(`CatalogManagementV1`, func() { // Construct an instance of the Feature model featureModel := new(catalogmanagementv1.Feature) featureModel.Title = core.StringPtr("testString") + featureModel.TitleI18n = make(map[string]string) featureModel.Description = core.StringPtr("testString") + featureModel.DescriptionI18n = make(map[string]string) // Construct an instance of the FilterTerms model filterTermsModel := new(catalogmanagementv1.FilterTerms) @@ -1178,7 +1747,9 @@ var _ = Describe(`CatalogManagementV1`, func() { createCatalogOptionsModel.ID = core.StringPtr("testString") createCatalogOptionsModel.Rev = core.StringPtr("testString") createCatalogOptionsModel.Label = core.StringPtr("testString") + createCatalogOptionsModel.LabelI18n = make(map[string]string) createCatalogOptionsModel.ShortDescription = core.StringPtr("testString") + createCatalogOptionsModel.ShortDescriptionI18n = make(map[string]string) createCatalogOptionsModel.CatalogIconURL = core.StringPtr("testString") createCatalogOptionsModel.Tags = []string{"testString"} createCatalogOptionsModel.Features = []catalogmanagementv1.Feature{*featureModel} @@ -1188,6 +1759,7 @@ var _ = Describe(`CatalogManagementV1`, func() { createCatalogOptionsModel.CatalogFilters = filtersModel createCatalogOptionsModel.SyndicationSettings = syndicationResourceModel createCatalogOptionsModel.Kind = core.StringPtr("testString") + createCatalogOptionsModel.Metadata = make(map[string]interface{}) createCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response result, response, operationErr := catalogManagementService.CreateCatalog(createCatalogOptionsModel) @@ -1240,7 +1812,7 @@ var _ = Describe(`CatalogManagementV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "label": "Label", "short_description": "ShortDescription", "catalog_icon_url": "CatalogIconURL", "tags": ["Tags"], "url": "URL", "crn": "CRN", "offerings_url": "OfferingsURL", "features": [{"title": "Title", "description": "Description"}], "disabled": true, "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "resource_group_id": "ResourceGroupID", "owning_account": "OwningAccount", "catalog_filters": {"include_all": true, "category_filters": {"mapKey": {"include": false, "filter": {"filter_terms": ["FilterTerms"]}}}, "id_filters": {"include": {"filter_terms": ["FilterTerms"]}, "exclude": {"filter_terms": ["FilterTerms"]}}}, "syndication_settings": {"remove_related_components": false, "clusters": [{"region": "Region", "id": "ID", "name": "Name", "resource_group_name": "ResourceGroupName", "type": "Type", "namespaces": ["Namespaces"], "all_namespaces": false}], "history": {"namespaces": ["Namespaces"], "clusters": [{"region": "Region", "id": "ID", "name": "Name", "resource_group_name": "ResourceGroupName", "type": "Type", "namespaces": ["Namespaces"], "all_namespaces": false}], "last_run": "2019-01-01T12:00:00.000Z"}, "authorization": {"token": "Token", "last_run": "2019-01-01T12:00:00.000Z"}}, "kind": "Kind"}`) + fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "short_description": "ShortDescription", "short_description_i18n": {"mapKey": "Inner"}, "catalog_icon_url": "CatalogIconURL", "tags": ["Tags"], "url": "URL", "crn": "CRN", "offerings_url": "OfferingsURL", "features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "disabled": true, "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "resource_group_id": "ResourceGroupID", "owning_account": "OwningAccount", "catalog_filters": {"include_all": true, "category_filters": {"mapKey": {"include": false, "filter": {"filter_terms": ["FilterTerms"]}}}, "id_filters": {"include": {"filter_terms": ["FilterTerms"]}, "exclude": {"filter_terms": ["FilterTerms"]}}}, "syndication_settings": {"remove_related_components": false, "clusters": [{"region": "Region", "id": "ID", "name": "Name", "resource_group_name": "ResourceGroupName", "type": "Type", "namespaces": ["Namespaces"], "all_namespaces": false}], "history": {"namespaces": ["Namespaces"], "clusters": [{"region": "Region", "id": "ID", "name": "Name", "resource_group_name": "ResourceGroupName", "type": "Type", "namespaces": ["Namespaces"], "all_namespaces": false}], "last_run": "2019-01-01T12:00:00.000Z"}, "authorization": {"token": "Token", "last_run": "2019-01-01T12:00:00.000Z"}}, "kind": "Kind", "metadata": {"mapKey": "anyValue"}}`) })) }) It(`Invoke CreateCatalog successfully with retries`, func() { @@ -1255,7 +1827,9 @@ var _ = Describe(`CatalogManagementV1`, func() { // Construct an instance of the Feature model featureModel := new(catalogmanagementv1.Feature) featureModel.Title = core.StringPtr("testString") + featureModel.TitleI18n = make(map[string]string) featureModel.Description = core.StringPtr("testString") + featureModel.DescriptionI18n = make(map[string]string) // Construct an instance of the FilterTerms model filterTermsModel := new(catalogmanagementv1.FilterTerms) @@ -1311,7 +1885,9 @@ var _ = Describe(`CatalogManagementV1`, func() { createCatalogOptionsModel.ID = core.StringPtr("testString") createCatalogOptionsModel.Rev = core.StringPtr("testString") createCatalogOptionsModel.Label = core.StringPtr("testString") + createCatalogOptionsModel.LabelI18n = make(map[string]string) createCatalogOptionsModel.ShortDescription = core.StringPtr("testString") + createCatalogOptionsModel.ShortDescriptionI18n = make(map[string]string) createCatalogOptionsModel.CatalogIconURL = core.StringPtr("testString") createCatalogOptionsModel.Tags = []string{"testString"} createCatalogOptionsModel.Features = []catalogmanagementv1.Feature{*featureModel} @@ -1321,6 +1897,7 @@ var _ = Describe(`CatalogManagementV1`, func() { createCatalogOptionsModel.CatalogFilters = filtersModel createCatalogOptionsModel.SyndicationSettings = syndicationResourceModel createCatalogOptionsModel.Kind = core.StringPtr("testString") + createCatalogOptionsModel.Metadata = make(map[string]interface{}) createCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error @@ -1376,7 +1953,7 @@ var _ = Describe(`CatalogManagementV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "label": "Label", "short_description": "ShortDescription", "catalog_icon_url": "CatalogIconURL", "tags": ["Tags"], "url": "URL", "crn": "CRN", "offerings_url": "OfferingsURL", "features": [{"title": "Title", "description": "Description"}], "disabled": true, "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "resource_group_id": "ResourceGroupID", "owning_account": "OwningAccount", "catalog_filters": {"include_all": true, "category_filters": {"mapKey": {"include": false, "filter": {"filter_terms": ["FilterTerms"]}}}, "id_filters": {"include": {"filter_terms": ["FilterTerms"]}, "exclude": {"filter_terms": ["FilterTerms"]}}}, "syndication_settings": {"remove_related_components": false, "clusters": [{"region": "Region", "id": "ID", "name": "Name", "resource_group_name": "ResourceGroupName", "type": "Type", "namespaces": ["Namespaces"], "all_namespaces": false}], "history": {"namespaces": ["Namespaces"], "clusters": [{"region": "Region", "id": "ID", "name": "Name", "resource_group_name": "ResourceGroupName", "type": "Type", "namespaces": ["Namespaces"], "all_namespaces": false}], "last_run": "2019-01-01T12:00:00.000Z"}, "authorization": {"token": "Token", "last_run": "2019-01-01T12:00:00.000Z"}}, "kind": "Kind"}`) + fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "short_description": "ShortDescription", "short_description_i18n": {"mapKey": "Inner"}, "catalog_icon_url": "CatalogIconURL", "tags": ["Tags"], "url": "URL", "crn": "CRN", "offerings_url": "OfferingsURL", "features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "disabled": true, "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "resource_group_id": "ResourceGroupID", "owning_account": "OwningAccount", "catalog_filters": {"include_all": true, "category_filters": {"mapKey": {"include": false, "filter": {"filter_terms": ["FilterTerms"]}}}, "id_filters": {"include": {"filter_terms": ["FilterTerms"]}, "exclude": {"filter_terms": ["FilterTerms"]}}}, "syndication_settings": {"remove_related_components": false, "clusters": [{"region": "Region", "id": "ID", "name": "Name", "resource_group_name": "ResourceGroupName", "type": "Type", "namespaces": ["Namespaces"], "all_namespaces": false}], "history": {"namespaces": ["Namespaces"], "clusters": [{"region": "Region", "id": "ID", "name": "Name", "resource_group_name": "ResourceGroupName", "type": "Type", "namespaces": ["Namespaces"], "all_namespaces": false}], "last_run": "2019-01-01T12:00:00.000Z"}, "authorization": {"token": "Token", "last_run": "2019-01-01T12:00:00.000Z"}}, "kind": "Kind", "metadata": {"mapKey": "anyValue"}}`) })) }) It(`Invoke CreateCatalog successfully`, func() { @@ -1396,7 +1973,9 @@ var _ = Describe(`CatalogManagementV1`, func() { // Construct an instance of the Feature model featureModel := new(catalogmanagementv1.Feature) featureModel.Title = core.StringPtr("testString") + featureModel.TitleI18n = make(map[string]string) featureModel.Description = core.StringPtr("testString") + featureModel.DescriptionI18n = make(map[string]string) // Construct an instance of the FilterTerms model filterTermsModel := new(catalogmanagementv1.FilterTerms) @@ -1452,7 +2031,9 @@ var _ = Describe(`CatalogManagementV1`, func() { createCatalogOptionsModel.ID = core.StringPtr("testString") createCatalogOptionsModel.Rev = core.StringPtr("testString") createCatalogOptionsModel.Label = core.StringPtr("testString") + createCatalogOptionsModel.LabelI18n = make(map[string]string) createCatalogOptionsModel.ShortDescription = core.StringPtr("testString") + createCatalogOptionsModel.ShortDescriptionI18n = make(map[string]string) createCatalogOptionsModel.CatalogIconURL = core.StringPtr("testString") createCatalogOptionsModel.Tags = []string{"testString"} createCatalogOptionsModel.Features = []catalogmanagementv1.Feature{*featureModel} @@ -1462,6 +2043,7 @@ var _ = Describe(`CatalogManagementV1`, func() { createCatalogOptionsModel.CatalogFilters = filtersModel createCatalogOptionsModel.SyndicationSettings = syndicationResourceModel createCatalogOptionsModel.Kind = core.StringPtr("testString") + createCatalogOptionsModel.Metadata = make(map[string]interface{}) createCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) @@ -1482,7 +2064,9 @@ var _ = Describe(`CatalogManagementV1`, func() { // Construct an instance of the Feature model featureModel := new(catalogmanagementv1.Feature) featureModel.Title = core.StringPtr("testString") + featureModel.TitleI18n = make(map[string]string) featureModel.Description = core.StringPtr("testString") + featureModel.DescriptionI18n = make(map[string]string) // Construct an instance of the FilterTerms model filterTermsModel := new(catalogmanagementv1.FilterTerms) @@ -1538,7 +2122,9 @@ var _ = Describe(`CatalogManagementV1`, func() { createCatalogOptionsModel.ID = core.StringPtr("testString") createCatalogOptionsModel.Rev = core.StringPtr("testString") createCatalogOptionsModel.Label = core.StringPtr("testString") + createCatalogOptionsModel.LabelI18n = make(map[string]string) createCatalogOptionsModel.ShortDescription = core.StringPtr("testString") + createCatalogOptionsModel.ShortDescriptionI18n = make(map[string]string) createCatalogOptionsModel.CatalogIconURL = core.StringPtr("testString") createCatalogOptionsModel.Tags = []string{"testString"} createCatalogOptionsModel.Features = []catalogmanagementv1.Feature{*featureModel} @@ -1548,6 +2134,7 @@ var _ = Describe(`CatalogManagementV1`, func() { createCatalogOptionsModel.CatalogFilters = filtersModel createCatalogOptionsModel.SyndicationSettings = syndicationResourceModel createCatalogOptionsModel.Kind = core.StringPtr("testString") + createCatalogOptionsModel.Metadata = make(map[string]interface{}) createCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := catalogManagementService.SetServiceURL("") @@ -1582,7 +2169,9 @@ var _ = Describe(`CatalogManagementV1`, func() { // Construct an instance of the Feature model featureModel := new(catalogmanagementv1.Feature) featureModel.Title = core.StringPtr("testString") + featureModel.TitleI18n = make(map[string]string) featureModel.Description = core.StringPtr("testString") + featureModel.DescriptionI18n = make(map[string]string) // Construct an instance of the FilterTerms model filterTermsModel := new(catalogmanagementv1.FilterTerms) @@ -1638,7 +2227,9 @@ var _ = Describe(`CatalogManagementV1`, func() { createCatalogOptionsModel.ID = core.StringPtr("testString") createCatalogOptionsModel.Rev = core.StringPtr("testString") createCatalogOptionsModel.Label = core.StringPtr("testString") + createCatalogOptionsModel.LabelI18n = make(map[string]string) createCatalogOptionsModel.ShortDescription = core.StringPtr("testString") + createCatalogOptionsModel.ShortDescriptionI18n = make(map[string]string) createCatalogOptionsModel.CatalogIconURL = core.StringPtr("testString") createCatalogOptionsModel.Tags = []string{"testString"} createCatalogOptionsModel.Features = []catalogmanagementv1.Feature{*featureModel} @@ -1648,6 +2239,7 @@ var _ = Describe(`CatalogManagementV1`, func() { createCatalogOptionsModel.CatalogFilters = filtersModel createCatalogOptionsModel.SyndicationSettings = syndicationResourceModel createCatalogOptionsModel.Kind = core.StringPtr("testString") + createCatalogOptionsModel.Metadata = make(map[string]interface{}) createCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation @@ -1675,7 +2267,7 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(req.Method).To(Equal("GET")) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, `} this is not valid json {`) + fmt.Fprint(res, `} this is not valid json {`) })) }) It(`Invoke GetCatalog with error: Operation response processing error`, func() { @@ -1725,7 +2317,7 @@ var _ = Describe(`CatalogManagementV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "label": "Label", "short_description": "ShortDescription", "catalog_icon_url": "CatalogIconURL", "tags": ["Tags"], "url": "URL", "crn": "CRN", "offerings_url": "OfferingsURL", "features": [{"title": "Title", "description": "Description"}], "disabled": true, "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "resource_group_id": "ResourceGroupID", "owning_account": "OwningAccount", "catalog_filters": {"include_all": true, "category_filters": {"mapKey": {"include": false, "filter": {"filter_terms": ["FilterTerms"]}}}, "id_filters": {"include": {"filter_terms": ["FilterTerms"]}, "exclude": {"filter_terms": ["FilterTerms"]}}}, "syndication_settings": {"remove_related_components": false, "clusters": [{"region": "Region", "id": "ID", "name": "Name", "resource_group_name": "ResourceGroupName", "type": "Type", "namespaces": ["Namespaces"], "all_namespaces": false}], "history": {"namespaces": ["Namespaces"], "clusters": [{"region": "Region", "id": "ID", "name": "Name", "resource_group_name": "ResourceGroupName", "type": "Type", "namespaces": ["Namespaces"], "all_namespaces": false}], "last_run": "2019-01-01T12:00:00.000Z"}, "authorization": {"token": "Token", "last_run": "2019-01-01T12:00:00.000Z"}}, "kind": "Kind"}`) + fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "short_description": "ShortDescription", "short_description_i18n": {"mapKey": "Inner"}, "catalog_icon_url": "CatalogIconURL", "tags": ["Tags"], "url": "URL", "crn": "CRN", "offerings_url": "OfferingsURL", "features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "disabled": true, "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "resource_group_id": "ResourceGroupID", "owning_account": "OwningAccount", "catalog_filters": {"include_all": true, "category_filters": {"mapKey": {"include": false, "filter": {"filter_terms": ["FilterTerms"]}}}, "id_filters": {"include": {"filter_terms": ["FilterTerms"]}, "exclude": {"filter_terms": ["FilterTerms"]}}}, "syndication_settings": {"remove_related_components": false, "clusters": [{"region": "Region", "id": "ID", "name": "Name", "resource_group_name": "ResourceGroupName", "type": "Type", "namespaces": ["Namespaces"], "all_namespaces": false}], "history": {"namespaces": ["Namespaces"], "clusters": [{"region": "Region", "id": "ID", "name": "Name", "resource_group_name": "ResourceGroupName", "type": "Type", "namespaces": ["Namespaces"], "all_namespaces": false}], "last_run": "2019-01-01T12:00:00.000Z"}, "authorization": {"token": "Token", "last_run": "2019-01-01T12:00:00.000Z"}}, "kind": "Kind", "metadata": {"mapKey": "anyValue"}}`) })) }) It(`Invoke GetCatalog successfully with retries`, func() { @@ -1779,7 +2371,7 @@ var _ = Describe(`CatalogManagementV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "label": "Label", "short_description": "ShortDescription", "catalog_icon_url": "CatalogIconURL", "tags": ["Tags"], "url": "URL", "crn": "CRN", "offerings_url": "OfferingsURL", "features": [{"title": "Title", "description": "Description"}], "disabled": true, "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "resource_group_id": "ResourceGroupID", "owning_account": "OwningAccount", "catalog_filters": {"include_all": true, "category_filters": {"mapKey": {"include": false, "filter": {"filter_terms": ["FilterTerms"]}}}, "id_filters": {"include": {"filter_terms": ["FilterTerms"]}, "exclude": {"filter_terms": ["FilterTerms"]}}}, "syndication_settings": {"remove_related_components": false, "clusters": [{"region": "Region", "id": "ID", "name": "Name", "resource_group_name": "ResourceGroupName", "type": "Type", "namespaces": ["Namespaces"], "all_namespaces": false}], "history": {"namespaces": ["Namespaces"], "clusters": [{"region": "Region", "id": "ID", "name": "Name", "resource_group_name": "ResourceGroupName", "type": "Type", "namespaces": ["Namespaces"], "all_namespaces": false}], "last_run": "2019-01-01T12:00:00.000Z"}, "authorization": {"token": "Token", "last_run": "2019-01-01T12:00:00.000Z"}}, "kind": "Kind"}`) + fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "short_description": "ShortDescription", "short_description_i18n": {"mapKey": "Inner"}, "catalog_icon_url": "CatalogIconURL", "tags": ["Tags"], "url": "URL", "crn": "CRN", "offerings_url": "OfferingsURL", "features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "disabled": true, "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "resource_group_id": "ResourceGroupID", "owning_account": "OwningAccount", "catalog_filters": {"include_all": true, "category_filters": {"mapKey": {"include": false, "filter": {"filter_terms": ["FilterTerms"]}}}, "id_filters": {"include": {"filter_terms": ["FilterTerms"]}, "exclude": {"filter_terms": ["FilterTerms"]}}}, "syndication_settings": {"remove_related_components": false, "clusters": [{"region": "Region", "id": "ID", "name": "Name", "resource_group_name": "ResourceGroupName", "type": "Type", "namespaces": ["Namespaces"], "all_namespaces": false}], "history": {"namespaces": ["Namespaces"], "clusters": [{"region": "Region", "id": "ID", "name": "Name", "resource_group_name": "ResourceGroupName", "type": "Type", "namespaces": ["Namespaces"], "all_namespaces": false}], "last_run": "2019-01-01T12:00:00.000Z"}, "authorization": {"token": "Token", "last_run": "2019-01-01T12:00:00.000Z"}}, "kind": "Kind", "metadata": {"mapKey": "anyValue"}}`) })) }) It(`Invoke GetCatalog successfully`, func() { @@ -1887,7 +2479,7 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(req.Method).To(Equal("PUT")) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, `} this is not valid json {`) + fmt.Fprint(res, `} this is not valid json {`) })) }) It(`Invoke ReplaceCatalog with error: Operation response processing error`, func() { @@ -1901,7 +2493,9 @@ var _ = Describe(`CatalogManagementV1`, func() { // Construct an instance of the Feature model featureModel := new(catalogmanagementv1.Feature) featureModel.Title = core.StringPtr("testString") + featureModel.TitleI18n = make(map[string]string) featureModel.Description = core.StringPtr("testString") + featureModel.DescriptionI18n = make(map[string]string) // Construct an instance of the FilterTerms model filterTermsModel := new(catalogmanagementv1.FilterTerms) @@ -1958,7 +2552,9 @@ var _ = Describe(`CatalogManagementV1`, func() { replaceCatalogOptionsModel.ID = core.StringPtr("testString") replaceCatalogOptionsModel.Rev = core.StringPtr("testString") replaceCatalogOptionsModel.Label = core.StringPtr("testString") + replaceCatalogOptionsModel.LabelI18n = make(map[string]string) replaceCatalogOptionsModel.ShortDescription = core.StringPtr("testString") + replaceCatalogOptionsModel.ShortDescriptionI18n = make(map[string]string) replaceCatalogOptionsModel.CatalogIconURL = core.StringPtr("testString") replaceCatalogOptionsModel.Tags = []string{"testString"} replaceCatalogOptionsModel.Features = []catalogmanagementv1.Feature{*featureModel} @@ -1968,6 +2564,7 @@ var _ = Describe(`CatalogManagementV1`, func() { replaceCatalogOptionsModel.CatalogFilters = filtersModel replaceCatalogOptionsModel.SyndicationSettings = syndicationResourceModel replaceCatalogOptionsModel.Kind = core.StringPtr("testString") + replaceCatalogOptionsModel.Metadata = make(map[string]interface{}) replaceCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response result, response, operationErr := catalogManagementService.ReplaceCatalog(replaceCatalogOptionsModel) @@ -2020,7 +2617,7 @@ var _ = Describe(`CatalogManagementV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "label": "Label", "short_description": "ShortDescription", "catalog_icon_url": "CatalogIconURL", "tags": ["Tags"], "url": "URL", "crn": "CRN", "offerings_url": "OfferingsURL", "features": [{"title": "Title", "description": "Description"}], "disabled": true, "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "resource_group_id": "ResourceGroupID", "owning_account": "OwningAccount", "catalog_filters": {"include_all": true, "category_filters": {"mapKey": {"include": false, "filter": {"filter_terms": ["FilterTerms"]}}}, "id_filters": {"include": {"filter_terms": ["FilterTerms"]}, "exclude": {"filter_terms": ["FilterTerms"]}}}, "syndication_settings": {"remove_related_components": false, "clusters": [{"region": "Region", "id": "ID", "name": "Name", "resource_group_name": "ResourceGroupName", "type": "Type", "namespaces": ["Namespaces"], "all_namespaces": false}], "history": {"namespaces": ["Namespaces"], "clusters": [{"region": "Region", "id": "ID", "name": "Name", "resource_group_name": "ResourceGroupName", "type": "Type", "namespaces": ["Namespaces"], "all_namespaces": false}], "last_run": "2019-01-01T12:00:00.000Z"}, "authorization": {"token": "Token", "last_run": "2019-01-01T12:00:00.000Z"}}, "kind": "Kind"}`) + fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "short_description": "ShortDescription", "short_description_i18n": {"mapKey": "Inner"}, "catalog_icon_url": "CatalogIconURL", "tags": ["Tags"], "url": "URL", "crn": "CRN", "offerings_url": "OfferingsURL", "features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "disabled": true, "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "resource_group_id": "ResourceGroupID", "owning_account": "OwningAccount", "catalog_filters": {"include_all": true, "category_filters": {"mapKey": {"include": false, "filter": {"filter_terms": ["FilterTerms"]}}}, "id_filters": {"include": {"filter_terms": ["FilterTerms"]}, "exclude": {"filter_terms": ["FilterTerms"]}}}, "syndication_settings": {"remove_related_components": false, "clusters": [{"region": "Region", "id": "ID", "name": "Name", "resource_group_name": "ResourceGroupName", "type": "Type", "namespaces": ["Namespaces"], "all_namespaces": false}], "history": {"namespaces": ["Namespaces"], "clusters": [{"region": "Region", "id": "ID", "name": "Name", "resource_group_name": "ResourceGroupName", "type": "Type", "namespaces": ["Namespaces"], "all_namespaces": false}], "last_run": "2019-01-01T12:00:00.000Z"}, "authorization": {"token": "Token", "last_run": "2019-01-01T12:00:00.000Z"}}, "kind": "Kind", "metadata": {"mapKey": "anyValue"}}`) })) }) It(`Invoke ReplaceCatalog successfully with retries`, func() { @@ -2035,7 +2632,9 @@ var _ = Describe(`CatalogManagementV1`, func() { // Construct an instance of the Feature model featureModel := new(catalogmanagementv1.Feature) featureModel.Title = core.StringPtr("testString") + featureModel.TitleI18n = make(map[string]string) featureModel.Description = core.StringPtr("testString") + featureModel.DescriptionI18n = make(map[string]string) // Construct an instance of the FilterTerms model filterTermsModel := new(catalogmanagementv1.FilterTerms) @@ -2092,7 +2691,9 @@ var _ = Describe(`CatalogManagementV1`, func() { replaceCatalogOptionsModel.ID = core.StringPtr("testString") replaceCatalogOptionsModel.Rev = core.StringPtr("testString") replaceCatalogOptionsModel.Label = core.StringPtr("testString") + replaceCatalogOptionsModel.LabelI18n = make(map[string]string) replaceCatalogOptionsModel.ShortDescription = core.StringPtr("testString") + replaceCatalogOptionsModel.ShortDescriptionI18n = make(map[string]string) replaceCatalogOptionsModel.CatalogIconURL = core.StringPtr("testString") replaceCatalogOptionsModel.Tags = []string{"testString"} replaceCatalogOptionsModel.Features = []catalogmanagementv1.Feature{*featureModel} @@ -2102,6 +2703,7 @@ var _ = Describe(`CatalogManagementV1`, func() { replaceCatalogOptionsModel.CatalogFilters = filtersModel replaceCatalogOptionsModel.SyndicationSettings = syndicationResourceModel replaceCatalogOptionsModel.Kind = core.StringPtr("testString") + replaceCatalogOptionsModel.Metadata = make(map[string]interface{}) replaceCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error @@ -2157,7 +2759,7 @@ var _ = Describe(`CatalogManagementV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "label": "Label", "short_description": "ShortDescription", "catalog_icon_url": "CatalogIconURL", "tags": ["Tags"], "url": "URL", "crn": "CRN", "offerings_url": "OfferingsURL", "features": [{"title": "Title", "description": "Description"}], "disabled": true, "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "resource_group_id": "ResourceGroupID", "owning_account": "OwningAccount", "catalog_filters": {"include_all": true, "category_filters": {"mapKey": {"include": false, "filter": {"filter_terms": ["FilterTerms"]}}}, "id_filters": {"include": {"filter_terms": ["FilterTerms"]}, "exclude": {"filter_terms": ["FilterTerms"]}}}, "syndication_settings": {"remove_related_components": false, "clusters": [{"region": "Region", "id": "ID", "name": "Name", "resource_group_name": "ResourceGroupName", "type": "Type", "namespaces": ["Namespaces"], "all_namespaces": false}], "history": {"namespaces": ["Namespaces"], "clusters": [{"region": "Region", "id": "ID", "name": "Name", "resource_group_name": "ResourceGroupName", "type": "Type", "namespaces": ["Namespaces"], "all_namespaces": false}], "last_run": "2019-01-01T12:00:00.000Z"}, "authorization": {"token": "Token", "last_run": "2019-01-01T12:00:00.000Z"}}, "kind": "Kind"}`) + fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "short_description": "ShortDescription", "short_description_i18n": {"mapKey": "Inner"}, "catalog_icon_url": "CatalogIconURL", "tags": ["Tags"], "url": "URL", "crn": "CRN", "offerings_url": "OfferingsURL", "features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "disabled": true, "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "resource_group_id": "ResourceGroupID", "owning_account": "OwningAccount", "catalog_filters": {"include_all": true, "category_filters": {"mapKey": {"include": false, "filter": {"filter_terms": ["FilterTerms"]}}}, "id_filters": {"include": {"filter_terms": ["FilterTerms"]}, "exclude": {"filter_terms": ["FilterTerms"]}}}, "syndication_settings": {"remove_related_components": false, "clusters": [{"region": "Region", "id": "ID", "name": "Name", "resource_group_name": "ResourceGroupName", "type": "Type", "namespaces": ["Namespaces"], "all_namespaces": false}], "history": {"namespaces": ["Namespaces"], "clusters": [{"region": "Region", "id": "ID", "name": "Name", "resource_group_name": "ResourceGroupName", "type": "Type", "namespaces": ["Namespaces"], "all_namespaces": false}], "last_run": "2019-01-01T12:00:00.000Z"}, "authorization": {"token": "Token", "last_run": "2019-01-01T12:00:00.000Z"}}, "kind": "Kind", "metadata": {"mapKey": "anyValue"}}`) })) }) It(`Invoke ReplaceCatalog successfully`, func() { @@ -2177,7 +2779,9 @@ var _ = Describe(`CatalogManagementV1`, func() { // Construct an instance of the Feature model featureModel := new(catalogmanagementv1.Feature) featureModel.Title = core.StringPtr("testString") + featureModel.TitleI18n = make(map[string]string) featureModel.Description = core.StringPtr("testString") + featureModel.DescriptionI18n = make(map[string]string) // Construct an instance of the FilterTerms model filterTermsModel := new(catalogmanagementv1.FilterTerms) @@ -2234,7 +2838,9 @@ var _ = Describe(`CatalogManagementV1`, func() { replaceCatalogOptionsModel.ID = core.StringPtr("testString") replaceCatalogOptionsModel.Rev = core.StringPtr("testString") replaceCatalogOptionsModel.Label = core.StringPtr("testString") + replaceCatalogOptionsModel.LabelI18n = make(map[string]string) replaceCatalogOptionsModel.ShortDescription = core.StringPtr("testString") + replaceCatalogOptionsModel.ShortDescriptionI18n = make(map[string]string) replaceCatalogOptionsModel.CatalogIconURL = core.StringPtr("testString") replaceCatalogOptionsModel.Tags = []string{"testString"} replaceCatalogOptionsModel.Features = []catalogmanagementv1.Feature{*featureModel} @@ -2244,6 +2850,7 @@ var _ = Describe(`CatalogManagementV1`, func() { replaceCatalogOptionsModel.CatalogFilters = filtersModel replaceCatalogOptionsModel.SyndicationSettings = syndicationResourceModel replaceCatalogOptionsModel.Kind = core.StringPtr("testString") + replaceCatalogOptionsModel.Metadata = make(map[string]interface{}) replaceCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) @@ -2264,7 +2871,9 @@ var _ = Describe(`CatalogManagementV1`, func() { // Construct an instance of the Feature model featureModel := new(catalogmanagementv1.Feature) featureModel.Title = core.StringPtr("testString") + featureModel.TitleI18n = make(map[string]string) featureModel.Description = core.StringPtr("testString") + featureModel.DescriptionI18n = make(map[string]string) // Construct an instance of the FilterTerms model filterTermsModel := new(catalogmanagementv1.FilterTerms) @@ -2321,7 +2930,9 @@ var _ = Describe(`CatalogManagementV1`, func() { replaceCatalogOptionsModel.ID = core.StringPtr("testString") replaceCatalogOptionsModel.Rev = core.StringPtr("testString") replaceCatalogOptionsModel.Label = core.StringPtr("testString") + replaceCatalogOptionsModel.LabelI18n = make(map[string]string) replaceCatalogOptionsModel.ShortDescription = core.StringPtr("testString") + replaceCatalogOptionsModel.ShortDescriptionI18n = make(map[string]string) replaceCatalogOptionsModel.CatalogIconURL = core.StringPtr("testString") replaceCatalogOptionsModel.Tags = []string{"testString"} replaceCatalogOptionsModel.Features = []catalogmanagementv1.Feature{*featureModel} @@ -2331,6 +2942,7 @@ var _ = Describe(`CatalogManagementV1`, func() { replaceCatalogOptionsModel.CatalogFilters = filtersModel replaceCatalogOptionsModel.SyndicationSettings = syndicationResourceModel replaceCatalogOptionsModel.Kind = core.StringPtr("testString") + replaceCatalogOptionsModel.Metadata = make(map[string]interface{}) replaceCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := catalogManagementService.SetServiceURL("") @@ -2372,7 +2984,9 @@ var _ = Describe(`CatalogManagementV1`, func() { // Construct an instance of the Feature model featureModel := new(catalogmanagementv1.Feature) featureModel.Title = core.StringPtr("testString") + featureModel.TitleI18n = make(map[string]string) featureModel.Description = core.StringPtr("testString") + featureModel.DescriptionI18n = make(map[string]string) // Construct an instance of the FilterTerms model filterTermsModel := new(catalogmanagementv1.FilterTerms) @@ -2429,7 +3043,9 @@ var _ = Describe(`CatalogManagementV1`, func() { replaceCatalogOptionsModel.ID = core.StringPtr("testString") replaceCatalogOptionsModel.Rev = core.StringPtr("testString") replaceCatalogOptionsModel.Label = core.StringPtr("testString") + replaceCatalogOptionsModel.LabelI18n = make(map[string]string) replaceCatalogOptionsModel.ShortDescription = core.StringPtr("testString") + replaceCatalogOptionsModel.ShortDescriptionI18n = make(map[string]string) replaceCatalogOptionsModel.CatalogIconURL = core.StringPtr("testString") replaceCatalogOptionsModel.Tags = []string{"testString"} replaceCatalogOptionsModel.Features = []catalogmanagementv1.Feature{*featureModel} @@ -2439,6 +3055,7 @@ var _ = Describe(`CatalogManagementV1`, func() { replaceCatalogOptionsModel.CatalogFilters = filtersModel replaceCatalogOptionsModel.SyndicationSettings = syndicationResourceModel replaceCatalogOptionsModel.Kind = core.StringPtr("testString") + replaceCatalogOptionsModel.Metadata = make(map[string]interface{}) replaceCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation @@ -2522,22 +3139,25 @@ var _ = Describe(`CatalogManagementV1`, func() { }) }) }) - Describe(`GetCatalogAudit(getCatalogAuditOptions *GetCatalogAuditOptions) - Operation response error`, func() { - getCatalogAuditPath := "/catalogs/testString/audit" + Describe(`ListCatalogAudits(listCatalogAuditsOptions *ListCatalogAuditsOptions) - Operation response error`, func() { + listCatalogAuditsPath := "/catalogs/testString/audits" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getCatalogAuditPath)) + Expect(req.URL.EscapedPath()).To(Equal(listCatalogAuditsPath)) Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + // TODO: Add check for lookupnames query parameter res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, `} this is not valid json {`) + fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetCatalogAudit with error: Operation response processing error`, func() { + It(`Invoke ListCatalogAudits with error: Operation response processing error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -2545,19 +3165,22 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the GetCatalogAuditOptions model - getCatalogAuditOptionsModel := new(catalogmanagementv1.GetCatalogAuditOptions) - getCatalogAuditOptionsModel.CatalogIdentifier = core.StringPtr("testString") - getCatalogAuditOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListCatalogAuditsOptions model + listCatalogAuditsOptionsModel := new(catalogmanagementv1.ListCatalogAuditsOptions) + listCatalogAuditsOptionsModel.CatalogIdentifier = core.StringPtr("testString") + listCatalogAuditsOptionsModel.Start = core.StringPtr("testString") + listCatalogAuditsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listCatalogAuditsOptionsModel.Lookupnames = core.BoolPtr(true) + listCatalogAuditsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := catalogManagementService.GetCatalogAudit(getCatalogAuditOptionsModel) + result, response, operationErr := catalogManagementService.ListCatalogAudits(listCatalogAuditsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again catalogManagementService.EnableRetries(0, 0) - result, response, operationErr = catalogManagementService.GetCatalogAudit(getCatalogAuditOptionsModel) + result, response, operationErr = catalogManagementService.ListCatalogAudits(listCatalogAuditsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -2567,27 +3190,30 @@ var _ = Describe(`CatalogManagementV1`, func() { }) }) }) - Describe(`GetCatalogAudit(getCatalogAuditOptions *GetCatalogAuditOptions)`, func() { - getCatalogAuditPath := "/catalogs/testString/audit" + Describe(`ListCatalogAudits(listCatalogAuditsOptions *ListCatalogAuditsOptions)`, func() { + listCatalogAuditsPath := "/catalogs/testString/audits" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getCatalogAuditPath)) + Expect(req.URL.EscapedPath()).To(Equal(listCatalogAuditsPath)) Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + // TODO: Add check for lookupnames query parameter // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"list": [{"id": "ID", "created": "2019-01-01T12:00:00.000Z", "change_type": "ChangeType", "target_type": "TargetType", "target_id": "TargetID", "who_delegate_email": "WhoDelegateEmail", "message": "Message"}]}`) + fmt.Fprintf(res, "%s", `{"start": "Start", "limit": 5, "total_count": 10, "resource_count": 13, "first": {"href": "Href", "start": "Start"}, "next": {"href": "Href", "start": "Start"}, "prev": {"href": "Href", "start": "Start"}, "last": {"href": "Href", "start": "Start"}, "audits": [{"id": "ID", "_rev": "Rev", "created": "2019-01-01T12:00:00.000Z", "change_type": "ChangeType", "target_type": "TargetType", "target_id": "TargetID", "who_email": "WhoEmail", "who_delegate_email": "WhoDelegateEmail", "message": "Message"}]}`) })) }) - It(`Invoke GetCatalogAudit successfully with retries`, func() { + It(`Invoke ListCatalogAudits successfully with retries`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -2596,21 +3222,24 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) catalogManagementService.EnableRetries(0, 0) - // Construct an instance of the GetCatalogAuditOptions model - getCatalogAuditOptionsModel := new(catalogmanagementv1.GetCatalogAuditOptions) - getCatalogAuditOptionsModel.CatalogIdentifier = core.StringPtr("testString") - getCatalogAuditOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListCatalogAuditsOptions model + listCatalogAuditsOptionsModel := new(catalogmanagementv1.ListCatalogAuditsOptions) + listCatalogAuditsOptionsModel.CatalogIdentifier = core.StringPtr("testString") + listCatalogAuditsOptionsModel.Start = core.StringPtr("testString") + listCatalogAuditsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listCatalogAuditsOptionsModel.Lookupnames = core.BoolPtr(true) + listCatalogAuditsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := catalogManagementService.GetCatalogAuditWithContext(ctx, getCatalogAuditOptionsModel) + _, _, operationErr := catalogManagementService.ListCatalogAuditsWithContext(ctx, listCatalogAuditsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again catalogManagementService.DisableRetries() - result, response, operationErr := catalogManagementService.GetCatalogAudit(getCatalogAuditOptionsModel) + result, response, operationErr := catalogManagementService.ListCatalogAudits(listCatalogAuditsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -2618,7 +3247,7 @@ var _ = Describe(`CatalogManagementV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = catalogManagementService.GetCatalogAuditWithContext(ctx, getCatalogAuditOptionsModel) + _, _, operationErr = catalogManagementService.ListCatalogAuditsWithContext(ctx, listCatalogAuditsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -2632,16 +3261,19 @@ var _ = Describe(`CatalogManagementV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getCatalogAuditPath)) + Expect(req.URL.EscapedPath()).To(Equal(listCatalogAuditsPath)) Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + // TODO: Add check for lookupnames query parameter // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"list": [{"id": "ID", "created": "2019-01-01T12:00:00.000Z", "change_type": "ChangeType", "target_type": "TargetType", "target_id": "TargetID", "who_delegate_email": "WhoDelegateEmail", "message": "Message"}]}`) + fmt.Fprintf(res, "%s", `{"start": "Start", "limit": 5, "total_count": 10, "resource_count": 13, "first": {"href": "Href", "start": "Start"}, "next": {"href": "Href", "start": "Start"}, "prev": {"href": "Href", "start": "Start"}, "last": {"href": "Href", "start": "Start"}, "audits": [{"id": "ID", "_rev": "Rev", "created": "2019-01-01T12:00:00.000Z", "change_type": "ChangeType", "target_type": "TargetType", "target_id": "TargetID", "who_email": "WhoEmail", "who_delegate_email": "WhoDelegateEmail", "message": "Message"}]}`) })) }) - It(`Invoke GetCatalogAudit successfully`, func() { + It(`Invoke ListCatalogAudits successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -2650,24 +3282,27 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := catalogManagementService.GetCatalogAudit(nil) + result, response, operationErr := catalogManagementService.ListCatalogAudits(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetCatalogAuditOptions model - getCatalogAuditOptionsModel := new(catalogmanagementv1.GetCatalogAuditOptions) - getCatalogAuditOptionsModel.CatalogIdentifier = core.StringPtr("testString") - getCatalogAuditOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListCatalogAuditsOptions model + listCatalogAuditsOptionsModel := new(catalogmanagementv1.ListCatalogAuditsOptions) + listCatalogAuditsOptionsModel.CatalogIdentifier = core.StringPtr("testString") + listCatalogAuditsOptionsModel.Start = core.StringPtr("testString") + listCatalogAuditsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listCatalogAuditsOptionsModel.Lookupnames = core.BoolPtr(true) + listCatalogAuditsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = catalogManagementService.GetCatalogAudit(getCatalogAuditOptionsModel) + result, response, operationErr = catalogManagementService.ListCatalogAudits(listCatalogAuditsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetCatalogAudit with error: Operation validation and request error`, func() { + It(`Invoke ListCatalogAudits with error: Operation validation and request error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -2675,22 +3310,25 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the GetCatalogAuditOptions model - getCatalogAuditOptionsModel := new(catalogmanagementv1.GetCatalogAuditOptions) - getCatalogAuditOptionsModel.CatalogIdentifier = core.StringPtr("testString") - getCatalogAuditOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListCatalogAuditsOptions model + listCatalogAuditsOptionsModel := new(catalogmanagementv1.ListCatalogAuditsOptions) + listCatalogAuditsOptionsModel.CatalogIdentifier = core.StringPtr("testString") + listCatalogAuditsOptionsModel.Start = core.StringPtr("testString") + listCatalogAuditsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listCatalogAuditsOptionsModel.Lookupnames = core.BoolPtr(true) + listCatalogAuditsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := catalogManagementService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := catalogManagementService.GetCatalogAudit(getCatalogAuditOptionsModel) + result, response, operationErr := catalogManagementService.ListCatalogAudits(listCatalogAuditsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetCatalogAuditOptions model with no property values - getCatalogAuditOptionsModelNew := new(catalogmanagementv1.GetCatalogAuditOptions) + // Construct a second instance of the ListCatalogAuditsOptions model with no property values + listCatalogAuditsOptionsModelNew := new(catalogmanagementv1.ListCatalogAuditsOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = catalogManagementService.GetCatalogAudit(getCatalogAuditOptionsModelNew) + result, response, operationErr = catalogManagementService.ListCatalogAudits(listCatalogAuditsOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -2708,7 +3346,7 @@ var _ = Describe(`CatalogManagementV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetCatalogAudit successfully`, func() { + It(`Invoke ListCatalogAudits successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -2716,13 +3354,16 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the GetCatalogAuditOptions model - getCatalogAuditOptionsModel := new(catalogmanagementv1.GetCatalogAuditOptions) - getCatalogAuditOptionsModel.CatalogIdentifier = core.StringPtr("testString") - getCatalogAuditOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListCatalogAuditsOptions model + listCatalogAuditsOptionsModel := new(catalogmanagementv1.ListCatalogAuditsOptions) + listCatalogAuditsOptionsModel.CatalogIdentifier = core.StringPtr("testString") + listCatalogAuditsOptionsModel.Start = core.StringPtr("testString") + listCatalogAuditsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listCatalogAuditsOptionsModel.Lookupnames = core.BoolPtr(true) + listCatalogAuditsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := catalogManagementService.GetCatalogAudit(getCatalogAuditOptionsModel) + result, response, operationErr := catalogManagementService.ListCatalogAudits(listCatalogAuditsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -2733,29 +3374,117 @@ var _ = Describe(`CatalogManagementV1`, func() { testServer.Close() }) }) + Context(`Test pagination helper method on response`, func() { + It(`Invoke GetNextStart successfully`, func() { + responseObject := new(catalogmanagementv1.AuditLogs) + nextObject := new(catalogmanagementv1.PaginationTokenLink) + nextObject.Start = core.StringPtr("abc-123") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(Equal(core.StringPtr("abc-123"))) + }) + It(`Invoke GetNextStart without a "Next" property in the response`, func() { + responseObject := new(catalogmanagementv1.AuditLogs) + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + Context(`Using mock server endpoint - paginated response`, func() { + BeforeEach(func() { + var requestNumber int = 0 + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listCatalogAuditsPath)) + Expect(req.Method).To(Equal("GET")) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + requestNumber++ + if requestNumber == 1 { + fmt.Fprintf(res, "%s", `{"next":{"start":"1"},"total_count":2,"limit":1,"audits":[{"id":"ID","_rev":"Rev","created":"2019-01-01T12:00:00.000Z","change_type":"ChangeType","target_type":"TargetType","target_id":"TargetID","who_email":"WhoEmail","who_delegate_email":"WhoDelegateEmail","message":"Message"}]}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"audits":[{"id":"ID","_rev":"Rev","created":"2019-01-01T12:00:00.000Z","change_type":"ChangeType","target_type":"TargetType","target_id":"TargetID","who_email":"WhoEmail","who_delegate_email":"WhoDelegateEmail","message":"Message"}]}`) + } else { + res.WriteHeader(400) + } + })) + }) + It(`Use CatalogAuditsPager.GetNext successfully`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + listCatalogAuditsOptionsModel := &catalogmanagementv1.ListCatalogAuditsOptions{ + CatalogIdentifier: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + Lookupnames: core.BoolPtr(true), + } + + pager, err := catalogManagementService.NewCatalogAuditsPager(listCatalogAuditsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []catalogmanagementv1.AuditLogDigest + for pager.HasNext() { + nextPage, err := pager.GetNext() + Expect(err).To(BeNil()) + Expect(nextPage).ToNot(BeNil()) + allResults = append(allResults, nextPage...) + } + Expect(len(allResults)).To(Equal(2)) + }) + It(`Use CatalogAuditsPager.GetAll successfully`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + listCatalogAuditsOptionsModel := &catalogmanagementv1.ListCatalogAuditsOptions{ + CatalogIdentifier: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + Lookupnames: core.BoolPtr(true), + } + + pager, err := catalogManagementService.NewCatalogAuditsPager(listCatalogAuditsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + allResults, err := pager.GetAll() + Expect(err).To(BeNil()) + Expect(allResults).ToNot(BeNil()) + Expect(len(allResults)).To(Equal(2)) + }) + }) }) - Describe(`GetConsumptionOfferings(getConsumptionOfferingsOptions *GetConsumptionOfferingsOptions) - Operation response error`, func() { - getConsumptionOfferingsPath := "/offerings" + Describe(`GetCatalogAudit(getCatalogAuditOptions *GetCatalogAuditOptions) - Operation response error`, func() { + getCatalogAuditPath := "/catalogs/testString/audits/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getConsumptionOfferingsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getCatalogAuditPath)) Expect(req.Method).To(Equal("GET")) - // TODO: Add check for digest query parameter - Expect(req.URL.Query()["catalog"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["select"]).To(Equal([]string{"all"})) - // TODO: Add check for includeHidden query parameter - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1000))})) - Expect(req.URL.Query()["offset"]).To(Equal([]string{fmt.Sprint(int64(38))})) + // TODO: Add check for lookupnames query parameter res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, `} this is not valid json {`) + fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetConsumptionOfferings with error: Operation response processing error`, func() { + It(`Invoke GetCatalogAudit with error: Operation response processing error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -2763,24 +3492,21 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the GetConsumptionOfferingsOptions model - getConsumptionOfferingsOptionsModel := new(catalogmanagementv1.GetConsumptionOfferingsOptions) - getConsumptionOfferingsOptionsModel.Digest = core.BoolPtr(true) - getConsumptionOfferingsOptionsModel.Catalog = core.StringPtr("testString") - getConsumptionOfferingsOptionsModel.Select = core.StringPtr("all") - getConsumptionOfferingsOptionsModel.IncludeHidden = core.BoolPtr(true) - getConsumptionOfferingsOptionsModel.Limit = core.Int64Ptr(int64(1000)) - getConsumptionOfferingsOptionsModel.Offset = core.Int64Ptr(int64(38)) - getConsumptionOfferingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetCatalogAuditOptions model + getCatalogAuditOptionsModel := new(catalogmanagementv1.GetCatalogAuditOptions) + getCatalogAuditOptionsModel.CatalogIdentifier = core.StringPtr("testString") + getCatalogAuditOptionsModel.AuditlogIdentifier = core.StringPtr("testString") + getCatalogAuditOptionsModel.Lookupnames = core.BoolPtr(true) + getCatalogAuditOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := catalogManagementService.GetConsumptionOfferings(getConsumptionOfferingsOptionsModel) + result, response, operationErr := catalogManagementService.GetCatalogAudit(getCatalogAuditOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again catalogManagementService.EnableRetries(0, 0) - result, response, operationErr = catalogManagementService.GetConsumptionOfferings(getConsumptionOfferingsOptionsModel) + result, response, operationErr = catalogManagementService.GetCatalogAudit(getCatalogAuditOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -2790,33 +3516,28 @@ var _ = Describe(`CatalogManagementV1`, func() { }) }) }) - Describe(`GetConsumptionOfferings(getConsumptionOfferingsOptions *GetConsumptionOfferingsOptions)`, func() { - getConsumptionOfferingsPath := "/offerings" + Describe(`GetCatalogAudit(getCatalogAuditOptions *GetCatalogAuditOptions)`, func() { + getCatalogAuditPath := "/catalogs/testString/audits/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getConsumptionOfferingsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getCatalogAuditPath)) Expect(req.Method).To(Equal("GET")) - // TODO: Add check for digest query parameter - Expect(req.URL.Query()["catalog"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["select"]).To(Equal([]string{"all"})) - // TODO: Add check for includeHidden query parameter - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1000))})) - Expect(req.URL.Query()["offset"]).To(Equal([]string{fmt.Sprint(int64(38))})) + // TODO: Add check for lookupnames query parameter // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"offset": 6, "limit": 5, "total_count": 10, "resource_count": 13, "first": "First", "last": "Last", "prev": "Prev", "next": "Next", "resources": [{"id": "ID", "_rev": "Rev", "url": "URL", "crn": "CRN", "label": "Label", "name": "Name", "offering_icon_url": "OfferingIconURL", "offering_docs_url": "OfferingDocsURL", "offering_support_url": "OfferingSupportURL", "tags": ["Tags"], "keywords": ["Keywords"], "rating": {"one_star_count": 12, "two_star_count": 12, "three_star_count": 14, "four_star_count": 13}, "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "short_description": "ShortDescription", "long_description": "LongDescription", "features": [{"title": "Title", "description": "Description"}], "kinds": [{"id": "ID", "format_kind": "FormatKind", "target_kind": "TargetKind", "metadata": {"mapKey": "anyValue"}, "install_description": "InstallDescription", "tags": ["Tags"], "additional_features": [{"title": "Title", "description": "Description"}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "versions": [{"id": "ID", "_rev": "Rev", "crn": "CRN", "version": "Version", "sha": "Sha", "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "offering_id": "OfferingID", "catalog_id": "CatalogID", "kind_id": "KindID", "tags": ["Tags"], "repo_url": "RepoURL", "source_url": "SourceURL", "tgz_url": "TgzURL", "configuration": [{"key": "Key", "type": "Type", "default_value": "anyValue", "value_constraint": "ValueConstraint", "description": "Description", "required": true, "options": ["anyValue"], "hidden": true}], "metadata": {"mapKey": "anyValue"}, "validation": {"validated": "2019-01-01T12:00:00.000Z", "requested": "2019-01-01T12:00:00.000Z", "state": "State", "last_operation": "LastOperation", "target": {"mapKey": "anyValue"}}, "required_resources": [{"type": "mem", "value": "anyValue"}], "single_instance": true, "install": {"instructions": "Instructions", "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}, "pre_install": [{"instructions": "Instructions", "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}], "entitlement": {"provider_name": "ProviderName", "provider_id": "ProviderID", "product_id": "ProductID", "part_numbers": ["PartNumbers"], "image_repo_name": "ImageRepoName"}, "licenses": [{"id": "ID", "name": "Name", "type": "Type", "url": "URL", "description": "Description"}], "image_manifest_url": "ImageManifestURL", "deprecated": true, "package_version": "PackageVersion", "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "version_locator": "VersionLocator", "console_url": "ConsoleURL", "long_description": "LongDescription", "whitelisted_accounts": ["WhitelistedAccounts"]}], "plans": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "additional_features": [{"title": "Title", "description": "Description"}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "deployments": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z"}]}]}], "permit_request_ibm_public_publish": false, "ibm_publish_approved": true, "public_publish_approved": false, "public_original_crn": "PublicOriginalCRN", "publish_public_crn": "PublishPublicCRN", "portal_approval_record": "PortalApprovalRecord", "portal_ui_url": "PortalUIURL", "catalog_id": "CatalogID", "catalog_name": "CatalogName", "metadata": {"mapKey": "anyValue"}, "disclaimer": "Disclaimer", "hidden": true, "provider": "Provider", "provider_info": {"id": "ID", "name": "Name"}, "repo_info": {"token": "Token", "type": "Type"}, "support": {"url": "URL", "process": "Process", "locations": ["Locations"]}, "media": [{"url": "URL", "caption": "Caption", "type": "Type", "thumbnail_url": "ThumbnailURL"}]}]}`) + fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "created": "2019-01-01T12:00:00.000Z", "change_type": "ChangeType", "target_type": "TargetType", "target_id": "TargetID", "who_email": "WhoEmail", "who_delegate_email": "WhoDelegateEmail", "message": "Message", "gid": "Gid", "who_id": "WhoID", "who_name": "WhoName", "who_delegate_id": "WhoDelegateID", "who_delegate_name": "WhoDelegateName", "data": "anyValue"}`) })) }) - It(`Invoke GetConsumptionOfferings successfully with retries`, func() { + It(`Invoke GetCatalogAudit successfully with retries`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -2825,26 +3546,23 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) catalogManagementService.EnableRetries(0, 0) - // Construct an instance of the GetConsumptionOfferingsOptions model - getConsumptionOfferingsOptionsModel := new(catalogmanagementv1.GetConsumptionOfferingsOptions) - getConsumptionOfferingsOptionsModel.Digest = core.BoolPtr(true) - getConsumptionOfferingsOptionsModel.Catalog = core.StringPtr("testString") - getConsumptionOfferingsOptionsModel.Select = core.StringPtr("all") - getConsumptionOfferingsOptionsModel.IncludeHidden = core.BoolPtr(true) - getConsumptionOfferingsOptionsModel.Limit = core.Int64Ptr(int64(1000)) - getConsumptionOfferingsOptionsModel.Offset = core.Int64Ptr(int64(38)) - getConsumptionOfferingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetCatalogAuditOptions model + getCatalogAuditOptionsModel := new(catalogmanagementv1.GetCatalogAuditOptions) + getCatalogAuditOptionsModel.CatalogIdentifier = core.StringPtr("testString") + getCatalogAuditOptionsModel.AuditlogIdentifier = core.StringPtr("testString") + getCatalogAuditOptionsModel.Lookupnames = core.BoolPtr(true) + getCatalogAuditOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := catalogManagementService.GetConsumptionOfferingsWithContext(ctx, getConsumptionOfferingsOptionsModel) + _, _, operationErr := catalogManagementService.GetCatalogAuditWithContext(ctx, getCatalogAuditOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again catalogManagementService.DisableRetries() - result, response, operationErr := catalogManagementService.GetConsumptionOfferings(getConsumptionOfferingsOptionsModel) + result, response, operationErr := catalogManagementService.GetCatalogAudit(getCatalogAuditOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -2852,7 +3570,7 @@ var _ = Describe(`CatalogManagementV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = catalogManagementService.GetConsumptionOfferingsWithContext(ctx, getConsumptionOfferingsOptionsModel) + _, _, operationErr = catalogManagementService.GetCatalogAuditWithContext(ctx, getCatalogAuditOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -2866,22 +3584,17 @@ var _ = Describe(`CatalogManagementV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getConsumptionOfferingsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getCatalogAuditPath)) Expect(req.Method).To(Equal("GET")) - // TODO: Add check for digest query parameter - Expect(req.URL.Query()["catalog"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["select"]).To(Equal([]string{"all"})) - // TODO: Add check for includeHidden query parameter - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1000))})) - Expect(req.URL.Query()["offset"]).To(Equal([]string{fmt.Sprint(int64(38))})) + // TODO: Add check for lookupnames query parameter // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"offset": 6, "limit": 5, "total_count": 10, "resource_count": 13, "first": "First", "last": "Last", "prev": "Prev", "next": "Next", "resources": [{"id": "ID", "_rev": "Rev", "url": "URL", "crn": "CRN", "label": "Label", "name": "Name", "offering_icon_url": "OfferingIconURL", "offering_docs_url": "OfferingDocsURL", "offering_support_url": "OfferingSupportURL", "tags": ["Tags"], "keywords": ["Keywords"], "rating": {"one_star_count": 12, "two_star_count": 12, "three_star_count": 14, "four_star_count": 13}, "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "short_description": "ShortDescription", "long_description": "LongDescription", "features": [{"title": "Title", "description": "Description"}], "kinds": [{"id": "ID", "format_kind": "FormatKind", "target_kind": "TargetKind", "metadata": {"mapKey": "anyValue"}, "install_description": "InstallDescription", "tags": ["Tags"], "additional_features": [{"title": "Title", "description": "Description"}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "versions": [{"id": "ID", "_rev": "Rev", "crn": "CRN", "version": "Version", "sha": "Sha", "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "offering_id": "OfferingID", "catalog_id": "CatalogID", "kind_id": "KindID", "tags": ["Tags"], "repo_url": "RepoURL", "source_url": "SourceURL", "tgz_url": "TgzURL", "configuration": [{"key": "Key", "type": "Type", "default_value": "anyValue", "value_constraint": "ValueConstraint", "description": "Description", "required": true, "options": ["anyValue"], "hidden": true}], "metadata": {"mapKey": "anyValue"}, "validation": {"validated": "2019-01-01T12:00:00.000Z", "requested": "2019-01-01T12:00:00.000Z", "state": "State", "last_operation": "LastOperation", "target": {"mapKey": "anyValue"}}, "required_resources": [{"type": "mem", "value": "anyValue"}], "single_instance": true, "install": {"instructions": "Instructions", "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}, "pre_install": [{"instructions": "Instructions", "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}], "entitlement": {"provider_name": "ProviderName", "provider_id": "ProviderID", "product_id": "ProductID", "part_numbers": ["PartNumbers"], "image_repo_name": "ImageRepoName"}, "licenses": [{"id": "ID", "name": "Name", "type": "Type", "url": "URL", "description": "Description"}], "image_manifest_url": "ImageManifestURL", "deprecated": true, "package_version": "PackageVersion", "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "version_locator": "VersionLocator", "console_url": "ConsoleURL", "long_description": "LongDescription", "whitelisted_accounts": ["WhitelistedAccounts"]}], "plans": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "additional_features": [{"title": "Title", "description": "Description"}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "deployments": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z"}]}]}], "permit_request_ibm_public_publish": false, "ibm_publish_approved": true, "public_publish_approved": false, "public_original_crn": "PublicOriginalCRN", "publish_public_crn": "PublishPublicCRN", "portal_approval_record": "PortalApprovalRecord", "portal_ui_url": "PortalUIURL", "catalog_id": "CatalogID", "catalog_name": "CatalogName", "metadata": {"mapKey": "anyValue"}, "disclaimer": "Disclaimer", "hidden": true, "provider": "Provider", "provider_info": {"id": "ID", "name": "Name"}, "repo_info": {"token": "Token", "type": "Type"}, "support": {"url": "URL", "process": "Process", "locations": ["Locations"]}, "media": [{"url": "URL", "caption": "Caption", "type": "Type", "thumbnail_url": "ThumbnailURL"}]}]}`) + fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "created": "2019-01-01T12:00:00.000Z", "change_type": "ChangeType", "target_type": "TargetType", "target_id": "TargetID", "who_email": "WhoEmail", "who_delegate_email": "WhoDelegateEmail", "message": "Message", "gid": "Gid", "who_id": "WhoID", "who_name": "WhoName", "who_delegate_id": "WhoDelegateID", "who_delegate_name": "WhoDelegateName", "data": "anyValue"}`) })) }) - It(`Invoke GetConsumptionOfferings successfully`, func() { + It(`Invoke GetCatalogAudit successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -2890,29 +3603,26 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := catalogManagementService.GetConsumptionOfferings(nil) + result, response, operationErr := catalogManagementService.GetCatalogAudit(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetConsumptionOfferingsOptions model - getConsumptionOfferingsOptionsModel := new(catalogmanagementv1.GetConsumptionOfferingsOptions) - getConsumptionOfferingsOptionsModel.Digest = core.BoolPtr(true) - getConsumptionOfferingsOptionsModel.Catalog = core.StringPtr("testString") - getConsumptionOfferingsOptionsModel.Select = core.StringPtr("all") - getConsumptionOfferingsOptionsModel.IncludeHidden = core.BoolPtr(true) - getConsumptionOfferingsOptionsModel.Limit = core.Int64Ptr(int64(1000)) - getConsumptionOfferingsOptionsModel.Offset = core.Int64Ptr(int64(38)) - getConsumptionOfferingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetCatalogAuditOptions model + getCatalogAuditOptionsModel := new(catalogmanagementv1.GetCatalogAuditOptions) + getCatalogAuditOptionsModel.CatalogIdentifier = core.StringPtr("testString") + getCatalogAuditOptionsModel.AuditlogIdentifier = core.StringPtr("testString") + getCatalogAuditOptionsModel.Lookupnames = core.BoolPtr(true) + getCatalogAuditOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = catalogManagementService.GetConsumptionOfferings(getConsumptionOfferingsOptionsModel) + result, response, operationErr = catalogManagementService.GetCatalogAudit(getCatalogAuditOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetConsumptionOfferings with error: Operation request error`, func() { + It(`Invoke GetCatalogAudit with error: Operation validation and request error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -2920,23 +3630,27 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the GetConsumptionOfferingsOptions model - getConsumptionOfferingsOptionsModel := new(catalogmanagementv1.GetConsumptionOfferingsOptions) - getConsumptionOfferingsOptionsModel.Digest = core.BoolPtr(true) - getConsumptionOfferingsOptionsModel.Catalog = core.StringPtr("testString") - getConsumptionOfferingsOptionsModel.Select = core.StringPtr("all") - getConsumptionOfferingsOptionsModel.IncludeHidden = core.BoolPtr(true) - getConsumptionOfferingsOptionsModel.Limit = core.Int64Ptr(int64(1000)) - getConsumptionOfferingsOptionsModel.Offset = core.Int64Ptr(int64(38)) - getConsumptionOfferingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetCatalogAuditOptions model + getCatalogAuditOptionsModel := new(catalogmanagementv1.GetCatalogAuditOptions) + getCatalogAuditOptionsModel.CatalogIdentifier = core.StringPtr("testString") + getCatalogAuditOptionsModel.AuditlogIdentifier = core.StringPtr("testString") + getCatalogAuditOptionsModel.Lookupnames = core.BoolPtr(true) + getCatalogAuditOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := catalogManagementService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := catalogManagementService.GetConsumptionOfferings(getConsumptionOfferingsOptionsModel) + result, response, operationErr := catalogManagementService.GetCatalogAudit(getCatalogAuditOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) + // Construct a second instance of the GetCatalogAuditOptions model with no property values + getCatalogAuditOptionsModelNew := new(catalogmanagementv1.GetCatalogAuditOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = catalogManagementService.GetCatalogAudit(getCatalogAuditOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -2951,7 +3665,7 @@ var _ = Describe(`CatalogManagementV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetConsumptionOfferings successfully`, func() { + It(`Invoke GetCatalogAudit successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -2959,18 +3673,15 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the GetConsumptionOfferingsOptions model - getConsumptionOfferingsOptionsModel := new(catalogmanagementv1.GetConsumptionOfferingsOptions) - getConsumptionOfferingsOptionsModel.Digest = core.BoolPtr(true) - getConsumptionOfferingsOptionsModel.Catalog = core.StringPtr("testString") - getConsumptionOfferingsOptionsModel.Select = core.StringPtr("all") - getConsumptionOfferingsOptionsModel.IncludeHidden = core.BoolPtr(true) - getConsumptionOfferingsOptionsModel.Limit = core.Int64Ptr(int64(1000)) - getConsumptionOfferingsOptionsModel.Offset = core.Int64Ptr(int64(38)) - getConsumptionOfferingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetCatalogAuditOptions model + getCatalogAuditOptionsModel := new(catalogmanagementv1.GetCatalogAuditOptions) + getCatalogAuditOptionsModel.CatalogIdentifier = core.StringPtr("testString") + getCatalogAuditOptionsModel.AuditlogIdentifier = core.StringPtr("testString") + getCatalogAuditOptionsModel.Lookupnames = core.BoolPtr(true) + getCatalogAuditOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := catalogManagementService.GetConsumptionOfferings(getConsumptionOfferingsOptionsModel) + result, response, operationErr := catalogManagementService.GetCatalogAudit(getCatalogAuditOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -2982,27 +3693,25 @@ var _ = Describe(`CatalogManagementV1`, func() { }) }) }) - Describe(`ListOfferings(listOfferingsOptions *ListOfferingsOptions) - Operation response error`, func() { - listOfferingsPath := "/catalogs/testString/offerings" + Describe(`ListEnterpriseAudits(listEnterpriseAuditsOptions *ListEnterpriseAuditsOptions) - Operation response error`, func() { + listEnterpriseAuditsPath := "/enterprises/testString/audits" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listOfferingsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listEnterpriseAuditsPath)) Expect(req.Method).To(Equal("GET")) - // TODO: Add check for digest query parameter - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1000))})) - Expect(req.URL.Query()["offset"]).To(Equal([]string{fmt.Sprint(int64(38))})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["sort"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + // TODO: Add check for lookupnames query parameter res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, `} this is not valid json {`) + fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListOfferings with error: Operation response processing error`, func() { + It(`Invoke ListEnterpriseAudits with error: Operation response processing error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -3010,24 +3719,22 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the ListOfferingsOptions model - listOfferingsOptionsModel := new(catalogmanagementv1.ListOfferingsOptions) - listOfferingsOptionsModel.CatalogIdentifier = core.StringPtr("testString") - listOfferingsOptionsModel.Digest = core.BoolPtr(true) - listOfferingsOptionsModel.Limit = core.Int64Ptr(int64(1000)) - listOfferingsOptionsModel.Offset = core.Int64Ptr(int64(38)) - listOfferingsOptionsModel.Name = core.StringPtr("testString") - listOfferingsOptionsModel.Sort = core.StringPtr("testString") - listOfferingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListEnterpriseAuditsOptions model + listEnterpriseAuditsOptionsModel := new(catalogmanagementv1.ListEnterpriseAuditsOptions) + listEnterpriseAuditsOptionsModel.EnterpriseIdentifier = core.StringPtr("testString") + listEnterpriseAuditsOptionsModel.Start = core.StringPtr("testString") + listEnterpriseAuditsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listEnterpriseAuditsOptionsModel.Lookupnames = core.BoolPtr(true) + listEnterpriseAuditsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := catalogManagementService.ListOfferings(listOfferingsOptionsModel) + result, response, operationErr := catalogManagementService.ListEnterpriseAudits(listEnterpriseAuditsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again catalogManagementService.EnableRetries(0, 0) - result, response, operationErr = catalogManagementService.ListOfferings(listOfferingsOptionsModel) + result, response, operationErr = catalogManagementService.ListEnterpriseAudits(listEnterpriseAuditsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -3037,32 +3744,30 @@ var _ = Describe(`CatalogManagementV1`, func() { }) }) }) - Describe(`ListOfferings(listOfferingsOptions *ListOfferingsOptions)`, func() { - listOfferingsPath := "/catalogs/testString/offerings" + Describe(`ListEnterpriseAudits(listEnterpriseAuditsOptions *ListEnterpriseAuditsOptions)`, func() { + listEnterpriseAuditsPath := "/enterprises/testString/audits" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listOfferingsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listEnterpriseAuditsPath)) Expect(req.Method).To(Equal("GET")) - // TODO: Add check for digest query parameter - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1000))})) - Expect(req.URL.Query()["offset"]).To(Equal([]string{fmt.Sprint(int64(38))})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["sort"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + // TODO: Add check for lookupnames query parameter // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"offset": 6, "limit": 5, "total_count": 10, "resource_count": 13, "first": "First", "last": "Last", "prev": "Prev", "next": "Next", "resources": [{"id": "ID", "_rev": "Rev", "url": "URL", "crn": "CRN", "label": "Label", "name": "Name", "offering_icon_url": "OfferingIconURL", "offering_docs_url": "OfferingDocsURL", "offering_support_url": "OfferingSupportURL", "tags": ["Tags"], "keywords": ["Keywords"], "rating": {"one_star_count": 12, "two_star_count": 12, "three_star_count": 14, "four_star_count": 13}, "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "short_description": "ShortDescription", "long_description": "LongDescription", "features": [{"title": "Title", "description": "Description"}], "kinds": [{"id": "ID", "format_kind": "FormatKind", "target_kind": "TargetKind", "metadata": {"mapKey": "anyValue"}, "install_description": "InstallDescription", "tags": ["Tags"], "additional_features": [{"title": "Title", "description": "Description"}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "versions": [{"id": "ID", "_rev": "Rev", "crn": "CRN", "version": "Version", "sha": "Sha", "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "offering_id": "OfferingID", "catalog_id": "CatalogID", "kind_id": "KindID", "tags": ["Tags"], "repo_url": "RepoURL", "source_url": "SourceURL", "tgz_url": "TgzURL", "configuration": [{"key": "Key", "type": "Type", "default_value": "anyValue", "value_constraint": "ValueConstraint", "description": "Description", "required": true, "options": ["anyValue"], "hidden": true}], "metadata": {"mapKey": "anyValue"}, "validation": {"validated": "2019-01-01T12:00:00.000Z", "requested": "2019-01-01T12:00:00.000Z", "state": "State", "last_operation": "LastOperation", "target": {"mapKey": "anyValue"}}, "required_resources": [{"type": "mem", "value": "anyValue"}], "single_instance": true, "install": {"instructions": "Instructions", "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}, "pre_install": [{"instructions": "Instructions", "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}], "entitlement": {"provider_name": "ProviderName", "provider_id": "ProviderID", "product_id": "ProductID", "part_numbers": ["PartNumbers"], "image_repo_name": "ImageRepoName"}, "licenses": [{"id": "ID", "name": "Name", "type": "Type", "url": "URL", "description": "Description"}], "image_manifest_url": "ImageManifestURL", "deprecated": true, "package_version": "PackageVersion", "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "version_locator": "VersionLocator", "console_url": "ConsoleURL", "long_description": "LongDescription", "whitelisted_accounts": ["WhitelistedAccounts"]}], "plans": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "additional_features": [{"title": "Title", "description": "Description"}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "deployments": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z"}]}]}], "permit_request_ibm_public_publish": false, "ibm_publish_approved": true, "public_publish_approved": false, "public_original_crn": "PublicOriginalCRN", "publish_public_crn": "PublishPublicCRN", "portal_approval_record": "PortalApprovalRecord", "portal_ui_url": "PortalUIURL", "catalog_id": "CatalogID", "catalog_name": "CatalogName", "metadata": {"mapKey": "anyValue"}, "disclaimer": "Disclaimer", "hidden": true, "provider": "Provider", "provider_info": {"id": "ID", "name": "Name"}, "repo_info": {"token": "Token", "type": "Type"}, "support": {"url": "URL", "process": "Process", "locations": ["Locations"]}, "media": [{"url": "URL", "caption": "Caption", "type": "Type", "thumbnail_url": "ThumbnailURL"}]}]}`) + fmt.Fprintf(res, "%s", `{"start": "Start", "limit": 5, "total_count": 10, "resource_count": 13, "first": {"href": "Href", "start": "Start"}, "next": {"href": "Href", "start": "Start"}, "prev": {"href": "Href", "start": "Start"}, "last": {"href": "Href", "start": "Start"}, "audits": [{"id": "ID", "_rev": "Rev", "created": "2019-01-01T12:00:00.000Z", "change_type": "ChangeType", "target_type": "TargetType", "target_id": "TargetID", "who_email": "WhoEmail", "who_delegate_email": "WhoDelegateEmail", "message": "Message"}]}`) })) }) - It(`Invoke ListOfferings successfully with retries`, func() { + It(`Invoke ListEnterpriseAudits successfully with retries`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -3071,26 +3776,24 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) catalogManagementService.EnableRetries(0, 0) - // Construct an instance of the ListOfferingsOptions model - listOfferingsOptionsModel := new(catalogmanagementv1.ListOfferingsOptions) - listOfferingsOptionsModel.CatalogIdentifier = core.StringPtr("testString") - listOfferingsOptionsModel.Digest = core.BoolPtr(true) - listOfferingsOptionsModel.Limit = core.Int64Ptr(int64(1000)) - listOfferingsOptionsModel.Offset = core.Int64Ptr(int64(38)) - listOfferingsOptionsModel.Name = core.StringPtr("testString") - listOfferingsOptionsModel.Sort = core.StringPtr("testString") - listOfferingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListEnterpriseAuditsOptions model + listEnterpriseAuditsOptionsModel := new(catalogmanagementv1.ListEnterpriseAuditsOptions) + listEnterpriseAuditsOptionsModel.EnterpriseIdentifier = core.StringPtr("testString") + listEnterpriseAuditsOptionsModel.Start = core.StringPtr("testString") + listEnterpriseAuditsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listEnterpriseAuditsOptionsModel.Lookupnames = core.BoolPtr(true) + listEnterpriseAuditsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := catalogManagementService.ListOfferingsWithContext(ctx, listOfferingsOptionsModel) + _, _, operationErr := catalogManagementService.ListEnterpriseAuditsWithContext(ctx, listEnterpriseAuditsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again catalogManagementService.DisableRetries() - result, response, operationErr := catalogManagementService.ListOfferings(listOfferingsOptionsModel) + result, response, operationErr := catalogManagementService.ListEnterpriseAudits(listEnterpriseAuditsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -3098,7 +3801,7 @@ var _ = Describe(`CatalogManagementV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = catalogManagementService.ListOfferingsWithContext(ctx, listOfferingsOptionsModel) + _, _, operationErr = catalogManagementService.ListEnterpriseAuditsWithContext(ctx, listEnterpriseAuditsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -3112,21 +3815,19 @@ var _ = Describe(`CatalogManagementV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listOfferingsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listEnterpriseAuditsPath)) Expect(req.Method).To(Equal("GET")) - // TODO: Add check for digest query parameter - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1000))})) - Expect(req.URL.Query()["offset"]).To(Equal([]string{fmt.Sprint(int64(38))})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["sort"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + // TODO: Add check for lookupnames query parameter // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"offset": 6, "limit": 5, "total_count": 10, "resource_count": 13, "first": "First", "last": "Last", "prev": "Prev", "next": "Next", "resources": [{"id": "ID", "_rev": "Rev", "url": "URL", "crn": "CRN", "label": "Label", "name": "Name", "offering_icon_url": "OfferingIconURL", "offering_docs_url": "OfferingDocsURL", "offering_support_url": "OfferingSupportURL", "tags": ["Tags"], "keywords": ["Keywords"], "rating": {"one_star_count": 12, "two_star_count": 12, "three_star_count": 14, "four_star_count": 13}, "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "short_description": "ShortDescription", "long_description": "LongDescription", "features": [{"title": "Title", "description": "Description"}], "kinds": [{"id": "ID", "format_kind": "FormatKind", "target_kind": "TargetKind", "metadata": {"mapKey": "anyValue"}, "install_description": "InstallDescription", "tags": ["Tags"], "additional_features": [{"title": "Title", "description": "Description"}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "versions": [{"id": "ID", "_rev": "Rev", "crn": "CRN", "version": "Version", "sha": "Sha", "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "offering_id": "OfferingID", "catalog_id": "CatalogID", "kind_id": "KindID", "tags": ["Tags"], "repo_url": "RepoURL", "source_url": "SourceURL", "tgz_url": "TgzURL", "configuration": [{"key": "Key", "type": "Type", "default_value": "anyValue", "value_constraint": "ValueConstraint", "description": "Description", "required": true, "options": ["anyValue"], "hidden": true}], "metadata": {"mapKey": "anyValue"}, "validation": {"validated": "2019-01-01T12:00:00.000Z", "requested": "2019-01-01T12:00:00.000Z", "state": "State", "last_operation": "LastOperation", "target": {"mapKey": "anyValue"}}, "required_resources": [{"type": "mem", "value": "anyValue"}], "single_instance": true, "install": {"instructions": "Instructions", "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}, "pre_install": [{"instructions": "Instructions", "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}], "entitlement": {"provider_name": "ProviderName", "provider_id": "ProviderID", "product_id": "ProductID", "part_numbers": ["PartNumbers"], "image_repo_name": "ImageRepoName"}, "licenses": [{"id": "ID", "name": "Name", "type": "Type", "url": "URL", "description": "Description"}], "image_manifest_url": "ImageManifestURL", "deprecated": true, "package_version": "PackageVersion", "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "version_locator": "VersionLocator", "console_url": "ConsoleURL", "long_description": "LongDescription", "whitelisted_accounts": ["WhitelistedAccounts"]}], "plans": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "additional_features": [{"title": "Title", "description": "Description"}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "deployments": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z"}]}]}], "permit_request_ibm_public_publish": false, "ibm_publish_approved": true, "public_publish_approved": false, "public_original_crn": "PublicOriginalCRN", "publish_public_crn": "PublishPublicCRN", "portal_approval_record": "PortalApprovalRecord", "portal_ui_url": "PortalUIURL", "catalog_id": "CatalogID", "catalog_name": "CatalogName", "metadata": {"mapKey": "anyValue"}, "disclaimer": "Disclaimer", "hidden": true, "provider": "Provider", "provider_info": {"id": "ID", "name": "Name"}, "repo_info": {"token": "Token", "type": "Type"}, "support": {"url": "URL", "process": "Process", "locations": ["Locations"]}, "media": [{"url": "URL", "caption": "Caption", "type": "Type", "thumbnail_url": "ThumbnailURL"}]}]}`) + fmt.Fprintf(res, "%s", `{"start": "Start", "limit": 5, "total_count": 10, "resource_count": 13, "first": {"href": "Href", "start": "Start"}, "next": {"href": "Href", "start": "Start"}, "prev": {"href": "Href", "start": "Start"}, "last": {"href": "Href", "start": "Start"}, "audits": [{"id": "ID", "_rev": "Rev", "created": "2019-01-01T12:00:00.000Z", "change_type": "ChangeType", "target_type": "TargetType", "target_id": "TargetID", "who_email": "WhoEmail", "who_delegate_email": "WhoDelegateEmail", "message": "Message"}]}`) })) }) - It(`Invoke ListOfferings successfully`, func() { + It(`Invoke ListEnterpriseAudits successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -3135,29 +3836,27 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := catalogManagementService.ListOfferings(nil) + result, response, operationErr := catalogManagementService.ListEnterpriseAudits(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListOfferingsOptions model - listOfferingsOptionsModel := new(catalogmanagementv1.ListOfferingsOptions) - listOfferingsOptionsModel.CatalogIdentifier = core.StringPtr("testString") - listOfferingsOptionsModel.Digest = core.BoolPtr(true) - listOfferingsOptionsModel.Limit = core.Int64Ptr(int64(1000)) - listOfferingsOptionsModel.Offset = core.Int64Ptr(int64(38)) - listOfferingsOptionsModel.Name = core.StringPtr("testString") - listOfferingsOptionsModel.Sort = core.StringPtr("testString") - listOfferingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListEnterpriseAuditsOptions model + listEnterpriseAuditsOptionsModel := new(catalogmanagementv1.ListEnterpriseAuditsOptions) + listEnterpriseAuditsOptionsModel.EnterpriseIdentifier = core.StringPtr("testString") + listEnterpriseAuditsOptionsModel.Start = core.StringPtr("testString") + listEnterpriseAuditsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listEnterpriseAuditsOptionsModel.Lookupnames = core.BoolPtr(true) + listEnterpriseAuditsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = catalogManagementService.ListOfferings(listOfferingsOptionsModel) + result, response, operationErr = catalogManagementService.ListEnterpriseAudits(listEnterpriseAuditsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListOfferings with error: Operation validation and request error`, func() { + It(`Invoke ListEnterpriseAudits with error: Operation validation and request error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -3165,27 +3864,25 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the ListOfferingsOptions model - listOfferingsOptionsModel := new(catalogmanagementv1.ListOfferingsOptions) - listOfferingsOptionsModel.CatalogIdentifier = core.StringPtr("testString") - listOfferingsOptionsModel.Digest = core.BoolPtr(true) - listOfferingsOptionsModel.Limit = core.Int64Ptr(int64(1000)) - listOfferingsOptionsModel.Offset = core.Int64Ptr(int64(38)) - listOfferingsOptionsModel.Name = core.StringPtr("testString") - listOfferingsOptionsModel.Sort = core.StringPtr("testString") - listOfferingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListEnterpriseAuditsOptions model + listEnterpriseAuditsOptionsModel := new(catalogmanagementv1.ListEnterpriseAuditsOptions) + listEnterpriseAuditsOptionsModel.EnterpriseIdentifier = core.StringPtr("testString") + listEnterpriseAuditsOptionsModel.Start = core.StringPtr("testString") + listEnterpriseAuditsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listEnterpriseAuditsOptionsModel.Lookupnames = core.BoolPtr(true) + listEnterpriseAuditsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := catalogManagementService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := catalogManagementService.ListOfferings(listOfferingsOptionsModel) + result, response, operationErr := catalogManagementService.ListEnterpriseAudits(listEnterpriseAuditsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the ListOfferingsOptions model with no property values - listOfferingsOptionsModelNew := new(catalogmanagementv1.ListOfferingsOptions) + // Construct a second instance of the ListEnterpriseAuditsOptions model with no property values + listEnterpriseAuditsOptionsModelNew := new(catalogmanagementv1.ListEnterpriseAuditsOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = catalogManagementService.ListOfferings(listOfferingsOptionsModelNew) + result, response, operationErr = catalogManagementService.ListEnterpriseAudits(listEnterpriseAuditsOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -3203,7 +3900,7 @@ var _ = Describe(`CatalogManagementV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListOfferings successfully`, func() { + It(`Invoke ListEnterpriseAudits successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -3211,18 +3908,16 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the ListOfferingsOptions model - listOfferingsOptionsModel := new(catalogmanagementv1.ListOfferingsOptions) - listOfferingsOptionsModel.CatalogIdentifier = core.StringPtr("testString") - listOfferingsOptionsModel.Digest = core.BoolPtr(true) - listOfferingsOptionsModel.Limit = core.Int64Ptr(int64(1000)) - listOfferingsOptionsModel.Offset = core.Int64Ptr(int64(38)) - listOfferingsOptionsModel.Name = core.StringPtr("testString") - listOfferingsOptionsModel.Sort = core.StringPtr("testString") - listOfferingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListEnterpriseAuditsOptions model + listEnterpriseAuditsOptionsModel := new(catalogmanagementv1.ListEnterpriseAuditsOptions) + listEnterpriseAuditsOptionsModel.EnterpriseIdentifier = core.StringPtr("testString") + listEnterpriseAuditsOptionsModel.Start = core.StringPtr("testString") + listEnterpriseAuditsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listEnterpriseAuditsOptionsModel.Lookupnames = core.BoolPtr(true) + listEnterpriseAuditsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := catalogManagementService.ListOfferings(listOfferingsOptionsModel) + result, response, operationErr := catalogManagementService.ListEnterpriseAudits(listEnterpriseAuditsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -3233,23 +3928,49 @@ var _ = Describe(`CatalogManagementV1`, func() { testServer.Close() }) }) - }) - Describe(`CreateOffering(createOfferingOptions *CreateOfferingOptions) - Operation response error`, func() { - createOfferingPath := "/catalogs/testString/offerings" - Context(`Using mock server endpoint with invalid JSON response`, func() { + Context(`Test pagination helper method on response`, func() { + It(`Invoke GetNextStart successfully`, func() { + responseObject := new(catalogmanagementv1.AuditLogs) + nextObject := new(catalogmanagementv1.PaginationTokenLink) + nextObject.Start = core.StringPtr("abc-123") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(Equal(core.StringPtr("abc-123"))) + }) + It(`Invoke GetNextStart without a "Next" property in the response`, func() { + responseObject := new(catalogmanagementv1.AuditLogs) + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + Context(`Using mock server endpoint - paginated response`, func() { BeforeEach(func() { + var requestNumber int = 0 testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createOfferingPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(listEnterpriseAuditsPath)) + Expect(req.Method).To(Equal("GET")) + + // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, `} this is not valid json {`) + res.WriteHeader(200) + requestNumber++ + if requestNumber == 1 { + fmt.Fprintf(res, "%s", `{"next":{"start":"1"},"total_count":2,"limit":1,"audits":[{"id":"ID","_rev":"Rev","created":"2019-01-01T12:00:00.000Z","change_type":"ChangeType","target_type":"TargetType","target_id":"TargetID","who_email":"WhoEmail","who_delegate_email":"WhoDelegateEmail","message":"Message"}]}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"audits":[{"id":"ID","_rev":"Rev","created":"2019-01-01T12:00:00.000Z","change_type":"ChangeType","target_type":"TargetType","target_id":"TargetID","who_email":"WhoEmail","who_delegate_email":"WhoDelegateEmail","message":"Message"}]}`) + } else { + res.WriteHeader(400) + } })) }) - It(`Invoke CreateOffering with error: Operation response processing error`, func() { + It(`Use EnterpriseAuditsPager.GetNext successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -3257,219 +3978,322 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the Rating model - ratingModel := new(catalogmanagementv1.Rating) - ratingModel.OneStarCount = core.Int64Ptr(int64(38)) - ratingModel.TwoStarCount = core.Int64Ptr(int64(38)) - ratingModel.ThreeStarCount = core.Int64Ptr(int64(38)) - ratingModel.FourStarCount = core.Int64Ptr(int64(38)) - - // Construct an instance of the Feature model - featureModel := new(catalogmanagementv1.Feature) - featureModel.Title = core.StringPtr("testString") - featureModel.Description = core.StringPtr("testString") + listEnterpriseAuditsOptionsModel := &catalogmanagementv1.ListEnterpriseAuditsOptions{ + EnterpriseIdentifier: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + Lookupnames: core.BoolPtr(true), + } - // Construct an instance of the Configuration model - configurationModel := new(catalogmanagementv1.Configuration) - configurationModel.Key = core.StringPtr("testString") - configurationModel.Type = core.StringPtr("testString") - configurationModel.DefaultValue = core.StringPtr("testString") - configurationModel.ValueConstraint = core.StringPtr("testString") - configurationModel.Description = core.StringPtr("testString") - configurationModel.Required = core.BoolPtr(true) - configurationModel.Options = []interface{}{"testString"} - configurationModel.Hidden = core.BoolPtr(true) + pager, err := catalogManagementService.NewEnterpriseAuditsPager(listEnterpriseAuditsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []catalogmanagementv1.AuditLogDigest + for pager.HasNext() { + nextPage, err := pager.GetNext() + Expect(err).To(BeNil()) + Expect(nextPage).ToNot(BeNil()) + allResults = append(allResults, nextPage...) + } + Expect(len(allResults)).To(Equal(2)) + }) + It(`Use EnterpriseAuditsPager.GetAll successfully`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the Validation model - validationModel := new(catalogmanagementv1.Validation) - validationModel.Validated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - validationModel.Requested = CreateMockDateTime("2019-01-01T12:00:00.000Z") - validationModel.State = core.StringPtr("testString") - validationModel.LastOperation = core.StringPtr("testString") - validationModel.Target = make(map[string]interface{}) + listEnterpriseAuditsOptionsModel := &catalogmanagementv1.ListEnterpriseAuditsOptions{ + EnterpriseIdentifier: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + Lookupnames: core.BoolPtr(true), + } - // Construct an instance of the Resource model - resourceModel := new(catalogmanagementv1.Resource) - resourceModel.Type = core.StringPtr("mem") - resourceModel.Value = core.StringPtr("testString") + pager, err := catalogManagementService.NewEnterpriseAuditsPager(listEnterpriseAuditsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) - // Construct an instance of the Script model - scriptModel := new(catalogmanagementv1.Script) - scriptModel.Instructions = core.StringPtr("testString") - scriptModel.Script = core.StringPtr("testString") - scriptModel.ScriptPermission = core.StringPtr("testString") - scriptModel.DeleteScript = core.StringPtr("testString") - scriptModel.Scope = core.StringPtr("testString") + allResults, err := pager.GetAll() + Expect(err).To(BeNil()) + Expect(allResults).ToNot(BeNil()) + Expect(len(allResults)).To(Equal(2)) + }) + }) + }) + Describe(`GetEnterpriseAudit(getEnterpriseAuditOptions *GetEnterpriseAuditOptions) - Operation response error`, func() { + getEnterpriseAuditPath := "/enterprises/testString/audits/testString" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() - // Construct an instance of the VersionEntitlement model - versionEntitlementModel := new(catalogmanagementv1.VersionEntitlement) - versionEntitlementModel.ProviderName = core.StringPtr("testString") - versionEntitlementModel.ProviderID = core.StringPtr("testString") - versionEntitlementModel.ProductID = core.StringPtr("testString") - versionEntitlementModel.PartNumbers = []string{"testString"} - versionEntitlementModel.ImageRepoName = core.StringPtr("testString") + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getEnterpriseAuditPath)) + Expect(req.Method).To(Equal("GET")) + // TODO: Add check for lookupnames query parameter + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke GetEnterpriseAudit with error: Operation response processing error`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the License model - licenseModel := new(catalogmanagementv1.License) - licenseModel.ID = core.StringPtr("testString") - licenseModel.Name = core.StringPtr("testString") - licenseModel.Type = core.StringPtr("testString") - licenseModel.URL = core.StringPtr("testString") - licenseModel.Description = core.StringPtr("testString") + // Construct an instance of the GetEnterpriseAuditOptions model + getEnterpriseAuditOptionsModel := new(catalogmanagementv1.GetEnterpriseAuditOptions) + getEnterpriseAuditOptionsModel.EnterpriseIdentifier = core.StringPtr("testString") + getEnterpriseAuditOptionsModel.AuditlogIdentifier = core.StringPtr("testString") + getEnterpriseAuditOptionsModel.Lookupnames = core.BoolPtr(true) + getEnterpriseAuditOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := catalogManagementService.GetEnterpriseAudit(getEnterpriseAuditOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) - // Construct an instance of the State model - stateModel := new(catalogmanagementv1.State) - stateModel.Current = core.StringPtr("testString") - stateModel.CurrentEntered = CreateMockDateTime("2019-01-01T12:00:00.000Z") - stateModel.Pending = core.StringPtr("testString") - stateModel.PendingRequested = CreateMockDateTime("2019-01-01T12:00:00.000Z") - stateModel.Previous = core.StringPtr("testString") + // Enable retries and test again + catalogManagementService.EnableRetries(0, 0) + result, response, operationErr = catalogManagementService.GetEnterpriseAudit(getEnterpriseAuditOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetEnterpriseAudit(getEnterpriseAuditOptions *GetEnterpriseAuditOptions)`, func() { + getEnterpriseAuditPath := "/enterprises/testString/audits/testString" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() - // Construct an instance of the Version model - versionModel := new(catalogmanagementv1.Version) - versionModel.ID = core.StringPtr("testString") - versionModel.Rev = core.StringPtr("testString") - versionModel.CRN = core.StringPtr("testString") - versionModel.Version = core.StringPtr("testString") - versionModel.Sha = core.StringPtr("testString") - versionModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") - versionModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - versionModel.OfferingID = core.StringPtr("testString") - versionModel.CatalogID = core.StringPtr("testString") - versionModel.KindID = core.StringPtr("testString") - versionModel.Tags = []string{"testString"} - versionModel.RepoURL = core.StringPtr("testString") - versionModel.SourceURL = core.StringPtr("testString") - versionModel.TgzURL = core.StringPtr("testString") - versionModel.Configuration = []catalogmanagementv1.Configuration{*configurationModel} - versionModel.Metadata = make(map[string]interface{}) - versionModel.Validation = validationModel - versionModel.RequiredResources = []catalogmanagementv1.Resource{*resourceModel} - versionModel.SingleInstance = core.BoolPtr(true) - versionModel.Install = scriptModel - versionModel.PreInstall = []catalogmanagementv1.Script{*scriptModel} - versionModel.Entitlement = versionEntitlementModel - versionModel.Licenses = []catalogmanagementv1.License{*licenseModel} - versionModel.ImageManifestURL = core.StringPtr("testString") - versionModel.Deprecated = core.BoolPtr(true) - versionModel.PackageVersion = core.StringPtr("testString") - versionModel.State = stateModel - versionModel.VersionLocator = core.StringPtr("testString") - versionModel.ConsoleURL = core.StringPtr("testString") - versionModel.LongDescription = core.StringPtr("testString") - versionModel.WhitelistedAccounts = []string{"testString"} + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getEnterpriseAuditPath)) + Expect(req.Method).To(Equal("GET")) - // Construct an instance of the Deployment model - deploymentModel := new(catalogmanagementv1.Deployment) - deploymentModel.ID = core.StringPtr("testString") - deploymentModel.Label = core.StringPtr("testString") - deploymentModel.Name = core.StringPtr("testString") - deploymentModel.ShortDescription = core.StringPtr("testString") - deploymentModel.LongDescription = core.StringPtr("testString") - deploymentModel.Metadata = make(map[string]interface{}) - deploymentModel.Tags = []string{"testString"} - deploymentModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") - deploymentModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + // TODO: Add check for lookupnames query parameter + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) - // Construct an instance of the Plan model - planModel := new(catalogmanagementv1.Plan) - planModel.ID = core.StringPtr("testString") - planModel.Label = core.StringPtr("testString") - planModel.Name = core.StringPtr("testString") - planModel.ShortDescription = core.StringPtr("testString") - planModel.LongDescription = core.StringPtr("testString") - planModel.Metadata = make(map[string]interface{}) - planModel.Tags = []string{"testString"} - planModel.AdditionalFeatures = []catalogmanagementv1.Feature{*featureModel} - planModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") - planModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - planModel.Deployments = []catalogmanagementv1.Deployment{*deploymentModel} + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "created": "2019-01-01T12:00:00.000Z", "change_type": "ChangeType", "target_type": "TargetType", "target_id": "TargetID", "who_email": "WhoEmail", "who_delegate_email": "WhoDelegateEmail", "message": "Message", "gid": "Gid", "who_id": "WhoID", "who_name": "WhoName", "who_delegate_id": "WhoDelegateID", "who_delegate_name": "WhoDelegateName", "data": "anyValue"}`) + })) + }) + It(`Invoke GetEnterpriseAudit successfully with retries`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + catalogManagementService.EnableRetries(0, 0) - // Construct an instance of the Kind model - kindModel := new(catalogmanagementv1.Kind) - kindModel.ID = core.StringPtr("testString") - kindModel.FormatKind = core.StringPtr("testString") - kindModel.TargetKind = core.StringPtr("testString") - kindModel.Metadata = make(map[string]interface{}) - kindModel.InstallDescription = core.StringPtr("testString") - kindModel.Tags = []string{"testString"} - kindModel.AdditionalFeatures = []catalogmanagementv1.Feature{*featureModel} - kindModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") - kindModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - kindModel.Versions = []catalogmanagementv1.Version{*versionModel} - kindModel.Plans = []catalogmanagementv1.Plan{*planModel} + // Construct an instance of the GetEnterpriseAuditOptions model + getEnterpriseAuditOptionsModel := new(catalogmanagementv1.GetEnterpriseAuditOptions) + getEnterpriseAuditOptionsModel.EnterpriseIdentifier = core.StringPtr("testString") + getEnterpriseAuditOptionsModel.AuditlogIdentifier = core.StringPtr("testString") + getEnterpriseAuditOptionsModel.Lookupnames = core.BoolPtr(true) + getEnterpriseAuditOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Construct an instance of the ProviderInfo model - providerInfoModel := new(catalogmanagementv1.ProviderInfo) - providerInfoModel.ID = core.StringPtr("testString") - providerInfoModel.Name = core.StringPtr("testString") + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := catalogManagementService.GetEnterpriseAuditWithContext(ctx, getEnterpriseAuditOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - // Construct an instance of the RepoInfo model - repoInfoModel := new(catalogmanagementv1.RepoInfo) - repoInfoModel.Token = core.StringPtr("testString") - repoInfoModel.Type = core.StringPtr("testString") + // Disable retries and test again + catalogManagementService.DisableRetries() + result, response, operationErr := catalogManagementService.GetEnterpriseAudit(getEnterpriseAuditOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) - // Construct an instance of the Support model - supportModel := new(catalogmanagementv1.Support) - supportModel.URL = core.StringPtr("testString") - supportModel.Process = core.StringPtr("testString") - supportModel.Locations = []string{"testString"} + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = catalogManagementService.GetEnterpriseAuditWithContext(ctx, getEnterpriseAuditOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() - // Construct an instance of the MediaItem model - mediaItemModel := new(catalogmanagementv1.MediaItem) - mediaItemModel.URL = core.StringPtr("testString") - mediaItemModel.Caption = core.StringPtr("testString") - mediaItemModel.Type = core.StringPtr("testString") - mediaItemModel.ThumbnailURL = core.StringPtr("testString") + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getEnterpriseAuditPath)) + Expect(req.Method).To(Equal("GET")) - // Construct an instance of the CreateOfferingOptions model - createOfferingOptionsModel := new(catalogmanagementv1.CreateOfferingOptions) - createOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") - createOfferingOptionsModel.ID = core.StringPtr("testString") - createOfferingOptionsModel.Rev = core.StringPtr("testString") - createOfferingOptionsModel.URL = core.StringPtr("testString") - createOfferingOptionsModel.CRN = core.StringPtr("testString") - createOfferingOptionsModel.Label = core.StringPtr("testString") - createOfferingOptionsModel.Name = core.StringPtr("testString") - createOfferingOptionsModel.OfferingIconURL = core.StringPtr("testString") - createOfferingOptionsModel.OfferingDocsURL = core.StringPtr("testString") - createOfferingOptionsModel.OfferingSupportURL = core.StringPtr("testString") - createOfferingOptionsModel.Tags = []string{"testString"} - createOfferingOptionsModel.Keywords = []string{"testString"} - createOfferingOptionsModel.Rating = ratingModel - createOfferingOptionsModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") - createOfferingOptionsModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - createOfferingOptionsModel.ShortDescription = core.StringPtr("testString") - createOfferingOptionsModel.LongDescription = core.StringPtr("testString") - createOfferingOptionsModel.Features = []catalogmanagementv1.Feature{*featureModel} - createOfferingOptionsModel.Kinds = []catalogmanagementv1.Kind{*kindModel} - createOfferingOptionsModel.PermitRequestIBMPublicPublish = core.BoolPtr(true) - createOfferingOptionsModel.IBMPublishApproved = core.BoolPtr(true) - createOfferingOptionsModel.PublicPublishApproved = core.BoolPtr(true) - createOfferingOptionsModel.PublicOriginalCRN = core.StringPtr("testString") - createOfferingOptionsModel.PublishPublicCRN = core.StringPtr("testString") - createOfferingOptionsModel.PortalApprovalRecord = core.StringPtr("testString") - createOfferingOptionsModel.PortalUIURL = core.StringPtr("testString") - createOfferingOptionsModel.CatalogID = core.StringPtr("testString") - createOfferingOptionsModel.CatalogName = core.StringPtr("testString") - createOfferingOptionsModel.Metadata = make(map[string]interface{}) - createOfferingOptionsModel.Disclaimer = core.StringPtr("testString") - createOfferingOptionsModel.Hidden = core.BoolPtr(true) - createOfferingOptionsModel.Provider = core.StringPtr("testString") - createOfferingOptionsModel.ProviderInfo = providerInfoModel - createOfferingOptionsModel.RepoInfo = repoInfoModel - createOfferingOptionsModel.Support = supportModel - createOfferingOptionsModel.Media = []catalogmanagementv1.MediaItem{*mediaItemModel} - createOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // TODO: Add check for lookupnames query parameter + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "created": "2019-01-01T12:00:00.000Z", "change_type": "ChangeType", "target_type": "TargetType", "target_id": "TargetID", "who_email": "WhoEmail", "who_delegate_email": "WhoDelegateEmail", "message": "Message", "gid": "Gid", "who_id": "WhoID", "who_name": "WhoName", "who_delegate_id": "WhoDelegateID", "who_delegate_name": "WhoDelegateName", "data": "anyValue"}`) + })) + }) + It(`Invoke GetEnterpriseAudit successfully`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := catalogManagementService.GetEnterpriseAudit(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetEnterpriseAuditOptions model + getEnterpriseAuditOptionsModel := new(catalogmanagementv1.GetEnterpriseAuditOptions) + getEnterpriseAuditOptionsModel.EnterpriseIdentifier = core.StringPtr("testString") + getEnterpriseAuditOptionsModel.AuditlogIdentifier = core.StringPtr("testString") + getEnterpriseAuditOptionsModel.Lookupnames = core.BoolPtr(true) + getEnterpriseAuditOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = catalogManagementService.GetEnterpriseAudit(getEnterpriseAuditOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetEnterpriseAudit with error: Operation validation and request error`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Construct an instance of the GetEnterpriseAuditOptions model + getEnterpriseAuditOptionsModel := new(catalogmanagementv1.GetEnterpriseAuditOptions) + getEnterpriseAuditOptionsModel.EnterpriseIdentifier = core.StringPtr("testString") + getEnterpriseAuditOptionsModel.AuditlogIdentifier = core.StringPtr("testString") + getEnterpriseAuditOptionsModel.Lookupnames = core.BoolPtr(true) + getEnterpriseAuditOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := catalogManagementService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := catalogManagementService.GetEnterpriseAudit(getEnterpriseAuditOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the GetEnterpriseAuditOptions model with no property values + getEnterpriseAuditOptionsModelNew := new(catalogmanagementv1.GetEnterpriseAuditOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = catalogManagementService.GetEnterpriseAudit(getEnterpriseAuditOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke GetEnterpriseAudit successfully`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Construct an instance of the GetEnterpriseAuditOptions model + getEnterpriseAuditOptionsModel := new(catalogmanagementv1.GetEnterpriseAuditOptions) + getEnterpriseAuditOptionsModel.EnterpriseIdentifier = core.StringPtr("testString") + getEnterpriseAuditOptionsModel.AuditlogIdentifier = core.StringPtr("testString") + getEnterpriseAuditOptionsModel.Lookupnames = core.BoolPtr(true) + getEnterpriseAuditOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := catalogManagementService.GetEnterpriseAudit(getEnterpriseAuditOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetConsumptionOfferings(getConsumptionOfferingsOptions *GetConsumptionOfferingsOptions) - Operation response error`, func() { + getConsumptionOfferingsPath := "/offerings" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getConsumptionOfferingsPath)) + Expect(req.Method).To(Equal("GET")) + // TODO: Add check for digest query parameter + Expect(req.URL.Query()["catalog"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["select"]).To(Equal([]string{"all"})) + // TODO: Add check for includeHidden query parameter + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1000))})) + Expect(req.URL.Query()["offset"]).To(Equal([]string{fmt.Sprint(int64(38))})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke GetConsumptionOfferings with error: Operation response processing error`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Construct an instance of the GetConsumptionOfferingsOptions model + getConsumptionOfferingsOptionsModel := new(catalogmanagementv1.GetConsumptionOfferingsOptions) + getConsumptionOfferingsOptionsModel.Digest = core.BoolPtr(true) + getConsumptionOfferingsOptionsModel.Catalog = core.StringPtr("testString") + getConsumptionOfferingsOptionsModel.Select = core.StringPtr("all") + getConsumptionOfferingsOptionsModel.IncludeHidden = core.BoolPtr(true) + getConsumptionOfferingsOptionsModel.Limit = core.Int64Ptr(int64(1000)) + getConsumptionOfferingsOptionsModel.Offset = core.Int64Ptr(int64(38)) + getConsumptionOfferingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := catalogManagementService.CreateOffering(createOfferingOptionsModel) + result, response, operationErr := catalogManagementService.GetConsumptionOfferings(getConsumptionOfferingsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again catalogManagementService.EnableRetries(0, 0) - result, response, operationErr = catalogManagementService.CreateOffering(createOfferingOptionsModel) + result, response, operationErr = catalogManagementService.GetConsumptionOfferings(getConsumptionOfferingsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -3479,43 +4303,33 @@ var _ = Describe(`CatalogManagementV1`, func() { }) }) }) - Describe(`CreateOffering(createOfferingOptions *CreateOfferingOptions)`, func() { - createOfferingPath := "/catalogs/testString/offerings" + Describe(`GetConsumptionOfferings(getConsumptionOfferingsOptions *GetConsumptionOfferingsOptions)`, func() { + getConsumptionOfferingsPath := "/offerings" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createOfferingPath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(getConsumptionOfferingsPath)) + Expect(req.Method).To(Equal("GET")) + // TODO: Add check for digest query parameter + Expect(req.URL.Query()["catalog"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["select"]).To(Equal([]string{"all"})) + // TODO: Add check for includeHidden query parameter + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1000))})) + Expect(req.URL.Query()["offset"]).To(Equal([]string{fmt.Sprint(int64(38))})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "url": "URL", "crn": "CRN", "label": "Label", "name": "Name", "offering_icon_url": "OfferingIconURL", "offering_docs_url": "OfferingDocsURL", "offering_support_url": "OfferingSupportURL", "tags": ["Tags"], "keywords": ["Keywords"], "rating": {"one_star_count": 12, "two_star_count": 12, "three_star_count": 14, "four_star_count": 13}, "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "short_description": "ShortDescription", "long_description": "LongDescription", "features": [{"title": "Title", "description": "Description"}], "kinds": [{"id": "ID", "format_kind": "FormatKind", "target_kind": "TargetKind", "metadata": {"mapKey": "anyValue"}, "install_description": "InstallDescription", "tags": ["Tags"], "additional_features": [{"title": "Title", "description": "Description"}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "versions": [{"id": "ID", "_rev": "Rev", "crn": "CRN", "version": "Version", "sha": "Sha", "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "offering_id": "OfferingID", "catalog_id": "CatalogID", "kind_id": "KindID", "tags": ["Tags"], "repo_url": "RepoURL", "source_url": "SourceURL", "tgz_url": "TgzURL", "configuration": [{"key": "Key", "type": "Type", "default_value": "anyValue", "value_constraint": "ValueConstraint", "description": "Description", "required": true, "options": ["anyValue"], "hidden": true}], "metadata": {"mapKey": "anyValue"}, "validation": {"validated": "2019-01-01T12:00:00.000Z", "requested": "2019-01-01T12:00:00.000Z", "state": "State", "last_operation": "LastOperation", "target": {"mapKey": "anyValue"}}, "required_resources": [{"type": "mem", "value": "anyValue"}], "single_instance": true, "install": {"instructions": "Instructions", "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}, "pre_install": [{"instructions": "Instructions", "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}], "entitlement": {"provider_name": "ProviderName", "provider_id": "ProviderID", "product_id": "ProductID", "part_numbers": ["PartNumbers"], "image_repo_name": "ImageRepoName"}, "licenses": [{"id": "ID", "name": "Name", "type": "Type", "url": "URL", "description": "Description"}], "image_manifest_url": "ImageManifestURL", "deprecated": true, "package_version": "PackageVersion", "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "version_locator": "VersionLocator", "console_url": "ConsoleURL", "long_description": "LongDescription", "whitelisted_accounts": ["WhitelistedAccounts"]}], "plans": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "additional_features": [{"title": "Title", "description": "Description"}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "deployments": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z"}]}]}], "permit_request_ibm_public_publish": false, "ibm_publish_approved": true, "public_publish_approved": false, "public_original_crn": "PublicOriginalCRN", "publish_public_crn": "PublishPublicCRN", "portal_approval_record": "PortalApprovalRecord", "portal_ui_url": "PortalUIURL", "catalog_id": "CatalogID", "catalog_name": "CatalogName", "metadata": {"mapKey": "anyValue"}, "disclaimer": "Disclaimer", "hidden": true, "provider": "Provider", "provider_info": {"id": "ID", "name": "Name"}, "repo_info": {"token": "Token", "type": "Type"}, "support": {"url": "URL", "process": "Process", "locations": ["Locations"]}, "media": [{"url": "URL", "caption": "Caption", "type": "Type", "thumbnail_url": "ThumbnailURL"}]}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"offset": 6, "limit": 5, "total_count": 10, "resource_count": 13, "first": "First", "last": "Last", "prev": "Prev", "next": "Next", "resources": [{"id": "ID", "_rev": "Rev", "url": "URL", "crn": "CRN", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "name": "Name", "offering_icon_url": "OfferingIconURL", "offering_docs_url": "OfferingDocsURL", "offering_support_url": "OfferingSupportURL", "tags": ["Tags"], "keywords": ["Keywords"], "rating": {"one_star_count": 12, "two_star_count": 12, "three_star_count": 14, "four_star_count": 13}, "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "short_description": "ShortDescription", "short_description_i18n": {"mapKey": "Inner"}, "long_description": "LongDescription", "long_description_i18n": {"mapKey": "Inner"}, "features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "kinds": [{"id": "ID", "format_kind": "FormatKind", "install_kind": "InstallKind", "target_kind": "TargetKind", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "additional_features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "versions": [{"id": "ID", "_rev": "Rev", "crn": "CRN", "version": "Version", "flavor": {"name": "Name", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "index": 5}, "sha": "Sha", "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "offering_id": "OfferingID", "catalog_id": "CatalogID", "kind_id": "KindID", "tags": ["Tags"], "repo_url": "RepoURL", "source_url": "SourceURL", "tgz_url": "TgzURL", "configuration": [{"key": "Key", "type": "Type", "default_value": "anyValue", "display_name": "DisplayName", "value_constraint": "ValueConstraint", "description": "Description", "required": true, "options": ["anyValue"], "hidden": true, "custom_config": {"type": "Type", "grouping": "Grouping", "original_grouping": "OriginalGrouping", "grouping_index": 13, "config_constraints": {"anyKey": "anyValue"}, "associations": {"parameters": [{"name": "Name", "optionsRefresh": true}]}}, "type_metadata": "TypeMetadata"}], "outputs": [{"key": "Key", "description": "Description"}], "iam_permissions": [{"service_name": "ServiceName", "role_crns": ["RoleCrns"], "resources": [{"name": "Name", "description": "Description", "role_crns": ["RoleCrns"]}]}], "metadata": {"mapKey": "anyValue"}, "validation": {"validated": "2019-01-01T12:00:00.000Z", "requested": "2019-01-01T12:00:00.000Z", "state": "State", "last_operation": "LastOperation", "target": {"mapKey": "anyValue"}, "message": "Message"}, "required_resources": [{"type": "mem", "value": "anyValue"}], "single_instance": true, "install": {"instructions": "Instructions", "instructions_i18n": {"mapKey": "Inner"}, "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}, "pre_install": [{"instructions": "Instructions", "instructions_i18n": {"mapKey": "Inner"}, "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}], "entitlement": {"provider_name": "ProviderName", "provider_id": "ProviderID", "product_id": "ProductID", "part_numbers": ["PartNumbers"], "image_repo_name": "ImageRepoName"}, "licenses": [{"id": "ID", "name": "Name", "type": "Type", "url": "URL", "description": "Description"}], "image_manifest_url": "ImageManifestURL", "deprecated": true, "package_version": "PackageVersion", "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "version_locator": "VersionLocator", "long_description": "LongDescription", "long_description_i18n": {"mapKey": "Inner"}, "whitelisted_accounts": ["WhitelistedAccounts"], "image_pull_key_name": "ImagePullKeyName", "deprecate_pending": {"deprecate_date": "2019-01-01T12:00:00.000Z", "deprecate_state": "DeprecateState", "description": "Description"}, "solution_info": {"architecture_diagrams": [{"diagram": {"url": "URL", "api_url": "APIURL", "url_proxy": {"url": "URL", "sha": "Sha"}, "caption": "Caption", "caption_i18n": {"mapKey": "Inner"}, "type": "Type", "thumbnail_url": "ThumbnailURL"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "cost_estimate": {"version": "Version", "currency": "Currency", "projects": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "pastBreakdown": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "breakdown": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "diff": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "summary": {"totalDetectedResources": 22, "totalSupportedResources": 23, "totalUnsupportedResources": 25, "totalUsageBasedResources": 24, "totalNoPriceResources": 21, "unsupportedResourceCounts": {"mapKey": 5}, "noPriceResourceCounts": {"mapKey": 5}}}], "summary": {"totalDetectedResources": 22, "totalSupportedResources": 23, "totalUnsupportedResources": 25, "totalUsageBasedResources": 24, "totalNoPriceResources": 21, "unsupportedResourceCounts": {"mapKey": 5}, "noPriceResourceCounts": {"mapKey": 5}}, "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z"}, "dependencies": [{"catalog_id": "CatalogID", "id": "ID", "name": "Name", "version": "Version", "flavors": ["Flavors"]}]}, "is_consumable": true}], "plans": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "additional_features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "deployments": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z"}]}]}], "pc_managed": false, "publish_approved": false, "share_with_all": true, "share_with_ibm": true, "share_enabled": true, "permit_request_ibm_public_publish": false, "ibm_publish_approved": true, "public_publish_approved": false, "public_original_crn": "PublicOriginalCRN", "publish_public_crn": "PublishPublicCRN", "portal_approval_record": "PortalApprovalRecord", "portal_ui_url": "PortalUIURL", "catalog_id": "CatalogID", "catalog_name": "CatalogName", "metadata": {"mapKey": "anyValue"}, "disclaimer": "Disclaimer", "hidden": true, "provider": "Provider", "provider_info": {"id": "ID", "name": "Name"}, "repo_info": {"token": "Token", "type": "Type"}, "image_pull_keys": [{"name": "Name", "value": "Value", "description": "Description"}], "support": {"url": "URL", "process": "Process", "process_i18n": {"mapKey": "Inner"}, "locations": ["Locations"], "support_details": [{"type": "Type", "contact": "Contact", "response_wait_time": {"value": 5, "type": "Type"}, "availability": {"times": [{"day": 3, "start_time": "StartTime", "end_time": "EndTime"}], "timezone": "Timezone", "always_available": false}}], "support_escalation": {"escalation_wait_time": {"value": 5, "type": "Type"}, "response_wait_time": {"value": 5, "type": "Type"}, "contact": "Contact"}, "support_type": "SupportType"}, "media": [{"url": "URL", "api_url": "APIURL", "url_proxy": {"url": "URL", "sha": "Sha"}, "caption": "Caption", "caption_i18n": {"mapKey": "Inner"}, "type": "Type", "thumbnail_url": "ThumbnailURL"}], "deprecate_pending": {"deprecate_date": "2019-01-01T12:00:00.000Z", "deprecate_state": "DeprecateState", "description": "Description"}, "product_kind": "ProductKind", "badges": [{"id": "ID", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}, "icon": "Icon", "authority": "Authority", "tag": "Tag", "learn_more_links": {"first_party": "FirstParty", "third_party": "ThirdParty"}, "constraints": [{"type": "Type", "rule": "anyValue"}]}]}]}`) })) }) - It(`Invoke CreateOffering successfully with retries`, func() { + It(`Invoke GetConsumptionOfferings successfully with retries`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -3524,221 +4338,26 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) catalogManagementService.EnableRetries(0, 0) - // Construct an instance of the Rating model - ratingModel := new(catalogmanagementv1.Rating) - ratingModel.OneStarCount = core.Int64Ptr(int64(38)) - ratingModel.TwoStarCount = core.Int64Ptr(int64(38)) - ratingModel.ThreeStarCount = core.Int64Ptr(int64(38)) - ratingModel.FourStarCount = core.Int64Ptr(int64(38)) - - // Construct an instance of the Feature model - featureModel := new(catalogmanagementv1.Feature) - featureModel.Title = core.StringPtr("testString") - featureModel.Description = core.StringPtr("testString") - - // Construct an instance of the Configuration model - configurationModel := new(catalogmanagementv1.Configuration) - configurationModel.Key = core.StringPtr("testString") - configurationModel.Type = core.StringPtr("testString") - configurationModel.DefaultValue = core.StringPtr("testString") - configurationModel.ValueConstraint = core.StringPtr("testString") - configurationModel.Description = core.StringPtr("testString") - configurationModel.Required = core.BoolPtr(true) - configurationModel.Options = []interface{}{"testString"} - configurationModel.Hidden = core.BoolPtr(true) - - // Construct an instance of the Validation model - validationModel := new(catalogmanagementv1.Validation) - validationModel.Validated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - validationModel.Requested = CreateMockDateTime("2019-01-01T12:00:00.000Z") - validationModel.State = core.StringPtr("testString") - validationModel.LastOperation = core.StringPtr("testString") - validationModel.Target = make(map[string]interface{}) - - // Construct an instance of the Resource model - resourceModel := new(catalogmanagementv1.Resource) - resourceModel.Type = core.StringPtr("mem") - resourceModel.Value = core.StringPtr("testString") - - // Construct an instance of the Script model - scriptModel := new(catalogmanagementv1.Script) - scriptModel.Instructions = core.StringPtr("testString") - scriptModel.Script = core.StringPtr("testString") - scriptModel.ScriptPermission = core.StringPtr("testString") - scriptModel.DeleteScript = core.StringPtr("testString") - scriptModel.Scope = core.StringPtr("testString") - - // Construct an instance of the VersionEntitlement model - versionEntitlementModel := new(catalogmanagementv1.VersionEntitlement) - versionEntitlementModel.ProviderName = core.StringPtr("testString") - versionEntitlementModel.ProviderID = core.StringPtr("testString") - versionEntitlementModel.ProductID = core.StringPtr("testString") - versionEntitlementModel.PartNumbers = []string{"testString"} - versionEntitlementModel.ImageRepoName = core.StringPtr("testString") - - // Construct an instance of the License model - licenseModel := new(catalogmanagementv1.License) - licenseModel.ID = core.StringPtr("testString") - licenseModel.Name = core.StringPtr("testString") - licenseModel.Type = core.StringPtr("testString") - licenseModel.URL = core.StringPtr("testString") - licenseModel.Description = core.StringPtr("testString") - - // Construct an instance of the State model - stateModel := new(catalogmanagementv1.State) - stateModel.Current = core.StringPtr("testString") - stateModel.CurrentEntered = CreateMockDateTime("2019-01-01T12:00:00.000Z") - stateModel.Pending = core.StringPtr("testString") - stateModel.PendingRequested = CreateMockDateTime("2019-01-01T12:00:00.000Z") - stateModel.Previous = core.StringPtr("testString") - - // Construct an instance of the Version model - versionModel := new(catalogmanagementv1.Version) - versionModel.ID = core.StringPtr("testString") - versionModel.Rev = core.StringPtr("testString") - versionModel.CRN = core.StringPtr("testString") - versionModel.Version = core.StringPtr("testString") - versionModel.Sha = core.StringPtr("testString") - versionModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") - versionModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - versionModel.OfferingID = core.StringPtr("testString") - versionModel.CatalogID = core.StringPtr("testString") - versionModel.KindID = core.StringPtr("testString") - versionModel.Tags = []string{"testString"} - versionModel.RepoURL = core.StringPtr("testString") - versionModel.SourceURL = core.StringPtr("testString") - versionModel.TgzURL = core.StringPtr("testString") - versionModel.Configuration = []catalogmanagementv1.Configuration{*configurationModel} - versionModel.Metadata = make(map[string]interface{}) - versionModel.Validation = validationModel - versionModel.RequiredResources = []catalogmanagementv1.Resource{*resourceModel} - versionModel.SingleInstance = core.BoolPtr(true) - versionModel.Install = scriptModel - versionModel.PreInstall = []catalogmanagementv1.Script{*scriptModel} - versionModel.Entitlement = versionEntitlementModel - versionModel.Licenses = []catalogmanagementv1.License{*licenseModel} - versionModel.ImageManifestURL = core.StringPtr("testString") - versionModel.Deprecated = core.BoolPtr(true) - versionModel.PackageVersion = core.StringPtr("testString") - versionModel.State = stateModel - versionModel.VersionLocator = core.StringPtr("testString") - versionModel.ConsoleURL = core.StringPtr("testString") - versionModel.LongDescription = core.StringPtr("testString") - versionModel.WhitelistedAccounts = []string{"testString"} - - // Construct an instance of the Deployment model - deploymentModel := new(catalogmanagementv1.Deployment) - deploymentModel.ID = core.StringPtr("testString") - deploymentModel.Label = core.StringPtr("testString") - deploymentModel.Name = core.StringPtr("testString") - deploymentModel.ShortDescription = core.StringPtr("testString") - deploymentModel.LongDescription = core.StringPtr("testString") - deploymentModel.Metadata = make(map[string]interface{}) - deploymentModel.Tags = []string{"testString"} - deploymentModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") - deploymentModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - - // Construct an instance of the Plan model - planModel := new(catalogmanagementv1.Plan) - planModel.ID = core.StringPtr("testString") - planModel.Label = core.StringPtr("testString") - planModel.Name = core.StringPtr("testString") - planModel.ShortDescription = core.StringPtr("testString") - planModel.LongDescription = core.StringPtr("testString") - planModel.Metadata = make(map[string]interface{}) - planModel.Tags = []string{"testString"} - planModel.AdditionalFeatures = []catalogmanagementv1.Feature{*featureModel} - planModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") - planModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - planModel.Deployments = []catalogmanagementv1.Deployment{*deploymentModel} - - // Construct an instance of the Kind model - kindModel := new(catalogmanagementv1.Kind) - kindModel.ID = core.StringPtr("testString") - kindModel.FormatKind = core.StringPtr("testString") - kindModel.TargetKind = core.StringPtr("testString") - kindModel.Metadata = make(map[string]interface{}) - kindModel.InstallDescription = core.StringPtr("testString") - kindModel.Tags = []string{"testString"} - kindModel.AdditionalFeatures = []catalogmanagementv1.Feature{*featureModel} - kindModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") - kindModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - kindModel.Versions = []catalogmanagementv1.Version{*versionModel} - kindModel.Plans = []catalogmanagementv1.Plan{*planModel} - - // Construct an instance of the ProviderInfo model - providerInfoModel := new(catalogmanagementv1.ProviderInfo) - providerInfoModel.ID = core.StringPtr("testString") - providerInfoModel.Name = core.StringPtr("testString") - - // Construct an instance of the RepoInfo model - repoInfoModel := new(catalogmanagementv1.RepoInfo) - repoInfoModel.Token = core.StringPtr("testString") - repoInfoModel.Type = core.StringPtr("testString") - - // Construct an instance of the Support model - supportModel := new(catalogmanagementv1.Support) - supportModel.URL = core.StringPtr("testString") - supportModel.Process = core.StringPtr("testString") - supportModel.Locations = []string{"testString"} - - // Construct an instance of the MediaItem model - mediaItemModel := new(catalogmanagementv1.MediaItem) - mediaItemModel.URL = core.StringPtr("testString") - mediaItemModel.Caption = core.StringPtr("testString") - mediaItemModel.Type = core.StringPtr("testString") - mediaItemModel.ThumbnailURL = core.StringPtr("testString") - - // Construct an instance of the CreateOfferingOptions model - createOfferingOptionsModel := new(catalogmanagementv1.CreateOfferingOptions) - createOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") - createOfferingOptionsModel.ID = core.StringPtr("testString") - createOfferingOptionsModel.Rev = core.StringPtr("testString") - createOfferingOptionsModel.URL = core.StringPtr("testString") - createOfferingOptionsModel.CRN = core.StringPtr("testString") - createOfferingOptionsModel.Label = core.StringPtr("testString") - createOfferingOptionsModel.Name = core.StringPtr("testString") - createOfferingOptionsModel.OfferingIconURL = core.StringPtr("testString") - createOfferingOptionsModel.OfferingDocsURL = core.StringPtr("testString") - createOfferingOptionsModel.OfferingSupportURL = core.StringPtr("testString") - createOfferingOptionsModel.Tags = []string{"testString"} - createOfferingOptionsModel.Keywords = []string{"testString"} - createOfferingOptionsModel.Rating = ratingModel - createOfferingOptionsModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") - createOfferingOptionsModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - createOfferingOptionsModel.ShortDescription = core.StringPtr("testString") - createOfferingOptionsModel.LongDescription = core.StringPtr("testString") - createOfferingOptionsModel.Features = []catalogmanagementv1.Feature{*featureModel} - createOfferingOptionsModel.Kinds = []catalogmanagementv1.Kind{*kindModel} - createOfferingOptionsModel.PermitRequestIBMPublicPublish = core.BoolPtr(true) - createOfferingOptionsModel.IBMPublishApproved = core.BoolPtr(true) - createOfferingOptionsModel.PublicPublishApproved = core.BoolPtr(true) - createOfferingOptionsModel.PublicOriginalCRN = core.StringPtr("testString") - createOfferingOptionsModel.PublishPublicCRN = core.StringPtr("testString") - createOfferingOptionsModel.PortalApprovalRecord = core.StringPtr("testString") - createOfferingOptionsModel.PortalUIURL = core.StringPtr("testString") - createOfferingOptionsModel.CatalogID = core.StringPtr("testString") - createOfferingOptionsModel.CatalogName = core.StringPtr("testString") - createOfferingOptionsModel.Metadata = make(map[string]interface{}) - createOfferingOptionsModel.Disclaimer = core.StringPtr("testString") - createOfferingOptionsModel.Hidden = core.BoolPtr(true) - createOfferingOptionsModel.Provider = core.StringPtr("testString") - createOfferingOptionsModel.ProviderInfo = providerInfoModel - createOfferingOptionsModel.RepoInfo = repoInfoModel - createOfferingOptionsModel.Support = supportModel - createOfferingOptionsModel.Media = []catalogmanagementv1.MediaItem{*mediaItemModel} - createOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetConsumptionOfferingsOptions model + getConsumptionOfferingsOptionsModel := new(catalogmanagementv1.GetConsumptionOfferingsOptions) + getConsumptionOfferingsOptionsModel.Digest = core.BoolPtr(true) + getConsumptionOfferingsOptionsModel.Catalog = core.StringPtr("testString") + getConsumptionOfferingsOptionsModel.Select = core.StringPtr("all") + getConsumptionOfferingsOptionsModel.IncludeHidden = core.BoolPtr(true) + getConsumptionOfferingsOptionsModel.Limit = core.Int64Ptr(int64(1000)) + getConsumptionOfferingsOptionsModel.Offset = core.Int64Ptr(int64(38)) + getConsumptionOfferingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := catalogManagementService.CreateOfferingWithContext(ctx, createOfferingOptionsModel) + _, _, operationErr := catalogManagementService.GetConsumptionOfferingsWithContext(ctx, getConsumptionOfferingsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again catalogManagementService.DisableRetries() - result, response, operationErr := catalogManagementService.CreateOffering(createOfferingOptionsModel) + result, response, operationErr := catalogManagementService.GetConsumptionOfferings(getConsumptionOfferingsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -3746,7 +4365,7 @@ var _ = Describe(`CatalogManagementV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = catalogManagementService.CreateOfferingWithContext(ctx, createOfferingOptionsModel) + _, _, operationErr = catalogManagementService.GetConsumptionOfferingsWithContext(ctx, getConsumptionOfferingsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -3760,32 +4379,22 @@ var _ = Describe(`CatalogManagementV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createOfferingPath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(getConsumptionOfferingsPath)) + Expect(req.Method).To(Equal("GET")) + // TODO: Add check for digest query parameter + Expect(req.URL.Query()["catalog"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["select"]).To(Equal([]string{"all"})) + // TODO: Add check for includeHidden query parameter + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1000))})) + Expect(req.URL.Query()["offset"]).To(Equal([]string{fmt.Sprint(int64(38))})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "url": "URL", "crn": "CRN", "label": "Label", "name": "Name", "offering_icon_url": "OfferingIconURL", "offering_docs_url": "OfferingDocsURL", "offering_support_url": "OfferingSupportURL", "tags": ["Tags"], "keywords": ["Keywords"], "rating": {"one_star_count": 12, "two_star_count": 12, "three_star_count": 14, "four_star_count": 13}, "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "short_description": "ShortDescription", "long_description": "LongDescription", "features": [{"title": "Title", "description": "Description"}], "kinds": [{"id": "ID", "format_kind": "FormatKind", "target_kind": "TargetKind", "metadata": {"mapKey": "anyValue"}, "install_description": "InstallDescription", "tags": ["Tags"], "additional_features": [{"title": "Title", "description": "Description"}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "versions": [{"id": "ID", "_rev": "Rev", "crn": "CRN", "version": "Version", "sha": "Sha", "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "offering_id": "OfferingID", "catalog_id": "CatalogID", "kind_id": "KindID", "tags": ["Tags"], "repo_url": "RepoURL", "source_url": "SourceURL", "tgz_url": "TgzURL", "configuration": [{"key": "Key", "type": "Type", "default_value": "anyValue", "value_constraint": "ValueConstraint", "description": "Description", "required": true, "options": ["anyValue"], "hidden": true}], "metadata": {"mapKey": "anyValue"}, "validation": {"validated": "2019-01-01T12:00:00.000Z", "requested": "2019-01-01T12:00:00.000Z", "state": "State", "last_operation": "LastOperation", "target": {"mapKey": "anyValue"}}, "required_resources": [{"type": "mem", "value": "anyValue"}], "single_instance": true, "install": {"instructions": "Instructions", "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}, "pre_install": [{"instructions": "Instructions", "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}], "entitlement": {"provider_name": "ProviderName", "provider_id": "ProviderID", "product_id": "ProductID", "part_numbers": ["PartNumbers"], "image_repo_name": "ImageRepoName"}, "licenses": [{"id": "ID", "name": "Name", "type": "Type", "url": "URL", "description": "Description"}], "image_manifest_url": "ImageManifestURL", "deprecated": true, "package_version": "PackageVersion", "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "version_locator": "VersionLocator", "console_url": "ConsoleURL", "long_description": "LongDescription", "whitelisted_accounts": ["WhitelistedAccounts"]}], "plans": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "additional_features": [{"title": "Title", "description": "Description"}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "deployments": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z"}]}]}], "permit_request_ibm_public_publish": false, "ibm_publish_approved": true, "public_publish_approved": false, "public_original_crn": "PublicOriginalCRN", "publish_public_crn": "PublishPublicCRN", "portal_approval_record": "PortalApprovalRecord", "portal_ui_url": "PortalUIURL", "catalog_id": "CatalogID", "catalog_name": "CatalogName", "metadata": {"mapKey": "anyValue"}, "disclaimer": "Disclaimer", "hidden": true, "provider": "Provider", "provider_info": {"id": "ID", "name": "Name"}, "repo_info": {"token": "Token", "type": "Type"}, "support": {"url": "URL", "process": "Process", "locations": ["Locations"]}, "media": [{"url": "URL", "caption": "Caption", "type": "Type", "thumbnail_url": "ThumbnailURL"}]}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"offset": 6, "limit": 5, "total_count": 10, "resource_count": 13, "first": "First", "last": "Last", "prev": "Prev", "next": "Next", "resources": [{"id": "ID", "_rev": "Rev", "url": "URL", "crn": "CRN", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "name": "Name", "offering_icon_url": "OfferingIconURL", "offering_docs_url": "OfferingDocsURL", "offering_support_url": "OfferingSupportURL", "tags": ["Tags"], "keywords": ["Keywords"], "rating": {"one_star_count": 12, "two_star_count": 12, "three_star_count": 14, "four_star_count": 13}, "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "short_description": "ShortDescription", "short_description_i18n": {"mapKey": "Inner"}, "long_description": "LongDescription", "long_description_i18n": {"mapKey": "Inner"}, "features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "kinds": [{"id": "ID", "format_kind": "FormatKind", "install_kind": "InstallKind", "target_kind": "TargetKind", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "additional_features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "versions": [{"id": "ID", "_rev": "Rev", "crn": "CRN", "version": "Version", "flavor": {"name": "Name", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "index": 5}, "sha": "Sha", "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "offering_id": "OfferingID", "catalog_id": "CatalogID", "kind_id": "KindID", "tags": ["Tags"], "repo_url": "RepoURL", "source_url": "SourceURL", "tgz_url": "TgzURL", "configuration": [{"key": "Key", "type": "Type", "default_value": "anyValue", "display_name": "DisplayName", "value_constraint": "ValueConstraint", "description": "Description", "required": true, "options": ["anyValue"], "hidden": true, "custom_config": {"type": "Type", "grouping": "Grouping", "original_grouping": "OriginalGrouping", "grouping_index": 13, "config_constraints": {"anyKey": "anyValue"}, "associations": {"parameters": [{"name": "Name", "optionsRefresh": true}]}}, "type_metadata": "TypeMetadata"}], "outputs": [{"key": "Key", "description": "Description"}], "iam_permissions": [{"service_name": "ServiceName", "role_crns": ["RoleCrns"], "resources": [{"name": "Name", "description": "Description", "role_crns": ["RoleCrns"]}]}], "metadata": {"mapKey": "anyValue"}, "validation": {"validated": "2019-01-01T12:00:00.000Z", "requested": "2019-01-01T12:00:00.000Z", "state": "State", "last_operation": "LastOperation", "target": {"mapKey": "anyValue"}, "message": "Message"}, "required_resources": [{"type": "mem", "value": "anyValue"}], "single_instance": true, "install": {"instructions": "Instructions", "instructions_i18n": {"mapKey": "Inner"}, "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}, "pre_install": [{"instructions": "Instructions", "instructions_i18n": {"mapKey": "Inner"}, "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}], "entitlement": {"provider_name": "ProviderName", "provider_id": "ProviderID", "product_id": "ProductID", "part_numbers": ["PartNumbers"], "image_repo_name": "ImageRepoName"}, "licenses": [{"id": "ID", "name": "Name", "type": "Type", "url": "URL", "description": "Description"}], "image_manifest_url": "ImageManifestURL", "deprecated": true, "package_version": "PackageVersion", "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "version_locator": "VersionLocator", "long_description": "LongDescription", "long_description_i18n": {"mapKey": "Inner"}, "whitelisted_accounts": ["WhitelistedAccounts"], "image_pull_key_name": "ImagePullKeyName", "deprecate_pending": {"deprecate_date": "2019-01-01T12:00:00.000Z", "deprecate_state": "DeprecateState", "description": "Description"}, "solution_info": {"architecture_diagrams": [{"diagram": {"url": "URL", "api_url": "APIURL", "url_proxy": {"url": "URL", "sha": "Sha"}, "caption": "Caption", "caption_i18n": {"mapKey": "Inner"}, "type": "Type", "thumbnail_url": "ThumbnailURL"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "cost_estimate": {"version": "Version", "currency": "Currency", "projects": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "pastBreakdown": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "breakdown": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "diff": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "summary": {"totalDetectedResources": 22, "totalSupportedResources": 23, "totalUnsupportedResources": 25, "totalUsageBasedResources": 24, "totalNoPriceResources": 21, "unsupportedResourceCounts": {"mapKey": 5}, "noPriceResourceCounts": {"mapKey": 5}}}], "summary": {"totalDetectedResources": 22, "totalSupportedResources": 23, "totalUnsupportedResources": 25, "totalUsageBasedResources": 24, "totalNoPriceResources": 21, "unsupportedResourceCounts": {"mapKey": 5}, "noPriceResourceCounts": {"mapKey": 5}}, "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z"}, "dependencies": [{"catalog_id": "CatalogID", "id": "ID", "name": "Name", "version": "Version", "flavors": ["Flavors"]}]}, "is_consumable": true}], "plans": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "additional_features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "deployments": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z"}]}]}], "pc_managed": false, "publish_approved": false, "share_with_all": true, "share_with_ibm": true, "share_enabled": true, "permit_request_ibm_public_publish": false, "ibm_publish_approved": true, "public_publish_approved": false, "public_original_crn": "PublicOriginalCRN", "publish_public_crn": "PublishPublicCRN", "portal_approval_record": "PortalApprovalRecord", "portal_ui_url": "PortalUIURL", "catalog_id": "CatalogID", "catalog_name": "CatalogName", "metadata": {"mapKey": "anyValue"}, "disclaimer": "Disclaimer", "hidden": true, "provider": "Provider", "provider_info": {"id": "ID", "name": "Name"}, "repo_info": {"token": "Token", "type": "Type"}, "image_pull_keys": [{"name": "Name", "value": "Value", "description": "Description"}], "support": {"url": "URL", "process": "Process", "process_i18n": {"mapKey": "Inner"}, "locations": ["Locations"], "support_details": [{"type": "Type", "contact": "Contact", "response_wait_time": {"value": 5, "type": "Type"}, "availability": {"times": [{"day": 3, "start_time": "StartTime", "end_time": "EndTime"}], "timezone": "Timezone", "always_available": false}}], "support_escalation": {"escalation_wait_time": {"value": 5, "type": "Type"}, "response_wait_time": {"value": 5, "type": "Type"}, "contact": "Contact"}, "support_type": "SupportType"}, "media": [{"url": "URL", "api_url": "APIURL", "url_proxy": {"url": "URL", "sha": "Sha"}, "caption": "Caption", "caption_i18n": {"mapKey": "Inner"}, "type": "Type", "thumbnail_url": "ThumbnailURL"}], "deprecate_pending": {"deprecate_date": "2019-01-01T12:00:00.000Z", "deprecate_state": "DeprecateState", "description": "Description"}, "product_kind": "ProductKind", "badges": [{"id": "ID", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}, "icon": "Icon", "authority": "Authority", "tag": "Tag", "learn_more_links": {"first_party": "FirstParty", "third_party": "ThirdParty"}, "constraints": [{"type": "Type", "rule": "anyValue"}]}]}]}`) })) }) - It(`Invoke CreateOffering successfully`, func() { + It(`Invoke GetConsumptionOfferings successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -3794,33 +4403,6362 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := catalogManagementService.CreateOffering(nil) + result, response, operationErr := catalogManagementService.GetConsumptionOfferings(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the Rating model - ratingModel := new(catalogmanagementv1.Rating) - ratingModel.OneStarCount = core.Int64Ptr(int64(38)) - ratingModel.TwoStarCount = core.Int64Ptr(int64(38)) - ratingModel.ThreeStarCount = core.Int64Ptr(int64(38)) - ratingModel.FourStarCount = core.Int64Ptr(int64(38)) + // Construct an instance of the GetConsumptionOfferingsOptions model + getConsumptionOfferingsOptionsModel := new(catalogmanagementv1.GetConsumptionOfferingsOptions) + getConsumptionOfferingsOptionsModel.Digest = core.BoolPtr(true) + getConsumptionOfferingsOptionsModel.Catalog = core.StringPtr("testString") + getConsumptionOfferingsOptionsModel.Select = core.StringPtr("all") + getConsumptionOfferingsOptionsModel.IncludeHidden = core.BoolPtr(true) + getConsumptionOfferingsOptionsModel.Limit = core.Int64Ptr(int64(1000)) + getConsumptionOfferingsOptionsModel.Offset = core.Int64Ptr(int64(38)) + getConsumptionOfferingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Construct an instance of the Feature model - featureModel := new(catalogmanagementv1.Feature) - featureModel.Title = core.StringPtr("testString") - featureModel.Description = core.StringPtr("testString") + // Invoke operation with valid options model (positive test) + result, response, operationErr = catalogManagementService.GetConsumptionOfferings(getConsumptionOfferingsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) - // Construct an instance of the Configuration model - configurationModel := new(catalogmanagementv1.Configuration) - configurationModel.Key = core.StringPtr("testString") - configurationModel.Type = core.StringPtr("testString") - configurationModel.DefaultValue = core.StringPtr("testString") - configurationModel.ValueConstraint = core.StringPtr("testString") - configurationModel.Description = core.StringPtr("testString") + }) + It(`Invoke GetConsumptionOfferings with error: Operation request error`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Construct an instance of the GetConsumptionOfferingsOptions model + getConsumptionOfferingsOptionsModel := new(catalogmanagementv1.GetConsumptionOfferingsOptions) + getConsumptionOfferingsOptionsModel.Digest = core.BoolPtr(true) + getConsumptionOfferingsOptionsModel.Catalog = core.StringPtr("testString") + getConsumptionOfferingsOptionsModel.Select = core.StringPtr("all") + getConsumptionOfferingsOptionsModel.IncludeHidden = core.BoolPtr(true) + getConsumptionOfferingsOptionsModel.Limit = core.Int64Ptr(int64(1000)) + getConsumptionOfferingsOptionsModel.Offset = core.Int64Ptr(int64(38)) + getConsumptionOfferingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := catalogManagementService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := catalogManagementService.GetConsumptionOfferings(getConsumptionOfferingsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke GetConsumptionOfferings successfully`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Construct an instance of the GetConsumptionOfferingsOptions model + getConsumptionOfferingsOptionsModel := new(catalogmanagementv1.GetConsumptionOfferingsOptions) + getConsumptionOfferingsOptionsModel.Digest = core.BoolPtr(true) + getConsumptionOfferingsOptionsModel.Catalog = core.StringPtr("testString") + getConsumptionOfferingsOptionsModel.Select = core.StringPtr("all") + getConsumptionOfferingsOptionsModel.IncludeHidden = core.BoolPtr(true) + getConsumptionOfferingsOptionsModel.Limit = core.Int64Ptr(int64(1000)) + getConsumptionOfferingsOptionsModel.Offset = core.Int64Ptr(int64(38)) + getConsumptionOfferingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := catalogManagementService.GetConsumptionOfferings(getConsumptionOfferingsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListOfferings(listOfferingsOptions *ListOfferingsOptions) - Operation response error`, func() { + listOfferingsPath := "/catalogs/testString/offerings" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listOfferingsPath)) + Expect(req.Method).To(Equal("GET")) + // TODO: Add check for digest query parameter + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1000))})) + Expect(req.URL.Query()["offset"]).To(Equal([]string{fmt.Sprint(int64(38))})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"testString"})) + // TODO: Add check for includeHidden query parameter + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke ListOfferings with error: Operation response processing error`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Construct an instance of the ListOfferingsOptions model + listOfferingsOptionsModel := new(catalogmanagementv1.ListOfferingsOptions) + listOfferingsOptionsModel.CatalogIdentifier = core.StringPtr("testString") + listOfferingsOptionsModel.Digest = core.BoolPtr(true) + listOfferingsOptionsModel.Limit = core.Int64Ptr(int64(1000)) + listOfferingsOptionsModel.Offset = core.Int64Ptr(int64(38)) + listOfferingsOptionsModel.Name = core.StringPtr("testString") + listOfferingsOptionsModel.Sort = core.StringPtr("testString") + listOfferingsOptionsModel.IncludeHidden = core.BoolPtr(true) + listOfferingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := catalogManagementService.ListOfferings(listOfferingsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + catalogManagementService.EnableRetries(0, 0) + result, response, operationErr = catalogManagementService.ListOfferings(listOfferingsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListOfferings(listOfferingsOptions *ListOfferingsOptions)`, func() { + listOfferingsPath := "/catalogs/testString/offerings" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listOfferingsPath)) + Expect(req.Method).To(Equal("GET")) + + // TODO: Add check for digest query parameter + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1000))})) + Expect(req.URL.Query()["offset"]).To(Equal([]string{fmt.Sprint(int64(38))})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"testString"})) + // TODO: Add check for includeHidden query parameter + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"offset": 6, "limit": 5, "total_count": 10, "resource_count": 13, "first": "First", "last": "Last", "prev": "Prev", "next": "Next", "resources": [{"id": "ID", "_rev": "Rev", "url": "URL", "crn": "CRN", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "name": "Name", "offering_icon_url": "OfferingIconURL", "offering_docs_url": "OfferingDocsURL", "offering_support_url": "OfferingSupportURL", "tags": ["Tags"], "keywords": ["Keywords"], "rating": {"one_star_count": 12, "two_star_count": 12, "three_star_count": 14, "four_star_count": 13}, "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "short_description": "ShortDescription", "short_description_i18n": {"mapKey": "Inner"}, "long_description": "LongDescription", "long_description_i18n": {"mapKey": "Inner"}, "features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "kinds": [{"id": "ID", "format_kind": "FormatKind", "install_kind": "InstallKind", "target_kind": "TargetKind", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "additional_features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "versions": [{"id": "ID", "_rev": "Rev", "crn": "CRN", "version": "Version", "flavor": {"name": "Name", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "index": 5}, "sha": "Sha", "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "offering_id": "OfferingID", "catalog_id": "CatalogID", "kind_id": "KindID", "tags": ["Tags"], "repo_url": "RepoURL", "source_url": "SourceURL", "tgz_url": "TgzURL", "configuration": [{"key": "Key", "type": "Type", "default_value": "anyValue", "display_name": "DisplayName", "value_constraint": "ValueConstraint", "description": "Description", "required": true, "options": ["anyValue"], "hidden": true, "custom_config": {"type": "Type", "grouping": "Grouping", "original_grouping": "OriginalGrouping", "grouping_index": 13, "config_constraints": {"anyKey": "anyValue"}, "associations": {"parameters": [{"name": "Name", "optionsRefresh": true}]}}, "type_metadata": "TypeMetadata"}], "outputs": [{"key": "Key", "description": "Description"}], "iam_permissions": [{"service_name": "ServiceName", "role_crns": ["RoleCrns"], "resources": [{"name": "Name", "description": "Description", "role_crns": ["RoleCrns"]}]}], "metadata": {"mapKey": "anyValue"}, "validation": {"validated": "2019-01-01T12:00:00.000Z", "requested": "2019-01-01T12:00:00.000Z", "state": "State", "last_operation": "LastOperation", "target": {"mapKey": "anyValue"}, "message": "Message"}, "required_resources": [{"type": "mem", "value": "anyValue"}], "single_instance": true, "install": {"instructions": "Instructions", "instructions_i18n": {"mapKey": "Inner"}, "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}, "pre_install": [{"instructions": "Instructions", "instructions_i18n": {"mapKey": "Inner"}, "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}], "entitlement": {"provider_name": "ProviderName", "provider_id": "ProviderID", "product_id": "ProductID", "part_numbers": ["PartNumbers"], "image_repo_name": "ImageRepoName"}, "licenses": [{"id": "ID", "name": "Name", "type": "Type", "url": "URL", "description": "Description"}], "image_manifest_url": "ImageManifestURL", "deprecated": true, "package_version": "PackageVersion", "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "version_locator": "VersionLocator", "long_description": "LongDescription", "long_description_i18n": {"mapKey": "Inner"}, "whitelisted_accounts": ["WhitelistedAccounts"], "image_pull_key_name": "ImagePullKeyName", "deprecate_pending": {"deprecate_date": "2019-01-01T12:00:00.000Z", "deprecate_state": "DeprecateState", "description": "Description"}, "solution_info": {"architecture_diagrams": [{"diagram": {"url": "URL", "api_url": "APIURL", "url_proxy": {"url": "URL", "sha": "Sha"}, "caption": "Caption", "caption_i18n": {"mapKey": "Inner"}, "type": "Type", "thumbnail_url": "ThumbnailURL"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "cost_estimate": {"version": "Version", "currency": "Currency", "projects": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "pastBreakdown": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "breakdown": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "diff": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "summary": {"totalDetectedResources": 22, "totalSupportedResources": 23, "totalUnsupportedResources": 25, "totalUsageBasedResources": 24, "totalNoPriceResources": 21, "unsupportedResourceCounts": {"mapKey": 5}, "noPriceResourceCounts": {"mapKey": 5}}}], "summary": {"totalDetectedResources": 22, "totalSupportedResources": 23, "totalUnsupportedResources": 25, "totalUsageBasedResources": 24, "totalNoPriceResources": 21, "unsupportedResourceCounts": {"mapKey": 5}, "noPriceResourceCounts": {"mapKey": 5}}, "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z"}, "dependencies": [{"catalog_id": "CatalogID", "id": "ID", "name": "Name", "version": "Version", "flavors": ["Flavors"]}]}, "is_consumable": true}], "plans": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "additional_features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "deployments": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z"}]}]}], "pc_managed": false, "publish_approved": false, "share_with_all": true, "share_with_ibm": true, "share_enabled": true, "permit_request_ibm_public_publish": false, "ibm_publish_approved": true, "public_publish_approved": false, "public_original_crn": "PublicOriginalCRN", "publish_public_crn": "PublishPublicCRN", "portal_approval_record": "PortalApprovalRecord", "portal_ui_url": "PortalUIURL", "catalog_id": "CatalogID", "catalog_name": "CatalogName", "metadata": {"mapKey": "anyValue"}, "disclaimer": "Disclaimer", "hidden": true, "provider": "Provider", "provider_info": {"id": "ID", "name": "Name"}, "repo_info": {"token": "Token", "type": "Type"}, "image_pull_keys": [{"name": "Name", "value": "Value", "description": "Description"}], "support": {"url": "URL", "process": "Process", "process_i18n": {"mapKey": "Inner"}, "locations": ["Locations"], "support_details": [{"type": "Type", "contact": "Contact", "response_wait_time": {"value": 5, "type": "Type"}, "availability": {"times": [{"day": 3, "start_time": "StartTime", "end_time": "EndTime"}], "timezone": "Timezone", "always_available": false}}], "support_escalation": {"escalation_wait_time": {"value": 5, "type": "Type"}, "response_wait_time": {"value": 5, "type": "Type"}, "contact": "Contact"}, "support_type": "SupportType"}, "media": [{"url": "URL", "api_url": "APIURL", "url_proxy": {"url": "URL", "sha": "Sha"}, "caption": "Caption", "caption_i18n": {"mapKey": "Inner"}, "type": "Type", "thumbnail_url": "ThumbnailURL"}], "deprecate_pending": {"deprecate_date": "2019-01-01T12:00:00.000Z", "deprecate_state": "DeprecateState", "description": "Description"}, "product_kind": "ProductKind", "badges": [{"id": "ID", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}, "icon": "Icon", "authority": "Authority", "tag": "Tag", "learn_more_links": {"first_party": "FirstParty", "third_party": "ThirdParty"}, "constraints": [{"type": "Type", "rule": "anyValue"}]}]}]}`) + })) + }) + It(`Invoke ListOfferings successfully with retries`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + catalogManagementService.EnableRetries(0, 0) + + // Construct an instance of the ListOfferingsOptions model + listOfferingsOptionsModel := new(catalogmanagementv1.ListOfferingsOptions) + listOfferingsOptionsModel.CatalogIdentifier = core.StringPtr("testString") + listOfferingsOptionsModel.Digest = core.BoolPtr(true) + listOfferingsOptionsModel.Limit = core.Int64Ptr(int64(1000)) + listOfferingsOptionsModel.Offset = core.Int64Ptr(int64(38)) + listOfferingsOptionsModel.Name = core.StringPtr("testString") + listOfferingsOptionsModel.Sort = core.StringPtr("testString") + listOfferingsOptionsModel.IncludeHidden = core.BoolPtr(true) + listOfferingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := catalogManagementService.ListOfferingsWithContext(ctx, listOfferingsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + catalogManagementService.DisableRetries() + result, response, operationErr := catalogManagementService.ListOfferings(listOfferingsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = catalogManagementService.ListOfferingsWithContext(ctx, listOfferingsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listOfferingsPath)) + Expect(req.Method).To(Equal("GET")) + + // TODO: Add check for digest query parameter + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1000))})) + Expect(req.URL.Query()["offset"]).To(Equal([]string{fmt.Sprint(int64(38))})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"testString"})) + // TODO: Add check for includeHidden query parameter + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"offset": 6, "limit": 5, "total_count": 10, "resource_count": 13, "first": "First", "last": "Last", "prev": "Prev", "next": "Next", "resources": [{"id": "ID", "_rev": "Rev", "url": "URL", "crn": "CRN", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "name": "Name", "offering_icon_url": "OfferingIconURL", "offering_docs_url": "OfferingDocsURL", "offering_support_url": "OfferingSupportURL", "tags": ["Tags"], "keywords": ["Keywords"], "rating": {"one_star_count": 12, "two_star_count": 12, "three_star_count": 14, "four_star_count": 13}, "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "short_description": "ShortDescription", "short_description_i18n": {"mapKey": "Inner"}, "long_description": "LongDescription", "long_description_i18n": {"mapKey": "Inner"}, "features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "kinds": [{"id": "ID", "format_kind": "FormatKind", "install_kind": "InstallKind", "target_kind": "TargetKind", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "additional_features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "versions": [{"id": "ID", "_rev": "Rev", "crn": "CRN", "version": "Version", "flavor": {"name": "Name", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "index": 5}, "sha": "Sha", "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "offering_id": "OfferingID", "catalog_id": "CatalogID", "kind_id": "KindID", "tags": ["Tags"], "repo_url": "RepoURL", "source_url": "SourceURL", "tgz_url": "TgzURL", "configuration": [{"key": "Key", "type": "Type", "default_value": "anyValue", "display_name": "DisplayName", "value_constraint": "ValueConstraint", "description": "Description", "required": true, "options": ["anyValue"], "hidden": true, "custom_config": {"type": "Type", "grouping": "Grouping", "original_grouping": "OriginalGrouping", "grouping_index": 13, "config_constraints": {"anyKey": "anyValue"}, "associations": {"parameters": [{"name": "Name", "optionsRefresh": true}]}}, "type_metadata": "TypeMetadata"}], "outputs": [{"key": "Key", "description": "Description"}], "iam_permissions": [{"service_name": "ServiceName", "role_crns": ["RoleCrns"], "resources": [{"name": "Name", "description": "Description", "role_crns": ["RoleCrns"]}]}], "metadata": {"mapKey": "anyValue"}, "validation": {"validated": "2019-01-01T12:00:00.000Z", "requested": "2019-01-01T12:00:00.000Z", "state": "State", "last_operation": "LastOperation", "target": {"mapKey": "anyValue"}, "message": "Message"}, "required_resources": [{"type": "mem", "value": "anyValue"}], "single_instance": true, "install": {"instructions": "Instructions", "instructions_i18n": {"mapKey": "Inner"}, "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}, "pre_install": [{"instructions": "Instructions", "instructions_i18n": {"mapKey": "Inner"}, "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}], "entitlement": {"provider_name": "ProviderName", "provider_id": "ProviderID", "product_id": "ProductID", "part_numbers": ["PartNumbers"], "image_repo_name": "ImageRepoName"}, "licenses": [{"id": "ID", "name": "Name", "type": "Type", "url": "URL", "description": "Description"}], "image_manifest_url": "ImageManifestURL", "deprecated": true, "package_version": "PackageVersion", "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "version_locator": "VersionLocator", "long_description": "LongDescription", "long_description_i18n": {"mapKey": "Inner"}, "whitelisted_accounts": ["WhitelistedAccounts"], "image_pull_key_name": "ImagePullKeyName", "deprecate_pending": {"deprecate_date": "2019-01-01T12:00:00.000Z", "deprecate_state": "DeprecateState", "description": "Description"}, "solution_info": {"architecture_diagrams": [{"diagram": {"url": "URL", "api_url": "APIURL", "url_proxy": {"url": "URL", "sha": "Sha"}, "caption": "Caption", "caption_i18n": {"mapKey": "Inner"}, "type": "Type", "thumbnail_url": "ThumbnailURL"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "cost_estimate": {"version": "Version", "currency": "Currency", "projects": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "pastBreakdown": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "breakdown": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "diff": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "summary": {"totalDetectedResources": 22, "totalSupportedResources": 23, "totalUnsupportedResources": 25, "totalUsageBasedResources": 24, "totalNoPriceResources": 21, "unsupportedResourceCounts": {"mapKey": 5}, "noPriceResourceCounts": {"mapKey": 5}}}], "summary": {"totalDetectedResources": 22, "totalSupportedResources": 23, "totalUnsupportedResources": 25, "totalUsageBasedResources": 24, "totalNoPriceResources": 21, "unsupportedResourceCounts": {"mapKey": 5}, "noPriceResourceCounts": {"mapKey": 5}}, "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z"}, "dependencies": [{"catalog_id": "CatalogID", "id": "ID", "name": "Name", "version": "Version", "flavors": ["Flavors"]}]}, "is_consumable": true}], "plans": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "additional_features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "deployments": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z"}]}]}], "pc_managed": false, "publish_approved": false, "share_with_all": true, "share_with_ibm": true, "share_enabled": true, "permit_request_ibm_public_publish": false, "ibm_publish_approved": true, "public_publish_approved": false, "public_original_crn": "PublicOriginalCRN", "publish_public_crn": "PublishPublicCRN", "portal_approval_record": "PortalApprovalRecord", "portal_ui_url": "PortalUIURL", "catalog_id": "CatalogID", "catalog_name": "CatalogName", "metadata": {"mapKey": "anyValue"}, "disclaimer": "Disclaimer", "hidden": true, "provider": "Provider", "provider_info": {"id": "ID", "name": "Name"}, "repo_info": {"token": "Token", "type": "Type"}, "image_pull_keys": [{"name": "Name", "value": "Value", "description": "Description"}], "support": {"url": "URL", "process": "Process", "process_i18n": {"mapKey": "Inner"}, "locations": ["Locations"], "support_details": [{"type": "Type", "contact": "Contact", "response_wait_time": {"value": 5, "type": "Type"}, "availability": {"times": [{"day": 3, "start_time": "StartTime", "end_time": "EndTime"}], "timezone": "Timezone", "always_available": false}}], "support_escalation": {"escalation_wait_time": {"value": 5, "type": "Type"}, "response_wait_time": {"value": 5, "type": "Type"}, "contact": "Contact"}, "support_type": "SupportType"}, "media": [{"url": "URL", "api_url": "APIURL", "url_proxy": {"url": "URL", "sha": "Sha"}, "caption": "Caption", "caption_i18n": {"mapKey": "Inner"}, "type": "Type", "thumbnail_url": "ThumbnailURL"}], "deprecate_pending": {"deprecate_date": "2019-01-01T12:00:00.000Z", "deprecate_state": "DeprecateState", "description": "Description"}, "product_kind": "ProductKind", "badges": [{"id": "ID", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}, "icon": "Icon", "authority": "Authority", "tag": "Tag", "learn_more_links": {"first_party": "FirstParty", "third_party": "ThirdParty"}, "constraints": [{"type": "Type", "rule": "anyValue"}]}]}]}`) + })) + }) + It(`Invoke ListOfferings successfully`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := catalogManagementService.ListOfferings(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListOfferingsOptions model + listOfferingsOptionsModel := new(catalogmanagementv1.ListOfferingsOptions) + listOfferingsOptionsModel.CatalogIdentifier = core.StringPtr("testString") + listOfferingsOptionsModel.Digest = core.BoolPtr(true) + listOfferingsOptionsModel.Limit = core.Int64Ptr(int64(1000)) + listOfferingsOptionsModel.Offset = core.Int64Ptr(int64(38)) + listOfferingsOptionsModel.Name = core.StringPtr("testString") + listOfferingsOptionsModel.Sort = core.StringPtr("testString") + listOfferingsOptionsModel.IncludeHidden = core.BoolPtr(true) + listOfferingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = catalogManagementService.ListOfferings(listOfferingsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListOfferings with error: Operation validation and request error`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Construct an instance of the ListOfferingsOptions model + listOfferingsOptionsModel := new(catalogmanagementv1.ListOfferingsOptions) + listOfferingsOptionsModel.CatalogIdentifier = core.StringPtr("testString") + listOfferingsOptionsModel.Digest = core.BoolPtr(true) + listOfferingsOptionsModel.Limit = core.Int64Ptr(int64(1000)) + listOfferingsOptionsModel.Offset = core.Int64Ptr(int64(38)) + listOfferingsOptionsModel.Name = core.StringPtr("testString") + listOfferingsOptionsModel.Sort = core.StringPtr("testString") + listOfferingsOptionsModel.IncludeHidden = core.BoolPtr(true) + listOfferingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := catalogManagementService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := catalogManagementService.ListOfferings(listOfferingsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the ListOfferingsOptions model with no property values + listOfferingsOptionsModelNew := new(catalogmanagementv1.ListOfferingsOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = catalogManagementService.ListOfferings(listOfferingsOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke ListOfferings successfully`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Construct an instance of the ListOfferingsOptions model + listOfferingsOptionsModel := new(catalogmanagementv1.ListOfferingsOptions) + listOfferingsOptionsModel.CatalogIdentifier = core.StringPtr("testString") + listOfferingsOptionsModel.Digest = core.BoolPtr(true) + listOfferingsOptionsModel.Limit = core.Int64Ptr(int64(1000)) + listOfferingsOptionsModel.Offset = core.Int64Ptr(int64(38)) + listOfferingsOptionsModel.Name = core.StringPtr("testString") + listOfferingsOptionsModel.Sort = core.StringPtr("testString") + listOfferingsOptionsModel.IncludeHidden = core.BoolPtr(true) + listOfferingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := catalogManagementService.ListOfferings(listOfferingsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateOffering(createOfferingOptions *CreateOfferingOptions) - Operation response error`, func() { + createOfferingPath := "/catalogs/testString/offerings" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(createOfferingPath)) + Expect(req.Method).To(Equal("POST")) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(201) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke CreateOffering with error: Operation response processing error`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Construct an instance of the Rating model + ratingModel := new(catalogmanagementv1.Rating) + ratingModel.OneStarCount = core.Int64Ptr(int64(38)) + ratingModel.TwoStarCount = core.Int64Ptr(int64(38)) + ratingModel.ThreeStarCount = core.Int64Ptr(int64(38)) + ratingModel.FourStarCount = core.Int64Ptr(int64(38)) + + // Construct an instance of the Feature model + featureModel := new(catalogmanagementv1.Feature) + featureModel.Title = core.StringPtr("testString") + featureModel.TitleI18n = make(map[string]string) + featureModel.Description = core.StringPtr("testString") + featureModel.DescriptionI18n = make(map[string]string) + + // Construct an instance of the Flavor model + flavorModel := new(catalogmanagementv1.Flavor) + flavorModel.Name = core.StringPtr("testString") + flavorModel.Label = core.StringPtr("testString") + flavorModel.LabelI18n = make(map[string]string) + flavorModel.Index = core.Int64Ptr(int64(38)) + + // Construct an instance of the RenderTypeAssociationsParametersItem model + renderTypeAssociationsParametersItemModel := new(catalogmanagementv1.RenderTypeAssociationsParametersItem) + renderTypeAssociationsParametersItemModel.Name = core.StringPtr("testString") + renderTypeAssociationsParametersItemModel.OptionsRefresh = core.BoolPtr(true) + + // Construct an instance of the RenderTypeAssociations model + renderTypeAssociationsModel := new(catalogmanagementv1.RenderTypeAssociations) + renderTypeAssociationsModel.Parameters = []catalogmanagementv1.RenderTypeAssociationsParametersItem{*renderTypeAssociationsParametersItemModel} + + // Construct an instance of the RenderType model + renderTypeModel := new(catalogmanagementv1.RenderType) + renderTypeModel.Type = core.StringPtr("testString") + renderTypeModel.Grouping = core.StringPtr("testString") + renderTypeModel.OriginalGrouping = core.StringPtr("testString") + renderTypeModel.GroupingIndex = core.Int64Ptr(int64(38)) + renderTypeModel.ConfigConstraints = map[string]interface{}{"anyKey": "anyValue"} + renderTypeModel.Associations = renderTypeAssociationsModel + + // Construct an instance of the Configuration model + configurationModel := new(catalogmanagementv1.Configuration) + configurationModel.Key = core.StringPtr("testString") + configurationModel.Type = core.StringPtr("testString") + configurationModel.DefaultValue = core.StringPtr("testString") + configurationModel.DisplayName = core.StringPtr("testString") + configurationModel.ValueConstraint = core.StringPtr("testString") + configurationModel.Description = core.StringPtr("testString") + configurationModel.Required = core.BoolPtr(true) + configurationModel.Options = []interface{}{"testString"} + configurationModel.Hidden = core.BoolPtr(true) + configurationModel.CustomConfig = renderTypeModel + configurationModel.TypeMetadata = core.StringPtr("testString") + + // Construct an instance of the Output model + outputModel := new(catalogmanagementv1.Output) + outputModel.Key = core.StringPtr("testString") + outputModel.Description = core.StringPtr("testString") + + // Construct an instance of the IamResource model + iamResourceModel := new(catalogmanagementv1.IamResource) + iamResourceModel.Name = core.StringPtr("testString") + iamResourceModel.Description = core.StringPtr("testString") + iamResourceModel.RoleCrns = []string{"testString"} + + // Construct an instance of the IamPermission model + iamPermissionModel := new(catalogmanagementv1.IamPermission) + iamPermissionModel.ServiceName = core.StringPtr("testString") + iamPermissionModel.RoleCrns = []string{"testString"} + iamPermissionModel.Resources = []catalogmanagementv1.IamResource{*iamResourceModel} + + // Construct an instance of the Validation model + validationModel := new(catalogmanagementv1.Validation) + validationModel.Validated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + validationModel.Requested = CreateMockDateTime("2019-01-01T12:00:00.000Z") + validationModel.State = core.StringPtr("testString") + validationModel.LastOperation = core.StringPtr("testString") + validationModel.Target = make(map[string]interface{}) + validationModel.Message = core.StringPtr("testString") + + // Construct an instance of the Resource model + resourceModel := new(catalogmanagementv1.Resource) + resourceModel.Type = core.StringPtr("mem") + resourceModel.Value = core.StringPtr("testString") + + // Construct an instance of the Script model + scriptModel := new(catalogmanagementv1.Script) + scriptModel.Instructions = core.StringPtr("testString") + scriptModel.InstructionsI18n = make(map[string]string) + scriptModel.Script = core.StringPtr("testString") + scriptModel.ScriptPermission = core.StringPtr("testString") + scriptModel.DeleteScript = core.StringPtr("testString") + scriptModel.Scope = core.StringPtr("testString") + + // Construct an instance of the VersionEntitlement model + versionEntitlementModel := new(catalogmanagementv1.VersionEntitlement) + versionEntitlementModel.ProviderName = core.StringPtr("testString") + versionEntitlementModel.ProviderID = core.StringPtr("testString") + versionEntitlementModel.ProductID = core.StringPtr("testString") + versionEntitlementModel.PartNumbers = []string{"testString"} + versionEntitlementModel.ImageRepoName = core.StringPtr("testString") + + // Construct an instance of the License model + licenseModel := new(catalogmanagementv1.License) + licenseModel.ID = core.StringPtr("testString") + licenseModel.Name = core.StringPtr("testString") + licenseModel.Type = core.StringPtr("testString") + licenseModel.URL = core.StringPtr("testString") + licenseModel.Description = core.StringPtr("testString") + + // Construct an instance of the State model + stateModel := new(catalogmanagementv1.State) + stateModel.Current = core.StringPtr("testString") + stateModel.CurrentEntered = CreateMockDateTime("2019-01-01T12:00:00.000Z") + stateModel.Pending = core.StringPtr("testString") + stateModel.PendingRequested = CreateMockDateTime("2019-01-01T12:00:00.000Z") + stateModel.Previous = core.StringPtr("testString") + + // Construct an instance of the DeprecatePending model + deprecatePendingModel := new(catalogmanagementv1.DeprecatePending) + deprecatePendingModel.DeprecateDate = CreateMockDateTime("2019-01-01T12:00:00.000Z") + deprecatePendingModel.DeprecateState = core.StringPtr("testString") + deprecatePendingModel.Description = core.StringPtr("testString") + + // Construct an instance of the URLProxy model + urlProxyModel := new(catalogmanagementv1.URLProxy) + urlProxyModel.URL = core.StringPtr("testString") + urlProxyModel.Sha = core.StringPtr("testString") + + // Construct an instance of the MediaItem model + mediaItemModel := new(catalogmanagementv1.MediaItem) + mediaItemModel.URL = core.StringPtr("testString") + mediaItemModel.APIURL = core.StringPtr("testString") + mediaItemModel.URLProxy = urlProxyModel + mediaItemModel.Caption = core.StringPtr("testString") + mediaItemModel.CaptionI18n = make(map[string]string) + mediaItemModel.Type = core.StringPtr("testString") + mediaItemModel.ThumbnailURL = core.StringPtr("testString") + + // Construct an instance of the ArchitectureDiagram model + architectureDiagramModel := new(catalogmanagementv1.ArchitectureDiagram) + architectureDiagramModel.Diagram = mediaItemModel + architectureDiagramModel.Description = core.StringPtr("testString") + architectureDiagramModel.DescriptionI18n = make(map[string]string) + + // Construct an instance of the CostComponent model + costComponentModel := new(catalogmanagementv1.CostComponent) + costComponentModel.Name = core.StringPtr("testString") + costComponentModel.Unit = core.StringPtr("testString") + costComponentModel.HourlyQuantity = core.StringPtr("testString") + costComponentModel.MonthlyQuantity = core.StringPtr("testString") + costComponentModel.Price = core.StringPtr("testString") + costComponentModel.HourlyCost = core.StringPtr("testString") + costComponentModel.MonthlyCost = core.StringPtr("testString") + + // Construct an instance of the CostResource model + costResourceModel := new(catalogmanagementv1.CostResource) + costResourceModel.Name = core.StringPtr("testString") + costResourceModel.Metadata = make(map[string]interface{}) + costResourceModel.HourlyCost = core.StringPtr("testString") + costResourceModel.MonthlyCost = core.StringPtr("testString") + costResourceModel.CostComponents = []catalogmanagementv1.CostComponent{*costComponentModel} + + // Construct an instance of the CostBreakdown model + costBreakdownModel := new(catalogmanagementv1.CostBreakdown) + costBreakdownModel.TotalHourlyCost = core.StringPtr("testString") + costBreakdownModel.TotalMonthlyCOst = core.StringPtr("testString") + costBreakdownModel.Resources = []catalogmanagementv1.CostResource{*costResourceModel} + + // Construct an instance of the CostSummary model + costSummaryModel := new(catalogmanagementv1.CostSummary) + costSummaryModel.TotalDetectedResources = core.Int64Ptr(int64(38)) + costSummaryModel.TotalSupportedResources = core.Int64Ptr(int64(38)) + costSummaryModel.TotalUnsupportedResources = core.Int64Ptr(int64(38)) + costSummaryModel.TotalUsageBasedResources = core.Int64Ptr(int64(38)) + costSummaryModel.TotalNoPriceResources = core.Int64Ptr(int64(38)) + costSummaryModel.UnsupportedResourceCounts = make(map[string]int64) + costSummaryModel.NoPriceResourceCounts = make(map[string]int64) + + // Construct an instance of the Project model + projectModel := new(catalogmanagementv1.Project) + projectModel.Name = core.StringPtr("testString") + projectModel.Metadata = make(map[string]interface{}) + projectModel.PastBreakdown = costBreakdownModel + projectModel.Breakdown = costBreakdownModel + projectModel.Diff = costBreakdownModel + projectModel.Summary = costSummaryModel + + // Construct an instance of the CostEstimate model + costEstimateModel := new(catalogmanagementv1.CostEstimate) + costEstimateModel.Version = core.StringPtr("testString") + costEstimateModel.Currency = core.StringPtr("testString") + costEstimateModel.Projects = []catalogmanagementv1.Project{*projectModel} + costEstimateModel.Summary = costSummaryModel + costEstimateModel.TotalHourlyCost = core.StringPtr("testString") + costEstimateModel.TotalMonthlyCost = core.StringPtr("testString") + costEstimateModel.PastTotalHourlyCost = core.StringPtr("testString") + costEstimateModel.PastTotalMonthlyCost = core.StringPtr("testString") + costEstimateModel.DiffTotalHourlyCost = core.StringPtr("testString") + costEstimateModel.DiffTotalMonthlyCost = core.StringPtr("testString") + costEstimateModel.TimeGenerated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + + // Construct an instance of the Dependency model + dependencyModel := new(catalogmanagementv1.Dependency) + dependencyModel.CatalogID = core.StringPtr("testString") + dependencyModel.ID = core.StringPtr("testString") + dependencyModel.Name = core.StringPtr("testString") + dependencyModel.Version = core.StringPtr("testString") + dependencyModel.Flavors = []string{"testString"} + + // Construct an instance of the SolutionInfo model + solutionInfoModel := new(catalogmanagementv1.SolutionInfo) + solutionInfoModel.ArchitectureDiagrams = []catalogmanagementv1.ArchitectureDiagram{*architectureDiagramModel} + solutionInfoModel.Features = []catalogmanagementv1.Feature{*featureModel} + solutionInfoModel.CostEstimate = costEstimateModel + solutionInfoModel.Dependencies = []catalogmanagementv1.Dependency{*dependencyModel} + + // Construct an instance of the Version model + versionModel := new(catalogmanagementv1.Version) + versionModel.ID = core.StringPtr("testString") + versionModel.Rev = core.StringPtr("testString") + versionModel.CRN = core.StringPtr("testString") + versionModel.Version = core.StringPtr("testString") + versionModel.Flavor = flavorModel + versionModel.Sha = core.StringPtr("testString") + versionModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + versionModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + versionModel.OfferingID = core.StringPtr("testString") + versionModel.CatalogID = core.StringPtr("testString") + versionModel.KindID = core.StringPtr("testString") + versionModel.Tags = []string{"testString"} + versionModel.RepoURL = core.StringPtr("testString") + versionModel.SourceURL = core.StringPtr("testString") + versionModel.TgzURL = core.StringPtr("testString") + versionModel.Configuration = []catalogmanagementv1.Configuration{*configurationModel} + versionModel.Outputs = []catalogmanagementv1.Output{*outputModel} + versionModel.IamPermissions = []catalogmanagementv1.IamPermission{*iamPermissionModel} + versionModel.Metadata = make(map[string]interface{}) + versionModel.Validation = validationModel + versionModel.RequiredResources = []catalogmanagementv1.Resource{*resourceModel} + versionModel.SingleInstance = core.BoolPtr(true) + versionModel.Install = scriptModel + versionModel.PreInstall = []catalogmanagementv1.Script{*scriptModel} + versionModel.Entitlement = versionEntitlementModel + versionModel.Licenses = []catalogmanagementv1.License{*licenseModel} + versionModel.ImageManifestURL = core.StringPtr("testString") + versionModel.Deprecated = core.BoolPtr(true) + versionModel.PackageVersion = core.StringPtr("testString") + versionModel.State = stateModel + versionModel.VersionLocator = core.StringPtr("testString") + versionModel.LongDescription = core.StringPtr("testString") + versionModel.LongDescriptionI18n = make(map[string]string) + versionModel.WhitelistedAccounts = []string{"testString"} + versionModel.ImagePullKeyName = core.StringPtr("testString") + versionModel.DeprecatePending = deprecatePendingModel + versionModel.SolutionInfo = solutionInfoModel + versionModel.IsConsumable = core.BoolPtr(true) + + // Construct an instance of the Deployment model + deploymentModel := new(catalogmanagementv1.Deployment) + deploymentModel.ID = core.StringPtr("testString") + deploymentModel.Label = core.StringPtr("testString") + deploymentModel.Name = core.StringPtr("testString") + deploymentModel.ShortDescription = core.StringPtr("testString") + deploymentModel.LongDescription = core.StringPtr("testString") + deploymentModel.Metadata = make(map[string]interface{}) + deploymentModel.Tags = []string{"testString"} + deploymentModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + deploymentModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + + // Construct an instance of the Plan model + planModel := new(catalogmanagementv1.Plan) + planModel.ID = core.StringPtr("testString") + planModel.Label = core.StringPtr("testString") + planModel.Name = core.StringPtr("testString") + planModel.ShortDescription = core.StringPtr("testString") + planModel.LongDescription = core.StringPtr("testString") + planModel.Metadata = make(map[string]interface{}) + planModel.Tags = []string{"testString"} + planModel.AdditionalFeatures = []catalogmanagementv1.Feature{*featureModel} + planModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + planModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + planModel.Deployments = []catalogmanagementv1.Deployment{*deploymentModel} + + // Construct an instance of the Kind model + kindModel := new(catalogmanagementv1.Kind) + kindModel.ID = core.StringPtr("testString") + kindModel.FormatKind = core.StringPtr("testString") + kindModel.InstallKind = core.StringPtr("testString") + kindModel.TargetKind = core.StringPtr("testString") + kindModel.Metadata = make(map[string]interface{}) + kindModel.Tags = []string{"testString"} + kindModel.AdditionalFeatures = []catalogmanagementv1.Feature{*featureModel} + kindModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + kindModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + kindModel.Versions = []catalogmanagementv1.Version{*versionModel} + kindModel.Plans = []catalogmanagementv1.Plan{*planModel} + + // Construct an instance of the ProviderInfo model + providerInfoModel := new(catalogmanagementv1.ProviderInfo) + providerInfoModel.ID = core.StringPtr("testString") + providerInfoModel.Name = core.StringPtr("testString") + + // Construct an instance of the RepoInfo model + repoInfoModel := new(catalogmanagementv1.RepoInfo) + repoInfoModel.Token = core.StringPtr("testString") + repoInfoModel.Type = core.StringPtr("testString") + + // Construct an instance of the ImagePullKey model + imagePullKeyModel := new(catalogmanagementv1.ImagePullKey) + imagePullKeyModel.Name = core.StringPtr("testString") + imagePullKeyModel.Value = core.StringPtr("testString") + imagePullKeyModel.Description = core.StringPtr("testString") + + // Construct an instance of the SupportWaitTime model + supportWaitTimeModel := new(catalogmanagementv1.SupportWaitTime) + supportWaitTimeModel.Value = core.Int64Ptr(int64(38)) + supportWaitTimeModel.Type = core.StringPtr("testString") + + // Construct an instance of the SupportTime model + supportTimeModel := new(catalogmanagementv1.SupportTime) + supportTimeModel.Day = core.Int64Ptr(int64(38)) + supportTimeModel.StartTime = core.StringPtr("testString") + supportTimeModel.EndTime = core.StringPtr("testString") + + // Construct an instance of the SupportAvailability model + supportAvailabilityModel := new(catalogmanagementv1.SupportAvailability) + supportAvailabilityModel.Times = []catalogmanagementv1.SupportTime{*supportTimeModel} + supportAvailabilityModel.Timezone = core.StringPtr("testString") + supportAvailabilityModel.AlwaysAvailable = core.BoolPtr(true) + + // Construct an instance of the SupportDetail model + supportDetailModel := new(catalogmanagementv1.SupportDetail) + supportDetailModel.Type = core.StringPtr("testString") + supportDetailModel.Contact = core.StringPtr("testString") + supportDetailModel.ResponseWaitTime = supportWaitTimeModel + supportDetailModel.Availability = supportAvailabilityModel + + // Construct an instance of the SupportEscalation model + supportEscalationModel := new(catalogmanagementv1.SupportEscalation) + supportEscalationModel.EscalationWaitTime = supportWaitTimeModel + supportEscalationModel.ResponseWaitTime = supportWaitTimeModel + supportEscalationModel.Contact = core.StringPtr("testString") + + // Construct an instance of the Support model + supportModel := new(catalogmanagementv1.Support) + supportModel.URL = core.StringPtr("testString") + supportModel.Process = core.StringPtr("testString") + supportModel.ProcessI18n = make(map[string]string) + supportModel.Locations = []string{"testString"} + supportModel.SupportDetails = []catalogmanagementv1.SupportDetail{*supportDetailModel} + supportModel.SupportEscalation = supportEscalationModel + supportModel.SupportType = core.StringPtr("testString") + + // Construct an instance of the LearnMoreLinks model + learnMoreLinksModel := new(catalogmanagementv1.LearnMoreLinks) + learnMoreLinksModel.FirstParty = core.StringPtr("testString") + learnMoreLinksModel.ThirdParty = core.StringPtr("testString") + + // Construct an instance of the Constraint model + constraintModel := new(catalogmanagementv1.Constraint) + constraintModel.Type = core.StringPtr("testString") + constraintModel.Rule = core.StringPtr("testString") + + // Construct an instance of the Badge model + badgeModel := new(catalogmanagementv1.Badge) + badgeModel.ID = core.StringPtr("testString") + badgeModel.Label = core.StringPtr("testString") + badgeModel.LabelI18n = make(map[string]string) + badgeModel.Description = core.StringPtr("testString") + badgeModel.DescriptionI18n = make(map[string]string) + badgeModel.Icon = core.StringPtr("testString") + badgeModel.Authority = core.StringPtr("testString") + badgeModel.Tag = core.StringPtr("testString") + badgeModel.LearnMoreLinks = learnMoreLinksModel + badgeModel.Constraints = []catalogmanagementv1.Constraint{*constraintModel} + + // Construct an instance of the CreateOfferingOptions model + createOfferingOptionsModel := new(catalogmanagementv1.CreateOfferingOptions) + createOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") + createOfferingOptionsModel.ID = core.StringPtr("testString") + createOfferingOptionsModel.Rev = core.StringPtr("testString") + createOfferingOptionsModel.URL = core.StringPtr("testString") + createOfferingOptionsModel.CRN = core.StringPtr("testString") + createOfferingOptionsModel.Label = core.StringPtr("testString") + createOfferingOptionsModel.LabelI18n = make(map[string]string) + createOfferingOptionsModel.Name = core.StringPtr("testString") + createOfferingOptionsModel.OfferingIconURL = core.StringPtr("testString") + createOfferingOptionsModel.OfferingDocsURL = core.StringPtr("testString") + createOfferingOptionsModel.OfferingSupportURL = core.StringPtr("testString") + createOfferingOptionsModel.Tags = []string{"testString"} + createOfferingOptionsModel.Keywords = []string{"testString"} + createOfferingOptionsModel.Rating = ratingModel + createOfferingOptionsModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + createOfferingOptionsModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + createOfferingOptionsModel.ShortDescription = core.StringPtr("testString") + createOfferingOptionsModel.ShortDescriptionI18n = make(map[string]string) + createOfferingOptionsModel.LongDescription = core.StringPtr("testString") + createOfferingOptionsModel.LongDescriptionI18n = make(map[string]string) + createOfferingOptionsModel.Features = []catalogmanagementv1.Feature{*featureModel} + createOfferingOptionsModel.Kinds = []catalogmanagementv1.Kind{*kindModel} + createOfferingOptionsModel.PcManaged = core.BoolPtr(true) + createOfferingOptionsModel.PublishApproved = core.BoolPtr(true) + createOfferingOptionsModel.ShareWithAll = core.BoolPtr(true) + createOfferingOptionsModel.ShareWithIBM = core.BoolPtr(true) + createOfferingOptionsModel.ShareEnabled = core.BoolPtr(true) + createOfferingOptionsModel.PermitRequestIBMPublicPublish = core.BoolPtr(true) + createOfferingOptionsModel.IBMPublishApproved = core.BoolPtr(true) + createOfferingOptionsModel.PublicPublishApproved = core.BoolPtr(true) + createOfferingOptionsModel.PublicOriginalCRN = core.StringPtr("testString") + createOfferingOptionsModel.PublishPublicCRN = core.StringPtr("testString") + createOfferingOptionsModel.PortalApprovalRecord = core.StringPtr("testString") + createOfferingOptionsModel.PortalUIURL = core.StringPtr("testString") + createOfferingOptionsModel.CatalogID = core.StringPtr("testString") + createOfferingOptionsModel.CatalogName = core.StringPtr("testString") + createOfferingOptionsModel.Metadata = make(map[string]interface{}) + createOfferingOptionsModel.Disclaimer = core.StringPtr("testString") + createOfferingOptionsModel.Hidden = core.BoolPtr(true) + createOfferingOptionsModel.Provider = core.StringPtr("testString") + createOfferingOptionsModel.ProviderInfo = providerInfoModel + createOfferingOptionsModel.RepoInfo = repoInfoModel + createOfferingOptionsModel.ImagePullKeys = []catalogmanagementv1.ImagePullKey{*imagePullKeyModel} + createOfferingOptionsModel.Support = supportModel + createOfferingOptionsModel.Media = []catalogmanagementv1.MediaItem{*mediaItemModel} + createOfferingOptionsModel.DeprecatePending = deprecatePendingModel + createOfferingOptionsModel.ProductKind = core.StringPtr("testString") + createOfferingOptionsModel.Badges = []catalogmanagementv1.Badge{*badgeModel} + createOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := catalogManagementService.CreateOffering(createOfferingOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + catalogManagementService.EnableRetries(0, 0) + result, response, operationErr = catalogManagementService.CreateOffering(createOfferingOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateOffering(createOfferingOptions *CreateOfferingOptions)`, func() { + createOfferingPath := "/catalogs/testString/offerings" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(createOfferingPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "url": "URL", "crn": "CRN", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "name": "Name", "offering_icon_url": "OfferingIconURL", "offering_docs_url": "OfferingDocsURL", "offering_support_url": "OfferingSupportURL", "tags": ["Tags"], "keywords": ["Keywords"], "rating": {"one_star_count": 12, "two_star_count": 12, "three_star_count": 14, "four_star_count": 13}, "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "short_description": "ShortDescription", "short_description_i18n": {"mapKey": "Inner"}, "long_description": "LongDescription", "long_description_i18n": {"mapKey": "Inner"}, "features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "kinds": [{"id": "ID", "format_kind": "FormatKind", "install_kind": "InstallKind", "target_kind": "TargetKind", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "additional_features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "versions": [{"id": "ID", "_rev": "Rev", "crn": "CRN", "version": "Version", "flavor": {"name": "Name", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "index": 5}, "sha": "Sha", "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "offering_id": "OfferingID", "catalog_id": "CatalogID", "kind_id": "KindID", "tags": ["Tags"], "repo_url": "RepoURL", "source_url": "SourceURL", "tgz_url": "TgzURL", "configuration": [{"key": "Key", "type": "Type", "default_value": "anyValue", "display_name": "DisplayName", "value_constraint": "ValueConstraint", "description": "Description", "required": true, "options": ["anyValue"], "hidden": true, "custom_config": {"type": "Type", "grouping": "Grouping", "original_grouping": "OriginalGrouping", "grouping_index": 13, "config_constraints": {"anyKey": "anyValue"}, "associations": {"parameters": [{"name": "Name", "optionsRefresh": true}]}}, "type_metadata": "TypeMetadata"}], "outputs": [{"key": "Key", "description": "Description"}], "iam_permissions": [{"service_name": "ServiceName", "role_crns": ["RoleCrns"], "resources": [{"name": "Name", "description": "Description", "role_crns": ["RoleCrns"]}]}], "metadata": {"mapKey": "anyValue"}, "validation": {"validated": "2019-01-01T12:00:00.000Z", "requested": "2019-01-01T12:00:00.000Z", "state": "State", "last_operation": "LastOperation", "target": {"mapKey": "anyValue"}, "message": "Message"}, "required_resources": [{"type": "mem", "value": "anyValue"}], "single_instance": true, "install": {"instructions": "Instructions", "instructions_i18n": {"mapKey": "Inner"}, "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}, "pre_install": [{"instructions": "Instructions", "instructions_i18n": {"mapKey": "Inner"}, "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}], "entitlement": {"provider_name": "ProviderName", "provider_id": "ProviderID", "product_id": "ProductID", "part_numbers": ["PartNumbers"], "image_repo_name": "ImageRepoName"}, "licenses": [{"id": "ID", "name": "Name", "type": "Type", "url": "URL", "description": "Description"}], "image_manifest_url": "ImageManifestURL", "deprecated": true, "package_version": "PackageVersion", "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "version_locator": "VersionLocator", "long_description": "LongDescription", "long_description_i18n": {"mapKey": "Inner"}, "whitelisted_accounts": ["WhitelistedAccounts"], "image_pull_key_name": "ImagePullKeyName", "deprecate_pending": {"deprecate_date": "2019-01-01T12:00:00.000Z", "deprecate_state": "DeprecateState", "description": "Description"}, "solution_info": {"architecture_diagrams": [{"diagram": {"url": "URL", "api_url": "APIURL", "url_proxy": {"url": "URL", "sha": "Sha"}, "caption": "Caption", "caption_i18n": {"mapKey": "Inner"}, "type": "Type", "thumbnail_url": "ThumbnailURL"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "cost_estimate": {"version": "Version", "currency": "Currency", "projects": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "pastBreakdown": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "breakdown": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "diff": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "summary": {"totalDetectedResources": 22, "totalSupportedResources": 23, "totalUnsupportedResources": 25, "totalUsageBasedResources": 24, "totalNoPriceResources": 21, "unsupportedResourceCounts": {"mapKey": 5}, "noPriceResourceCounts": {"mapKey": 5}}}], "summary": {"totalDetectedResources": 22, "totalSupportedResources": 23, "totalUnsupportedResources": 25, "totalUsageBasedResources": 24, "totalNoPriceResources": 21, "unsupportedResourceCounts": {"mapKey": 5}, "noPriceResourceCounts": {"mapKey": 5}}, "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z"}, "dependencies": [{"catalog_id": "CatalogID", "id": "ID", "name": "Name", "version": "Version", "flavors": ["Flavors"]}]}, "is_consumable": true}], "plans": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "additional_features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "deployments": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z"}]}]}], "pc_managed": false, "publish_approved": false, "share_with_all": true, "share_with_ibm": true, "share_enabled": true, "permit_request_ibm_public_publish": false, "ibm_publish_approved": true, "public_publish_approved": false, "public_original_crn": "PublicOriginalCRN", "publish_public_crn": "PublishPublicCRN", "portal_approval_record": "PortalApprovalRecord", "portal_ui_url": "PortalUIURL", "catalog_id": "CatalogID", "catalog_name": "CatalogName", "metadata": {"mapKey": "anyValue"}, "disclaimer": "Disclaimer", "hidden": true, "provider": "Provider", "provider_info": {"id": "ID", "name": "Name"}, "repo_info": {"token": "Token", "type": "Type"}, "image_pull_keys": [{"name": "Name", "value": "Value", "description": "Description"}], "support": {"url": "URL", "process": "Process", "process_i18n": {"mapKey": "Inner"}, "locations": ["Locations"], "support_details": [{"type": "Type", "contact": "Contact", "response_wait_time": {"value": 5, "type": "Type"}, "availability": {"times": [{"day": 3, "start_time": "StartTime", "end_time": "EndTime"}], "timezone": "Timezone", "always_available": false}}], "support_escalation": {"escalation_wait_time": {"value": 5, "type": "Type"}, "response_wait_time": {"value": 5, "type": "Type"}, "contact": "Contact"}, "support_type": "SupportType"}, "media": [{"url": "URL", "api_url": "APIURL", "url_proxy": {"url": "URL", "sha": "Sha"}, "caption": "Caption", "caption_i18n": {"mapKey": "Inner"}, "type": "Type", "thumbnail_url": "ThumbnailURL"}], "deprecate_pending": {"deprecate_date": "2019-01-01T12:00:00.000Z", "deprecate_state": "DeprecateState", "description": "Description"}, "product_kind": "ProductKind", "badges": [{"id": "ID", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}, "icon": "Icon", "authority": "Authority", "tag": "Tag", "learn_more_links": {"first_party": "FirstParty", "third_party": "ThirdParty"}, "constraints": [{"type": "Type", "rule": "anyValue"}]}]}`) + })) + }) + It(`Invoke CreateOffering successfully with retries`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + catalogManagementService.EnableRetries(0, 0) + + // Construct an instance of the Rating model + ratingModel := new(catalogmanagementv1.Rating) + ratingModel.OneStarCount = core.Int64Ptr(int64(38)) + ratingModel.TwoStarCount = core.Int64Ptr(int64(38)) + ratingModel.ThreeStarCount = core.Int64Ptr(int64(38)) + ratingModel.FourStarCount = core.Int64Ptr(int64(38)) + + // Construct an instance of the Feature model + featureModel := new(catalogmanagementv1.Feature) + featureModel.Title = core.StringPtr("testString") + featureModel.TitleI18n = make(map[string]string) + featureModel.Description = core.StringPtr("testString") + featureModel.DescriptionI18n = make(map[string]string) + + // Construct an instance of the Flavor model + flavorModel := new(catalogmanagementv1.Flavor) + flavorModel.Name = core.StringPtr("testString") + flavorModel.Label = core.StringPtr("testString") + flavorModel.LabelI18n = make(map[string]string) + flavorModel.Index = core.Int64Ptr(int64(38)) + + // Construct an instance of the RenderTypeAssociationsParametersItem model + renderTypeAssociationsParametersItemModel := new(catalogmanagementv1.RenderTypeAssociationsParametersItem) + renderTypeAssociationsParametersItemModel.Name = core.StringPtr("testString") + renderTypeAssociationsParametersItemModel.OptionsRefresh = core.BoolPtr(true) + + // Construct an instance of the RenderTypeAssociations model + renderTypeAssociationsModel := new(catalogmanagementv1.RenderTypeAssociations) + renderTypeAssociationsModel.Parameters = []catalogmanagementv1.RenderTypeAssociationsParametersItem{*renderTypeAssociationsParametersItemModel} + + // Construct an instance of the RenderType model + renderTypeModel := new(catalogmanagementv1.RenderType) + renderTypeModel.Type = core.StringPtr("testString") + renderTypeModel.Grouping = core.StringPtr("testString") + renderTypeModel.OriginalGrouping = core.StringPtr("testString") + renderTypeModel.GroupingIndex = core.Int64Ptr(int64(38)) + renderTypeModel.ConfigConstraints = map[string]interface{}{"anyKey": "anyValue"} + renderTypeModel.Associations = renderTypeAssociationsModel + + // Construct an instance of the Configuration model + configurationModel := new(catalogmanagementv1.Configuration) + configurationModel.Key = core.StringPtr("testString") + configurationModel.Type = core.StringPtr("testString") + configurationModel.DefaultValue = core.StringPtr("testString") + configurationModel.DisplayName = core.StringPtr("testString") + configurationModel.ValueConstraint = core.StringPtr("testString") + configurationModel.Description = core.StringPtr("testString") + configurationModel.Required = core.BoolPtr(true) + configurationModel.Options = []interface{}{"testString"} + configurationModel.Hidden = core.BoolPtr(true) + configurationModel.CustomConfig = renderTypeModel + configurationModel.TypeMetadata = core.StringPtr("testString") + + // Construct an instance of the Output model + outputModel := new(catalogmanagementv1.Output) + outputModel.Key = core.StringPtr("testString") + outputModel.Description = core.StringPtr("testString") + + // Construct an instance of the IamResource model + iamResourceModel := new(catalogmanagementv1.IamResource) + iamResourceModel.Name = core.StringPtr("testString") + iamResourceModel.Description = core.StringPtr("testString") + iamResourceModel.RoleCrns = []string{"testString"} + + // Construct an instance of the IamPermission model + iamPermissionModel := new(catalogmanagementv1.IamPermission) + iamPermissionModel.ServiceName = core.StringPtr("testString") + iamPermissionModel.RoleCrns = []string{"testString"} + iamPermissionModel.Resources = []catalogmanagementv1.IamResource{*iamResourceModel} + + // Construct an instance of the Validation model + validationModel := new(catalogmanagementv1.Validation) + validationModel.Validated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + validationModel.Requested = CreateMockDateTime("2019-01-01T12:00:00.000Z") + validationModel.State = core.StringPtr("testString") + validationModel.LastOperation = core.StringPtr("testString") + validationModel.Target = make(map[string]interface{}) + validationModel.Message = core.StringPtr("testString") + + // Construct an instance of the Resource model + resourceModel := new(catalogmanagementv1.Resource) + resourceModel.Type = core.StringPtr("mem") + resourceModel.Value = core.StringPtr("testString") + + // Construct an instance of the Script model + scriptModel := new(catalogmanagementv1.Script) + scriptModel.Instructions = core.StringPtr("testString") + scriptModel.InstructionsI18n = make(map[string]string) + scriptModel.Script = core.StringPtr("testString") + scriptModel.ScriptPermission = core.StringPtr("testString") + scriptModel.DeleteScript = core.StringPtr("testString") + scriptModel.Scope = core.StringPtr("testString") + + // Construct an instance of the VersionEntitlement model + versionEntitlementModel := new(catalogmanagementv1.VersionEntitlement) + versionEntitlementModel.ProviderName = core.StringPtr("testString") + versionEntitlementModel.ProviderID = core.StringPtr("testString") + versionEntitlementModel.ProductID = core.StringPtr("testString") + versionEntitlementModel.PartNumbers = []string{"testString"} + versionEntitlementModel.ImageRepoName = core.StringPtr("testString") + + // Construct an instance of the License model + licenseModel := new(catalogmanagementv1.License) + licenseModel.ID = core.StringPtr("testString") + licenseModel.Name = core.StringPtr("testString") + licenseModel.Type = core.StringPtr("testString") + licenseModel.URL = core.StringPtr("testString") + licenseModel.Description = core.StringPtr("testString") + + // Construct an instance of the State model + stateModel := new(catalogmanagementv1.State) + stateModel.Current = core.StringPtr("testString") + stateModel.CurrentEntered = CreateMockDateTime("2019-01-01T12:00:00.000Z") + stateModel.Pending = core.StringPtr("testString") + stateModel.PendingRequested = CreateMockDateTime("2019-01-01T12:00:00.000Z") + stateModel.Previous = core.StringPtr("testString") + + // Construct an instance of the DeprecatePending model + deprecatePendingModel := new(catalogmanagementv1.DeprecatePending) + deprecatePendingModel.DeprecateDate = CreateMockDateTime("2019-01-01T12:00:00.000Z") + deprecatePendingModel.DeprecateState = core.StringPtr("testString") + deprecatePendingModel.Description = core.StringPtr("testString") + + // Construct an instance of the URLProxy model + urlProxyModel := new(catalogmanagementv1.URLProxy) + urlProxyModel.URL = core.StringPtr("testString") + urlProxyModel.Sha = core.StringPtr("testString") + + // Construct an instance of the MediaItem model + mediaItemModel := new(catalogmanagementv1.MediaItem) + mediaItemModel.URL = core.StringPtr("testString") + mediaItemModel.APIURL = core.StringPtr("testString") + mediaItemModel.URLProxy = urlProxyModel + mediaItemModel.Caption = core.StringPtr("testString") + mediaItemModel.CaptionI18n = make(map[string]string) + mediaItemModel.Type = core.StringPtr("testString") + mediaItemModel.ThumbnailURL = core.StringPtr("testString") + + // Construct an instance of the ArchitectureDiagram model + architectureDiagramModel := new(catalogmanagementv1.ArchitectureDiagram) + architectureDiagramModel.Diagram = mediaItemModel + architectureDiagramModel.Description = core.StringPtr("testString") + architectureDiagramModel.DescriptionI18n = make(map[string]string) + + // Construct an instance of the CostComponent model + costComponentModel := new(catalogmanagementv1.CostComponent) + costComponentModel.Name = core.StringPtr("testString") + costComponentModel.Unit = core.StringPtr("testString") + costComponentModel.HourlyQuantity = core.StringPtr("testString") + costComponentModel.MonthlyQuantity = core.StringPtr("testString") + costComponentModel.Price = core.StringPtr("testString") + costComponentModel.HourlyCost = core.StringPtr("testString") + costComponentModel.MonthlyCost = core.StringPtr("testString") + + // Construct an instance of the CostResource model + costResourceModel := new(catalogmanagementv1.CostResource) + costResourceModel.Name = core.StringPtr("testString") + costResourceModel.Metadata = make(map[string]interface{}) + costResourceModel.HourlyCost = core.StringPtr("testString") + costResourceModel.MonthlyCost = core.StringPtr("testString") + costResourceModel.CostComponents = []catalogmanagementv1.CostComponent{*costComponentModel} + + // Construct an instance of the CostBreakdown model + costBreakdownModel := new(catalogmanagementv1.CostBreakdown) + costBreakdownModel.TotalHourlyCost = core.StringPtr("testString") + costBreakdownModel.TotalMonthlyCOst = core.StringPtr("testString") + costBreakdownModel.Resources = []catalogmanagementv1.CostResource{*costResourceModel} + + // Construct an instance of the CostSummary model + costSummaryModel := new(catalogmanagementv1.CostSummary) + costSummaryModel.TotalDetectedResources = core.Int64Ptr(int64(38)) + costSummaryModel.TotalSupportedResources = core.Int64Ptr(int64(38)) + costSummaryModel.TotalUnsupportedResources = core.Int64Ptr(int64(38)) + costSummaryModel.TotalUsageBasedResources = core.Int64Ptr(int64(38)) + costSummaryModel.TotalNoPriceResources = core.Int64Ptr(int64(38)) + costSummaryModel.UnsupportedResourceCounts = make(map[string]int64) + costSummaryModel.NoPriceResourceCounts = make(map[string]int64) + + // Construct an instance of the Project model + projectModel := new(catalogmanagementv1.Project) + projectModel.Name = core.StringPtr("testString") + projectModel.Metadata = make(map[string]interface{}) + projectModel.PastBreakdown = costBreakdownModel + projectModel.Breakdown = costBreakdownModel + projectModel.Diff = costBreakdownModel + projectModel.Summary = costSummaryModel + + // Construct an instance of the CostEstimate model + costEstimateModel := new(catalogmanagementv1.CostEstimate) + costEstimateModel.Version = core.StringPtr("testString") + costEstimateModel.Currency = core.StringPtr("testString") + costEstimateModel.Projects = []catalogmanagementv1.Project{*projectModel} + costEstimateModel.Summary = costSummaryModel + costEstimateModel.TotalHourlyCost = core.StringPtr("testString") + costEstimateModel.TotalMonthlyCost = core.StringPtr("testString") + costEstimateModel.PastTotalHourlyCost = core.StringPtr("testString") + costEstimateModel.PastTotalMonthlyCost = core.StringPtr("testString") + costEstimateModel.DiffTotalHourlyCost = core.StringPtr("testString") + costEstimateModel.DiffTotalMonthlyCost = core.StringPtr("testString") + costEstimateModel.TimeGenerated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + + // Construct an instance of the Dependency model + dependencyModel := new(catalogmanagementv1.Dependency) + dependencyModel.CatalogID = core.StringPtr("testString") + dependencyModel.ID = core.StringPtr("testString") + dependencyModel.Name = core.StringPtr("testString") + dependencyModel.Version = core.StringPtr("testString") + dependencyModel.Flavors = []string{"testString"} + + // Construct an instance of the SolutionInfo model + solutionInfoModel := new(catalogmanagementv1.SolutionInfo) + solutionInfoModel.ArchitectureDiagrams = []catalogmanagementv1.ArchitectureDiagram{*architectureDiagramModel} + solutionInfoModel.Features = []catalogmanagementv1.Feature{*featureModel} + solutionInfoModel.CostEstimate = costEstimateModel + solutionInfoModel.Dependencies = []catalogmanagementv1.Dependency{*dependencyModel} + + // Construct an instance of the Version model + versionModel := new(catalogmanagementv1.Version) + versionModel.ID = core.StringPtr("testString") + versionModel.Rev = core.StringPtr("testString") + versionModel.CRN = core.StringPtr("testString") + versionModel.Version = core.StringPtr("testString") + versionModel.Flavor = flavorModel + versionModel.Sha = core.StringPtr("testString") + versionModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + versionModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + versionModel.OfferingID = core.StringPtr("testString") + versionModel.CatalogID = core.StringPtr("testString") + versionModel.KindID = core.StringPtr("testString") + versionModel.Tags = []string{"testString"} + versionModel.RepoURL = core.StringPtr("testString") + versionModel.SourceURL = core.StringPtr("testString") + versionModel.TgzURL = core.StringPtr("testString") + versionModel.Configuration = []catalogmanagementv1.Configuration{*configurationModel} + versionModel.Outputs = []catalogmanagementv1.Output{*outputModel} + versionModel.IamPermissions = []catalogmanagementv1.IamPermission{*iamPermissionModel} + versionModel.Metadata = make(map[string]interface{}) + versionModel.Validation = validationModel + versionModel.RequiredResources = []catalogmanagementv1.Resource{*resourceModel} + versionModel.SingleInstance = core.BoolPtr(true) + versionModel.Install = scriptModel + versionModel.PreInstall = []catalogmanagementv1.Script{*scriptModel} + versionModel.Entitlement = versionEntitlementModel + versionModel.Licenses = []catalogmanagementv1.License{*licenseModel} + versionModel.ImageManifestURL = core.StringPtr("testString") + versionModel.Deprecated = core.BoolPtr(true) + versionModel.PackageVersion = core.StringPtr("testString") + versionModel.State = stateModel + versionModel.VersionLocator = core.StringPtr("testString") + versionModel.LongDescription = core.StringPtr("testString") + versionModel.LongDescriptionI18n = make(map[string]string) + versionModel.WhitelistedAccounts = []string{"testString"} + versionModel.ImagePullKeyName = core.StringPtr("testString") + versionModel.DeprecatePending = deprecatePendingModel + versionModel.SolutionInfo = solutionInfoModel + versionModel.IsConsumable = core.BoolPtr(true) + + // Construct an instance of the Deployment model + deploymentModel := new(catalogmanagementv1.Deployment) + deploymentModel.ID = core.StringPtr("testString") + deploymentModel.Label = core.StringPtr("testString") + deploymentModel.Name = core.StringPtr("testString") + deploymentModel.ShortDescription = core.StringPtr("testString") + deploymentModel.LongDescription = core.StringPtr("testString") + deploymentModel.Metadata = make(map[string]interface{}) + deploymentModel.Tags = []string{"testString"} + deploymentModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + deploymentModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + + // Construct an instance of the Plan model + planModel := new(catalogmanagementv1.Plan) + planModel.ID = core.StringPtr("testString") + planModel.Label = core.StringPtr("testString") + planModel.Name = core.StringPtr("testString") + planModel.ShortDescription = core.StringPtr("testString") + planModel.LongDescription = core.StringPtr("testString") + planModel.Metadata = make(map[string]interface{}) + planModel.Tags = []string{"testString"} + planModel.AdditionalFeatures = []catalogmanagementv1.Feature{*featureModel} + planModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + planModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + planModel.Deployments = []catalogmanagementv1.Deployment{*deploymentModel} + + // Construct an instance of the Kind model + kindModel := new(catalogmanagementv1.Kind) + kindModel.ID = core.StringPtr("testString") + kindModel.FormatKind = core.StringPtr("testString") + kindModel.InstallKind = core.StringPtr("testString") + kindModel.TargetKind = core.StringPtr("testString") + kindModel.Metadata = make(map[string]interface{}) + kindModel.Tags = []string{"testString"} + kindModel.AdditionalFeatures = []catalogmanagementv1.Feature{*featureModel} + kindModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + kindModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + kindModel.Versions = []catalogmanagementv1.Version{*versionModel} + kindModel.Plans = []catalogmanagementv1.Plan{*planModel} + + // Construct an instance of the ProviderInfo model + providerInfoModel := new(catalogmanagementv1.ProviderInfo) + providerInfoModel.ID = core.StringPtr("testString") + providerInfoModel.Name = core.StringPtr("testString") + + // Construct an instance of the RepoInfo model + repoInfoModel := new(catalogmanagementv1.RepoInfo) + repoInfoModel.Token = core.StringPtr("testString") + repoInfoModel.Type = core.StringPtr("testString") + + // Construct an instance of the ImagePullKey model + imagePullKeyModel := new(catalogmanagementv1.ImagePullKey) + imagePullKeyModel.Name = core.StringPtr("testString") + imagePullKeyModel.Value = core.StringPtr("testString") + imagePullKeyModel.Description = core.StringPtr("testString") + + // Construct an instance of the SupportWaitTime model + supportWaitTimeModel := new(catalogmanagementv1.SupportWaitTime) + supportWaitTimeModel.Value = core.Int64Ptr(int64(38)) + supportWaitTimeModel.Type = core.StringPtr("testString") + + // Construct an instance of the SupportTime model + supportTimeModel := new(catalogmanagementv1.SupportTime) + supportTimeModel.Day = core.Int64Ptr(int64(38)) + supportTimeModel.StartTime = core.StringPtr("testString") + supportTimeModel.EndTime = core.StringPtr("testString") + + // Construct an instance of the SupportAvailability model + supportAvailabilityModel := new(catalogmanagementv1.SupportAvailability) + supportAvailabilityModel.Times = []catalogmanagementv1.SupportTime{*supportTimeModel} + supportAvailabilityModel.Timezone = core.StringPtr("testString") + supportAvailabilityModel.AlwaysAvailable = core.BoolPtr(true) + + // Construct an instance of the SupportDetail model + supportDetailModel := new(catalogmanagementv1.SupportDetail) + supportDetailModel.Type = core.StringPtr("testString") + supportDetailModel.Contact = core.StringPtr("testString") + supportDetailModel.ResponseWaitTime = supportWaitTimeModel + supportDetailModel.Availability = supportAvailabilityModel + + // Construct an instance of the SupportEscalation model + supportEscalationModel := new(catalogmanagementv1.SupportEscalation) + supportEscalationModel.EscalationWaitTime = supportWaitTimeModel + supportEscalationModel.ResponseWaitTime = supportWaitTimeModel + supportEscalationModel.Contact = core.StringPtr("testString") + + // Construct an instance of the Support model + supportModel := new(catalogmanagementv1.Support) + supportModel.URL = core.StringPtr("testString") + supportModel.Process = core.StringPtr("testString") + supportModel.ProcessI18n = make(map[string]string) + supportModel.Locations = []string{"testString"} + supportModel.SupportDetails = []catalogmanagementv1.SupportDetail{*supportDetailModel} + supportModel.SupportEscalation = supportEscalationModel + supportModel.SupportType = core.StringPtr("testString") + + // Construct an instance of the LearnMoreLinks model + learnMoreLinksModel := new(catalogmanagementv1.LearnMoreLinks) + learnMoreLinksModel.FirstParty = core.StringPtr("testString") + learnMoreLinksModel.ThirdParty = core.StringPtr("testString") + + // Construct an instance of the Constraint model + constraintModel := new(catalogmanagementv1.Constraint) + constraintModel.Type = core.StringPtr("testString") + constraintModel.Rule = core.StringPtr("testString") + + // Construct an instance of the Badge model + badgeModel := new(catalogmanagementv1.Badge) + badgeModel.ID = core.StringPtr("testString") + badgeModel.Label = core.StringPtr("testString") + badgeModel.LabelI18n = make(map[string]string) + badgeModel.Description = core.StringPtr("testString") + badgeModel.DescriptionI18n = make(map[string]string) + badgeModel.Icon = core.StringPtr("testString") + badgeModel.Authority = core.StringPtr("testString") + badgeModel.Tag = core.StringPtr("testString") + badgeModel.LearnMoreLinks = learnMoreLinksModel + badgeModel.Constraints = []catalogmanagementv1.Constraint{*constraintModel} + + // Construct an instance of the CreateOfferingOptions model + createOfferingOptionsModel := new(catalogmanagementv1.CreateOfferingOptions) + createOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") + createOfferingOptionsModel.ID = core.StringPtr("testString") + createOfferingOptionsModel.Rev = core.StringPtr("testString") + createOfferingOptionsModel.URL = core.StringPtr("testString") + createOfferingOptionsModel.CRN = core.StringPtr("testString") + createOfferingOptionsModel.Label = core.StringPtr("testString") + createOfferingOptionsModel.LabelI18n = make(map[string]string) + createOfferingOptionsModel.Name = core.StringPtr("testString") + createOfferingOptionsModel.OfferingIconURL = core.StringPtr("testString") + createOfferingOptionsModel.OfferingDocsURL = core.StringPtr("testString") + createOfferingOptionsModel.OfferingSupportURL = core.StringPtr("testString") + createOfferingOptionsModel.Tags = []string{"testString"} + createOfferingOptionsModel.Keywords = []string{"testString"} + createOfferingOptionsModel.Rating = ratingModel + createOfferingOptionsModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + createOfferingOptionsModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + createOfferingOptionsModel.ShortDescription = core.StringPtr("testString") + createOfferingOptionsModel.ShortDescriptionI18n = make(map[string]string) + createOfferingOptionsModel.LongDescription = core.StringPtr("testString") + createOfferingOptionsModel.LongDescriptionI18n = make(map[string]string) + createOfferingOptionsModel.Features = []catalogmanagementv1.Feature{*featureModel} + createOfferingOptionsModel.Kinds = []catalogmanagementv1.Kind{*kindModel} + createOfferingOptionsModel.PcManaged = core.BoolPtr(true) + createOfferingOptionsModel.PublishApproved = core.BoolPtr(true) + createOfferingOptionsModel.ShareWithAll = core.BoolPtr(true) + createOfferingOptionsModel.ShareWithIBM = core.BoolPtr(true) + createOfferingOptionsModel.ShareEnabled = core.BoolPtr(true) + createOfferingOptionsModel.PermitRequestIBMPublicPublish = core.BoolPtr(true) + createOfferingOptionsModel.IBMPublishApproved = core.BoolPtr(true) + createOfferingOptionsModel.PublicPublishApproved = core.BoolPtr(true) + createOfferingOptionsModel.PublicOriginalCRN = core.StringPtr("testString") + createOfferingOptionsModel.PublishPublicCRN = core.StringPtr("testString") + createOfferingOptionsModel.PortalApprovalRecord = core.StringPtr("testString") + createOfferingOptionsModel.PortalUIURL = core.StringPtr("testString") + createOfferingOptionsModel.CatalogID = core.StringPtr("testString") + createOfferingOptionsModel.CatalogName = core.StringPtr("testString") + createOfferingOptionsModel.Metadata = make(map[string]interface{}) + createOfferingOptionsModel.Disclaimer = core.StringPtr("testString") + createOfferingOptionsModel.Hidden = core.BoolPtr(true) + createOfferingOptionsModel.Provider = core.StringPtr("testString") + createOfferingOptionsModel.ProviderInfo = providerInfoModel + createOfferingOptionsModel.RepoInfo = repoInfoModel + createOfferingOptionsModel.ImagePullKeys = []catalogmanagementv1.ImagePullKey{*imagePullKeyModel} + createOfferingOptionsModel.Support = supportModel + createOfferingOptionsModel.Media = []catalogmanagementv1.MediaItem{*mediaItemModel} + createOfferingOptionsModel.DeprecatePending = deprecatePendingModel + createOfferingOptionsModel.ProductKind = core.StringPtr("testString") + createOfferingOptionsModel.Badges = []catalogmanagementv1.Badge{*badgeModel} + createOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := catalogManagementService.CreateOfferingWithContext(ctx, createOfferingOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + catalogManagementService.DisableRetries() + result, response, operationErr := catalogManagementService.CreateOffering(createOfferingOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = catalogManagementService.CreateOfferingWithContext(ctx, createOfferingOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(createOfferingPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "url": "URL", "crn": "CRN", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "name": "Name", "offering_icon_url": "OfferingIconURL", "offering_docs_url": "OfferingDocsURL", "offering_support_url": "OfferingSupportURL", "tags": ["Tags"], "keywords": ["Keywords"], "rating": {"one_star_count": 12, "two_star_count": 12, "three_star_count": 14, "four_star_count": 13}, "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "short_description": "ShortDescription", "short_description_i18n": {"mapKey": "Inner"}, "long_description": "LongDescription", "long_description_i18n": {"mapKey": "Inner"}, "features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "kinds": [{"id": "ID", "format_kind": "FormatKind", "install_kind": "InstallKind", "target_kind": "TargetKind", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "additional_features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "versions": [{"id": "ID", "_rev": "Rev", "crn": "CRN", "version": "Version", "flavor": {"name": "Name", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "index": 5}, "sha": "Sha", "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "offering_id": "OfferingID", "catalog_id": "CatalogID", "kind_id": "KindID", "tags": ["Tags"], "repo_url": "RepoURL", "source_url": "SourceURL", "tgz_url": "TgzURL", "configuration": [{"key": "Key", "type": "Type", "default_value": "anyValue", "display_name": "DisplayName", "value_constraint": "ValueConstraint", "description": "Description", "required": true, "options": ["anyValue"], "hidden": true, "custom_config": {"type": "Type", "grouping": "Grouping", "original_grouping": "OriginalGrouping", "grouping_index": 13, "config_constraints": {"anyKey": "anyValue"}, "associations": {"parameters": [{"name": "Name", "optionsRefresh": true}]}}, "type_metadata": "TypeMetadata"}], "outputs": [{"key": "Key", "description": "Description"}], "iam_permissions": [{"service_name": "ServiceName", "role_crns": ["RoleCrns"], "resources": [{"name": "Name", "description": "Description", "role_crns": ["RoleCrns"]}]}], "metadata": {"mapKey": "anyValue"}, "validation": {"validated": "2019-01-01T12:00:00.000Z", "requested": "2019-01-01T12:00:00.000Z", "state": "State", "last_operation": "LastOperation", "target": {"mapKey": "anyValue"}, "message": "Message"}, "required_resources": [{"type": "mem", "value": "anyValue"}], "single_instance": true, "install": {"instructions": "Instructions", "instructions_i18n": {"mapKey": "Inner"}, "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}, "pre_install": [{"instructions": "Instructions", "instructions_i18n": {"mapKey": "Inner"}, "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}], "entitlement": {"provider_name": "ProviderName", "provider_id": "ProviderID", "product_id": "ProductID", "part_numbers": ["PartNumbers"], "image_repo_name": "ImageRepoName"}, "licenses": [{"id": "ID", "name": "Name", "type": "Type", "url": "URL", "description": "Description"}], "image_manifest_url": "ImageManifestURL", "deprecated": true, "package_version": "PackageVersion", "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "version_locator": "VersionLocator", "long_description": "LongDescription", "long_description_i18n": {"mapKey": "Inner"}, "whitelisted_accounts": ["WhitelistedAccounts"], "image_pull_key_name": "ImagePullKeyName", "deprecate_pending": {"deprecate_date": "2019-01-01T12:00:00.000Z", "deprecate_state": "DeprecateState", "description": "Description"}, "solution_info": {"architecture_diagrams": [{"diagram": {"url": "URL", "api_url": "APIURL", "url_proxy": {"url": "URL", "sha": "Sha"}, "caption": "Caption", "caption_i18n": {"mapKey": "Inner"}, "type": "Type", "thumbnail_url": "ThumbnailURL"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "cost_estimate": {"version": "Version", "currency": "Currency", "projects": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "pastBreakdown": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "breakdown": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "diff": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "summary": {"totalDetectedResources": 22, "totalSupportedResources": 23, "totalUnsupportedResources": 25, "totalUsageBasedResources": 24, "totalNoPriceResources": 21, "unsupportedResourceCounts": {"mapKey": 5}, "noPriceResourceCounts": {"mapKey": 5}}}], "summary": {"totalDetectedResources": 22, "totalSupportedResources": 23, "totalUnsupportedResources": 25, "totalUsageBasedResources": 24, "totalNoPriceResources": 21, "unsupportedResourceCounts": {"mapKey": 5}, "noPriceResourceCounts": {"mapKey": 5}}, "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z"}, "dependencies": [{"catalog_id": "CatalogID", "id": "ID", "name": "Name", "version": "Version", "flavors": ["Flavors"]}]}, "is_consumable": true}], "plans": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "additional_features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "deployments": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z"}]}]}], "pc_managed": false, "publish_approved": false, "share_with_all": true, "share_with_ibm": true, "share_enabled": true, "permit_request_ibm_public_publish": false, "ibm_publish_approved": true, "public_publish_approved": false, "public_original_crn": "PublicOriginalCRN", "publish_public_crn": "PublishPublicCRN", "portal_approval_record": "PortalApprovalRecord", "portal_ui_url": "PortalUIURL", "catalog_id": "CatalogID", "catalog_name": "CatalogName", "metadata": {"mapKey": "anyValue"}, "disclaimer": "Disclaimer", "hidden": true, "provider": "Provider", "provider_info": {"id": "ID", "name": "Name"}, "repo_info": {"token": "Token", "type": "Type"}, "image_pull_keys": [{"name": "Name", "value": "Value", "description": "Description"}], "support": {"url": "URL", "process": "Process", "process_i18n": {"mapKey": "Inner"}, "locations": ["Locations"], "support_details": [{"type": "Type", "contact": "Contact", "response_wait_time": {"value": 5, "type": "Type"}, "availability": {"times": [{"day": 3, "start_time": "StartTime", "end_time": "EndTime"}], "timezone": "Timezone", "always_available": false}}], "support_escalation": {"escalation_wait_time": {"value": 5, "type": "Type"}, "response_wait_time": {"value": 5, "type": "Type"}, "contact": "Contact"}, "support_type": "SupportType"}, "media": [{"url": "URL", "api_url": "APIURL", "url_proxy": {"url": "URL", "sha": "Sha"}, "caption": "Caption", "caption_i18n": {"mapKey": "Inner"}, "type": "Type", "thumbnail_url": "ThumbnailURL"}], "deprecate_pending": {"deprecate_date": "2019-01-01T12:00:00.000Z", "deprecate_state": "DeprecateState", "description": "Description"}, "product_kind": "ProductKind", "badges": [{"id": "ID", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}, "icon": "Icon", "authority": "Authority", "tag": "Tag", "learn_more_links": {"first_party": "FirstParty", "third_party": "ThirdParty"}, "constraints": [{"type": "Type", "rule": "anyValue"}]}]}`) + })) + }) + It(`Invoke CreateOffering successfully`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := catalogManagementService.CreateOffering(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the Rating model + ratingModel := new(catalogmanagementv1.Rating) + ratingModel.OneStarCount = core.Int64Ptr(int64(38)) + ratingModel.TwoStarCount = core.Int64Ptr(int64(38)) + ratingModel.ThreeStarCount = core.Int64Ptr(int64(38)) + ratingModel.FourStarCount = core.Int64Ptr(int64(38)) + + // Construct an instance of the Feature model + featureModel := new(catalogmanagementv1.Feature) + featureModel.Title = core.StringPtr("testString") + featureModel.TitleI18n = make(map[string]string) + featureModel.Description = core.StringPtr("testString") + featureModel.DescriptionI18n = make(map[string]string) + + // Construct an instance of the Flavor model + flavorModel := new(catalogmanagementv1.Flavor) + flavorModel.Name = core.StringPtr("testString") + flavorModel.Label = core.StringPtr("testString") + flavorModel.LabelI18n = make(map[string]string) + flavorModel.Index = core.Int64Ptr(int64(38)) + + // Construct an instance of the RenderTypeAssociationsParametersItem model + renderTypeAssociationsParametersItemModel := new(catalogmanagementv1.RenderTypeAssociationsParametersItem) + renderTypeAssociationsParametersItemModel.Name = core.StringPtr("testString") + renderTypeAssociationsParametersItemModel.OptionsRefresh = core.BoolPtr(true) + + // Construct an instance of the RenderTypeAssociations model + renderTypeAssociationsModel := new(catalogmanagementv1.RenderTypeAssociations) + renderTypeAssociationsModel.Parameters = []catalogmanagementv1.RenderTypeAssociationsParametersItem{*renderTypeAssociationsParametersItemModel} + + // Construct an instance of the RenderType model + renderTypeModel := new(catalogmanagementv1.RenderType) + renderTypeModel.Type = core.StringPtr("testString") + renderTypeModel.Grouping = core.StringPtr("testString") + renderTypeModel.OriginalGrouping = core.StringPtr("testString") + renderTypeModel.GroupingIndex = core.Int64Ptr(int64(38)) + renderTypeModel.ConfigConstraints = map[string]interface{}{"anyKey": "anyValue"} + renderTypeModel.Associations = renderTypeAssociationsModel + + // Construct an instance of the Configuration model + configurationModel := new(catalogmanagementv1.Configuration) + configurationModel.Key = core.StringPtr("testString") + configurationModel.Type = core.StringPtr("testString") + configurationModel.DefaultValue = core.StringPtr("testString") + configurationModel.DisplayName = core.StringPtr("testString") + configurationModel.ValueConstraint = core.StringPtr("testString") + configurationModel.Description = core.StringPtr("testString") + configurationModel.Required = core.BoolPtr(true) + configurationModel.Options = []interface{}{"testString"} + configurationModel.Hidden = core.BoolPtr(true) + configurationModel.CustomConfig = renderTypeModel + configurationModel.TypeMetadata = core.StringPtr("testString") + + // Construct an instance of the Output model + outputModel := new(catalogmanagementv1.Output) + outputModel.Key = core.StringPtr("testString") + outputModel.Description = core.StringPtr("testString") + + // Construct an instance of the IamResource model + iamResourceModel := new(catalogmanagementv1.IamResource) + iamResourceModel.Name = core.StringPtr("testString") + iamResourceModel.Description = core.StringPtr("testString") + iamResourceModel.RoleCrns = []string{"testString"} + + // Construct an instance of the IamPermission model + iamPermissionModel := new(catalogmanagementv1.IamPermission) + iamPermissionModel.ServiceName = core.StringPtr("testString") + iamPermissionModel.RoleCrns = []string{"testString"} + iamPermissionModel.Resources = []catalogmanagementv1.IamResource{*iamResourceModel} + + // Construct an instance of the Validation model + validationModel := new(catalogmanagementv1.Validation) + validationModel.Validated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + validationModel.Requested = CreateMockDateTime("2019-01-01T12:00:00.000Z") + validationModel.State = core.StringPtr("testString") + validationModel.LastOperation = core.StringPtr("testString") + validationModel.Target = make(map[string]interface{}) + validationModel.Message = core.StringPtr("testString") + + // Construct an instance of the Resource model + resourceModel := new(catalogmanagementv1.Resource) + resourceModel.Type = core.StringPtr("mem") + resourceModel.Value = core.StringPtr("testString") + + // Construct an instance of the Script model + scriptModel := new(catalogmanagementv1.Script) + scriptModel.Instructions = core.StringPtr("testString") + scriptModel.InstructionsI18n = make(map[string]string) + scriptModel.Script = core.StringPtr("testString") + scriptModel.ScriptPermission = core.StringPtr("testString") + scriptModel.DeleteScript = core.StringPtr("testString") + scriptModel.Scope = core.StringPtr("testString") + + // Construct an instance of the VersionEntitlement model + versionEntitlementModel := new(catalogmanagementv1.VersionEntitlement) + versionEntitlementModel.ProviderName = core.StringPtr("testString") + versionEntitlementModel.ProviderID = core.StringPtr("testString") + versionEntitlementModel.ProductID = core.StringPtr("testString") + versionEntitlementModel.PartNumbers = []string{"testString"} + versionEntitlementModel.ImageRepoName = core.StringPtr("testString") + + // Construct an instance of the License model + licenseModel := new(catalogmanagementv1.License) + licenseModel.ID = core.StringPtr("testString") + licenseModel.Name = core.StringPtr("testString") + licenseModel.Type = core.StringPtr("testString") + licenseModel.URL = core.StringPtr("testString") + licenseModel.Description = core.StringPtr("testString") + + // Construct an instance of the State model + stateModel := new(catalogmanagementv1.State) + stateModel.Current = core.StringPtr("testString") + stateModel.CurrentEntered = CreateMockDateTime("2019-01-01T12:00:00.000Z") + stateModel.Pending = core.StringPtr("testString") + stateModel.PendingRequested = CreateMockDateTime("2019-01-01T12:00:00.000Z") + stateModel.Previous = core.StringPtr("testString") + + // Construct an instance of the DeprecatePending model + deprecatePendingModel := new(catalogmanagementv1.DeprecatePending) + deprecatePendingModel.DeprecateDate = CreateMockDateTime("2019-01-01T12:00:00.000Z") + deprecatePendingModel.DeprecateState = core.StringPtr("testString") + deprecatePendingModel.Description = core.StringPtr("testString") + + // Construct an instance of the URLProxy model + urlProxyModel := new(catalogmanagementv1.URLProxy) + urlProxyModel.URL = core.StringPtr("testString") + urlProxyModel.Sha = core.StringPtr("testString") + + // Construct an instance of the MediaItem model + mediaItemModel := new(catalogmanagementv1.MediaItem) + mediaItemModel.URL = core.StringPtr("testString") + mediaItemModel.APIURL = core.StringPtr("testString") + mediaItemModel.URLProxy = urlProxyModel + mediaItemModel.Caption = core.StringPtr("testString") + mediaItemModel.CaptionI18n = make(map[string]string) + mediaItemModel.Type = core.StringPtr("testString") + mediaItemModel.ThumbnailURL = core.StringPtr("testString") + + // Construct an instance of the ArchitectureDiagram model + architectureDiagramModel := new(catalogmanagementv1.ArchitectureDiagram) + architectureDiagramModel.Diagram = mediaItemModel + architectureDiagramModel.Description = core.StringPtr("testString") + architectureDiagramModel.DescriptionI18n = make(map[string]string) + + // Construct an instance of the CostComponent model + costComponentModel := new(catalogmanagementv1.CostComponent) + costComponentModel.Name = core.StringPtr("testString") + costComponentModel.Unit = core.StringPtr("testString") + costComponentModel.HourlyQuantity = core.StringPtr("testString") + costComponentModel.MonthlyQuantity = core.StringPtr("testString") + costComponentModel.Price = core.StringPtr("testString") + costComponentModel.HourlyCost = core.StringPtr("testString") + costComponentModel.MonthlyCost = core.StringPtr("testString") + + // Construct an instance of the CostResource model + costResourceModel := new(catalogmanagementv1.CostResource) + costResourceModel.Name = core.StringPtr("testString") + costResourceModel.Metadata = make(map[string]interface{}) + costResourceModel.HourlyCost = core.StringPtr("testString") + costResourceModel.MonthlyCost = core.StringPtr("testString") + costResourceModel.CostComponents = []catalogmanagementv1.CostComponent{*costComponentModel} + + // Construct an instance of the CostBreakdown model + costBreakdownModel := new(catalogmanagementv1.CostBreakdown) + costBreakdownModel.TotalHourlyCost = core.StringPtr("testString") + costBreakdownModel.TotalMonthlyCOst = core.StringPtr("testString") + costBreakdownModel.Resources = []catalogmanagementv1.CostResource{*costResourceModel} + + // Construct an instance of the CostSummary model + costSummaryModel := new(catalogmanagementv1.CostSummary) + costSummaryModel.TotalDetectedResources = core.Int64Ptr(int64(38)) + costSummaryModel.TotalSupportedResources = core.Int64Ptr(int64(38)) + costSummaryModel.TotalUnsupportedResources = core.Int64Ptr(int64(38)) + costSummaryModel.TotalUsageBasedResources = core.Int64Ptr(int64(38)) + costSummaryModel.TotalNoPriceResources = core.Int64Ptr(int64(38)) + costSummaryModel.UnsupportedResourceCounts = make(map[string]int64) + costSummaryModel.NoPriceResourceCounts = make(map[string]int64) + + // Construct an instance of the Project model + projectModel := new(catalogmanagementv1.Project) + projectModel.Name = core.StringPtr("testString") + projectModel.Metadata = make(map[string]interface{}) + projectModel.PastBreakdown = costBreakdownModel + projectModel.Breakdown = costBreakdownModel + projectModel.Diff = costBreakdownModel + projectModel.Summary = costSummaryModel + + // Construct an instance of the CostEstimate model + costEstimateModel := new(catalogmanagementv1.CostEstimate) + costEstimateModel.Version = core.StringPtr("testString") + costEstimateModel.Currency = core.StringPtr("testString") + costEstimateModel.Projects = []catalogmanagementv1.Project{*projectModel} + costEstimateModel.Summary = costSummaryModel + costEstimateModel.TotalHourlyCost = core.StringPtr("testString") + costEstimateModel.TotalMonthlyCost = core.StringPtr("testString") + costEstimateModel.PastTotalHourlyCost = core.StringPtr("testString") + costEstimateModel.PastTotalMonthlyCost = core.StringPtr("testString") + costEstimateModel.DiffTotalHourlyCost = core.StringPtr("testString") + costEstimateModel.DiffTotalMonthlyCost = core.StringPtr("testString") + costEstimateModel.TimeGenerated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + + // Construct an instance of the Dependency model + dependencyModel := new(catalogmanagementv1.Dependency) + dependencyModel.CatalogID = core.StringPtr("testString") + dependencyModel.ID = core.StringPtr("testString") + dependencyModel.Name = core.StringPtr("testString") + dependencyModel.Version = core.StringPtr("testString") + dependencyModel.Flavors = []string{"testString"} + + // Construct an instance of the SolutionInfo model + solutionInfoModel := new(catalogmanagementv1.SolutionInfo) + solutionInfoModel.ArchitectureDiagrams = []catalogmanagementv1.ArchitectureDiagram{*architectureDiagramModel} + solutionInfoModel.Features = []catalogmanagementv1.Feature{*featureModel} + solutionInfoModel.CostEstimate = costEstimateModel + solutionInfoModel.Dependencies = []catalogmanagementv1.Dependency{*dependencyModel} + + // Construct an instance of the Version model + versionModel := new(catalogmanagementv1.Version) + versionModel.ID = core.StringPtr("testString") + versionModel.Rev = core.StringPtr("testString") + versionModel.CRN = core.StringPtr("testString") + versionModel.Version = core.StringPtr("testString") + versionModel.Flavor = flavorModel + versionModel.Sha = core.StringPtr("testString") + versionModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + versionModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + versionModel.OfferingID = core.StringPtr("testString") + versionModel.CatalogID = core.StringPtr("testString") + versionModel.KindID = core.StringPtr("testString") + versionModel.Tags = []string{"testString"} + versionModel.RepoURL = core.StringPtr("testString") + versionModel.SourceURL = core.StringPtr("testString") + versionModel.TgzURL = core.StringPtr("testString") + versionModel.Configuration = []catalogmanagementv1.Configuration{*configurationModel} + versionModel.Outputs = []catalogmanagementv1.Output{*outputModel} + versionModel.IamPermissions = []catalogmanagementv1.IamPermission{*iamPermissionModel} + versionModel.Metadata = make(map[string]interface{}) + versionModel.Validation = validationModel + versionModel.RequiredResources = []catalogmanagementv1.Resource{*resourceModel} + versionModel.SingleInstance = core.BoolPtr(true) + versionModel.Install = scriptModel + versionModel.PreInstall = []catalogmanagementv1.Script{*scriptModel} + versionModel.Entitlement = versionEntitlementModel + versionModel.Licenses = []catalogmanagementv1.License{*licenseModel} + versionModel.ImageManifestURL = core.StringPtr("testString") + versionModel.Deprecated = core.BoolPtr(true) + versionModel.PackageVersion = core.StringPtr("testString") + versionModel.State = stateModel + versionModel.VersionLocator = core.StringPtr("testString") + versionModel.LongDescription = core.StringPtr("testString") + versionModel.LongDescriptionI18n = make(map[string]string) + versionModel.WhitelistedAccounts = []string{"testString"} + versionModel.ImagePullKeyName = core.StringPtr("testString") + versionModel.DeprecatePending = deprecatePendingModel + versionModel.SolutionInfo = solutionInfoModel + versionModel.IsConsumable = core.BoolPtr(true) + + // Construct an instance of the Deployment model + deploymentModel := new(catalogmanagementv1.Deployment) + deploymentModel.ID = core.StringPtr("testString") + deploymentModel.Label = core.StringPtr("testString") + deploymentModel.Name = core.StringPtr("testString") + deploymentModel.ShortDescription = core.StringPtr("testString") + deploymentModel.LongDescription = core.StringPtr("testString") + deploymentModel.Metadata = make(map[string]interface{}) + deploymentModel.Tags = []string{"testString"} + deploymentModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + deploymentModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + + // Construct an instance of the Plan model + planModel := new(catalogmanagementv1.Plan) + planModel.ID = core.StringPtr("testString") + planModel.Label = core.StringPtr("testString") + planModel.Name = core.StringPtr("testString") + planModel.ShortDescription = core.StringPtr("testString") + planModel.LongDescription = core.StringPtr("testString") + planModel.Metadata = make(map[string]interface{}) + planModel.Tags = []string{"testString"} + planModel.AdditionalFeatures = []catalogmanagementv1.Feature{*featureModel} + planModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + planModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + planModel.Deployments = []catalogmanagementv1.Deployment{*deploymentModel} + + // Construct an instance of the Kind model + kindModel := new(catalogmanagementv1.Kind) + kindModel.ID = core.StringPtr("testString") + kindModel.FormatKind = core.StringPtr("testString") + kindModel.InstallKind = core.StringPtr("testString") + kindModel.TargetKind = core.StringPtr("testString") + kindModel.Metadata = make(map[string]interface{}) + kindModel.Tags = []string{"testString"} + kindModel.AdditionalFeatures = []catalogmanagementv1.Feature{*featureModel} + kindModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + kindModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + kindModel.Versions = []catalogmanagementv1.Version{*versionModel} + kindModel.Plans = []catalogmanagementv1.Plan{*planModel} + + // Construct an instance of the ProviderInfo model + providerInfoModel := new(catalogmanagementv1.ProviderInfo) + providerInfoModel.ID = core.StringPtr("testString") + providerInfoModel.Name = core.StringPtr("testString") + + // Construct an instance of the RepoInfo model + repoInfoModel := new(catalogmanagementv1.RepoInfo) + repoInfoModel.Token = core.StringPtr("testString") + repoInfoModel.Type = core.StringPtr("testString") + + // Construct an instance of the ImagePullKey model + imagePullKeyModel := new(catalogmanagementv1.ImagePullKey) + imagePullKeyModel.Name = core.StringPtr("testString") + imagePullKeyModel.Value = core.StringPtr("testString") + imagePullKeyModel.Description = core.StringPtr("testString") + + // Construct an instance of the SupportWaitTime model + supportWaitTimeModel := new(catalogmanagementv1.SupportWaitTime) + supportWaitTimeModel.Value = core.Int64Ptr(int64(38)) + supportWaitTimeModel.Type = core.StringPtr("testString") + + // Construct an instance of the SupportTime model + supportTimeModel := new(catalogmanagementv1.SupportTime) + supportTimeModel.Day = core.Int64Ptr(int64(38)) + supportTimeModel.StartTime = core.StringPtr("testString") + supportTimeModel.EndTime = core.StringPtr("testString") + + // Construct an instance of the SupportAvailability model + supportAvailabilityModel := new(catalogmanagementv1.SupportAvailability) + supportAvailabilityModel.Times = []catalogmanagementv1.SupportTime{*supportTimeModel} + supportAvailabilityModel.Timezone = core.StringPtr("testString") + supportAvailabilityModel.AlwaysAvailable = core.BoolPtr(true) + + // Construct an instance of the SupportDetail model + supportDetailModel := new(catalogmanagementv1.SupportDetail) + supportDetailModel.Type = core.StringPtr("testString") + supportDetailModel.Contact = core.StringPtr("testString") + supportDetailModel.ResponseWaitTime = supportWaitTimeModel + supportDetailModel.Availability = supportAvailabilityModel + + // Construct an instance of the SupportEscalation model + supportEscalationModel := new(catalogmanagementv1.SupportEscalation) + supportEscalationModel.EscalationWaitTime = supportWaitTimeModel + supportEscalationModel.ResponseWaitTime = supportWaitTimeModel + supportEscalationModel.Contact = core.StringPtr("testString") + + // Construct an instance of the Support model + supportModel := new(catalogmanagementv1.Support) + supportModel.URL = core.StringPtr("testString") + supportModel.Process = core.StringPtr("testString") + supportModel.ProcessI18n = make(map[string]string) + supportModel.Locations = []string{"testString"} + supportModel.SupportDetails = []catalogmanagementv1.SupportDetail{*supportDetailModel} + supportModel.SupportEscalation = supportEscalationModel + supportModel.SupportType = core.StringPtr("testString") + + // Construct an instance of the LearnMoreLinks model + learnMoreLinksModel := new(catalogmanagementv1.LearnMoreLinks) + learnMoreLinksModel.FirstParty = core.StringPtr("testString") + learnMoreLinksModel.ThirdParty = core.StringPtr("testString") + + // Construct an instance of the Constraint model + constraintModel := new(catalogmanagementv1.Constraint) + constraintModel.Type = core.StringPtr("testString") + constraintModel.Rule = core.StringPtr("testString") + + // Construct an instance of the Badge model + badgeModel := new(catalogmanagementv1.Badge) + badgeModel.ID = core.StringPtr("testString") + badgeModel.Label = core.StringPtr("testString") + badgeModel.LabelI18n = make(map[string]string) + badgeModel.Description = core.StringPtr("testString") + badgeModel.DescriptionI18n = make(map[string]string) + badgeModel.Icon = core.StringPtr("testString") + badgeModel.Authority = core.StringPtr("testString") + badgeModel.Tag = core.StringPtr("testString") + badgeModel.LearnMoreLinks = learnMoreLinksModel + badgeModel.Constraints = []catalogmanagementv1.Constraint{*constraintModel} + + // Construct an instance of the CreateOfferingOptions model + createOfferingOptionsModel := new(catalogmanagementv1.CreateOfferingOptions) + createOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") + createOfferingOptionsModel.ID = core.StringPtr("testString") + createOfferingOptionsModel.Rev = core.StringPtr("testString") + createOfferingOptionsModel.URL = core.StringPtr("testString") + createOfferingOptionsModel.CRN = core.StringPtr("testString") + createOfferingOptionsModel.Label = core.StringPtr("testString") + createOfferingOptionsModel.LabelI18n = make(map[string]string) + createOfferingOptionsModel.Name = core.StringPtr("testString") + createOfferingOptionsModel.OfferingIconURL = core.StringPtr("testString") + createOfferingOptionsModel.OfferingDocsURL = core.StringPtr("testString") + createOfferingOptionsModel.OfferingSupportURL = core.StringPtr("testString") + createOfferingOptionsModel.Tags = []string{"testString"} + createOfferingOptionsModel.Keywords = []string{"testString"} + createOfferingOptionsModel.Rating = ratingModel + createOfferingOptionsModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + createOfferingOptionsModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + createOfferingOptionsModel.ShortDescription = core.StringPtr("testString") + createOfferingOptionsModel.ShortDescriptionI18n = make(map[string]string) + createOfferingOptionsModel.LongDescription = core.StringPtr("testString") + createOfferingOptionsModel.LongDescriptionI18n = make(map[string]string) + createOfferingOptionsModel.Features = []catalogmanagementv1.Feature{*featureModel} + createOfferingOptionsModel.Kinds = []catalogmanagementv1.Kind{*kindModel} + createOfferingOptionsModel.PcManaged = core.BoolPtr(true) + createOfferingOptionsModel.PublishApproved = core.BoolPtr(true) + createOfferingOptionsModel.ShareWithAll = core.BoolPtr(true) + createOfferingOptionsModel.ShareWithIBM = core.BoolPtr(true) + createOfferingOptionsModel.ShareEnabled = core.BoolPtr(true) + createOfferingOptionsModel.PermitRequestIBMPublicPublish = core.BoolPtr(true) + createOfferingOptionsModel.IBMPublishApproved = core.BoolPtr(true) + createOfferingOptionsModel.PublicPublishApproved = core.BoolPtr(true) + createOfferingOptionsModel.PublicOriginalCRN = core.StringPtr("testString") + createOfferingOptionsModel.PublishPublicCRN = core.StringPtr("testString") + createOfferingOptionsModel.PortalApprovalRecord = core.StringPtr("testString") + createOfferingOptionsModel.PortalUIURL = core.StringPtr("testString") + createOfferingOptionsModel.CatalogID = core.StringPtr("testString") + createOfferingOptionsModel.CatalogName = core.StringPtr("testString") + createOfferingOptionsModel.Metadata = make(map[string]interface{}) + createOfferingOptionsModel.Disclaimer = core.StringPtr("testString") + createOfferingOptionsModel.Hidden = core.BoolPtr(true) + createOfferingOptionsModel.Provider = core.StringPtr("testString") + createOfferingOptionsModel.ProviderInfo = providerInfoModel + createOfferingOptionsModel.RepoInfo = repoInfoModel + createOfferingOptionsModel.ImagePullKeys = []catalogmanagementv1.ImagePullKey{*imagePullKeyModel} + createOfferingOptionsModel.Support = supportModel + createOfferingOptionsModel.Media = []catalogmanagementv1.MediaItem{*mediaItemModel} + createOfferingOptionsModel.DeprecatePending = deprecatePendingModel + createOfferingOptionsModel.ProductKind = core.StringPtr("testString") + createOfferingOptionsModel.Badges = []catalogmanagementv1.Badge{*badgeModel} + createOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = catalogManagementService.CreateOffering(createOfferingOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke CreateOffering with error: Operation validation and request error`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Construct an instance of the Rating model + ratingModel := new(catalogmanagementv1.Rating) + ratingModel.OneStarCount = core.Int64Ptr(int64(38)) + ratingModel.TwoStarCount = core.Int64Ptr(int64(38)) + ratingModel.ThreeStarCount = core.Int64Ptr(int64(38)) + ratingModel.FourStarCount = core.Int64Ptr(int64(38)) + + // Construct an instance of the Feature model + featureModel := new(catalogmanagementv1.Feature) + featureModel.Title = core.StringPtr("testString") + featureModel.TitleI18n = make(map[string]string) + featureModel.Description = core.StringPtr("testString") + featureModel.DescriptionI18n = make(map[string]string) + + // Construct an instance of the Flavor model + flavorModel := new(catalogmanagementv1.Flavor) + flavorModel.Name = core.StringPtr("testString") + flavorModel.Label = core.StringPtr("testString") + flavorModel.LabelI18n = make(map[string]string) + flavorModel.Index = core.Int64Ptr(int64(38)) + + // Construct an instance of the RenderTypeAssociationsParametersItem model + renderTypeAssociationsParametersItemModel := new(catalogmanagementv1.RenderTypeAssociationsParametersItem) + renderTypeAssociationsParametersItemModel.Name = core.StringPtr("testString") + renderTypeAssociationsParametersItemModel.OptionsRefresh = core.BoolPtr(true) + + // Construct an instance of the RenderTypeAssociations model + renderTypeAssociationsModel := new(catalogmanagementv1.RenderTypeAssociations) + renderTypeAssociationsModel.Parameters = []catalogmanagementv1.RenderTypeAssociationsParametersItem{*renderTypeAssociationsParametersItemModel} + + // Construct an instance of the RenderType model + renderTypeModel := new(catalogmanagementv1.RenderType) + renderTypeModel.Type = core.StringPtr("testString") + renderTypeModel.Grouping = core.StringPtr("testString") + renderTypeModel.OriginalGrouping = core.StringPtr("testString") + renderTypeModel.GroupingIndex = core.Int64Ptr(int64(38)) + renderTypeModel.ConfigConstraints = map[string]interface{}{"anyKey": "anyValue"} + renderTypeModel.Associations = renderTypeAssociationsModel + + // Construct an instance of the Configuration model + configurationModel := new(catalogmanagementv1.Configuration) + configurationModel.Key = core.StringPtr("testString") + configurationModel.Type = core.StringPtr("testString") + configurationModel.DefaultValue = core.StringPtr("testString") + configurationModel.DisplayName = core.StringPtr("testString") + configurationModel.ValueConstraint = core.StringPtr("testString") + configurationModel.Description = core.StringPtr("testString") + configurationModel.Required = core.BoolPtr(true) + configurationModel.Options = []interface{}{"testString"} + configurationModel.Hidden = core.BoolPtr(true) + configurationModel.CustomConfig = renderTypeModel + configurationModel.TypeMetadata = core.StringPtr("testString") + + // Construct an instance of the Output model + outputModel := new(catalogmanagementv1.Output) + outputModel.Key = core.StringPtr("testString") + outputModel.Description = core.StringPtr("testString") + + // Construct an instance of the IamResource model + iamResourceModel := new(catalogmanagementv1.IamResource) + iamResourceModel.Name = core.StringPtr("testString") + iamResourceModel.Description = core.StringPtr("testString") + iamResourceModel.RoleCrns = []string{"testString"} + + // Construct an instance of the IamPermission model + iamPermissionModel := new(catalogmanagementv1.IamPermission) + iamPermissionModel.ServiceName = core.StringPtr("testString") + iamPermissionModel.RoleCrns = []string{"testString"} + iamPermissionModel.Resources = []catalogmanagementv1.IamResource{*iamResourceModel} + + // Construct an instance of the Validation model + validationModel := new(catalogmanagementv1.Validation) + validationModel.Validated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + validationModel.Requested = CreateMockDateTime("2019-01-01T12:00:00.000Z") + validationModel.State = core.StringPtr("testString") + validationModel.LastOperation = core.StringPtr("testString") + validationModel.Target = make(map[string]interface{}) + validationModel.Message = core.StringPtr("testString") + + // Construct an instance of the Resource model + resourceModel := new(catalogmanagementv1.Resource) + resourceModel.Type = core.StringPtr("mem") + resourceModel.Value = core.StringPtr("testString") + + // Construct an instance of the Script model + scriptModel := new(catalogmanagementv1.Script) + scriptModel.Instructions = core.StringPtr("testString") + scriptModel.InstructionsI18n = make(map[string]string) + scriptModel.Script = core.StringPtr("testString") + scriptModel.ScriptPermission = core.StringPtr("testString") + scriptModel.DeleteScript = core.StringPtr("testString") + scriptModel.Scope = core.StringPtr("testString") + + // Construct an instance of the VersionEntitlement model + versionEntitlementModel := new(catalogmanagementv1.VersionEntitlement) + versionEntitlementModel.ProviderName = core.StringPtr("testString") + versionEntitlementModel.ProviderID = core.StringPtr("testString") + versionEntitlementModel.ProductID = core.StringPtr("testString") + versionEntitlementModel.PartNumbers = []string{"testString"} + versionEntitlementModel.ImageRepoName = core.StringPtr("testString") + + // Construct an instance of the License model + licenseModel := new(catalogmanagementv1.License) + licenseModel.ID = core.StringPtr("testString") + licenseModel.Name = core.StringPtr("testString") + licenseModel.Type = core.StringPtr("testString") + licenseModel.URL = core.StringPtr("testString") + licenseModel.Description = core.StringPtr("testString") + + // Construct an instance of the State model + stateModel := new(catalogmanagementv1.State) + stateModel.Current = core.StringPtr("testString") + stateModel.CurrentEntered = CreateMockDateTime("2019-01-01T12:00:00.000Z") + stateModel.Pending = core.StringPtr("testString") + stateModel.PendingRequested = CreateMockDateTime("2019-01-01T12:00:00.000Z") + stateModel.Previous = core.StringPtr("testString") + + // Construct an instance of the DeprecatePending model + deprecatePendingModel := new(catalogmanagementv1.DeprecatePending) + deprecatePendingModel.DeprecateDate = CreateMockDateTime("2019-01-01T12:00:00.000Z") + deprecatePendingModel.DeprecateState = core.StringPtr("testString") + deprecatePendingModel.Description = core.StringPtr("testString") + + // Construct an instance of the URLProxy model + urlProxyModel := new(catalogmanagementv1.URLProxy) + urlProxyModel.URL = core.StringPtr("testString") + urlProxyModel.Sha = core.StringPtr("testString") + + // Construct an instance of the MediaItem model + mediaItemModel := new(catalogmanagementv1.MediaItem) + mediaItemModel.URL = core.StringPtr("testString") + mediaItemModel.APIURL = core.StringPtr("testString") + mediaItemModel.URLProxy = urlProxyModel + mediaItemModel.Caption = core.StringPtr("testString") + mediaItemModel.CaptionI18n = make(map[string]string) + mediaItemModel.Type = core.StringPtr("testString") + mediaItemModel.ThumbnailURL = core.StringPtr("testString") + + // Construct an instance of the ArchitectureDiagram model + architectureDiagramModel := new(catalogmanagementv1.ArchitectureDiagram) + architectureDiagramModel.Diagram = mediaItemModel + architectureDiagramModel.Description = core.StringPtr("testString") + architectureDiagramModel.DescriptionI18n = make(map[string]string) + + // Construct an instance of the CostComponent model + costComponentModel := new(catalogmanagementv1.CostComponent) + costComponentModel.Name = core.StringPtr("testString") + costComponentModel.Unit = core.StringPtr("testString") + costComponentModel.HourlyQuantity = core.StringPtr("testString") + costComponentModel.MonthlyQuantity = core.StringPtr("testString") + costComponentModel.Price = core.StringPtr("testString") + costComponentModel.HourlyCost = core.StringPtr("testString") + costComponentModel.MonthlyCost = core.StringPtr("testString") + + // Construct an instance of the CostResource model + costResourceModel := new(catalogmanagementv1.CostResource) + costResourceModel.Name = core.StringPtr("testString") + costResourceModel.Metadata = make(map[string]interface{}) + costResourceModel.HourlyCost = core.StringPtr("testString") + costResourceModel.MonthlyCost = core.StringPtr("testString") + costResourceModel.CostComponents = []catalogmanagementv1.CostComponent{*costComponentModel} + + // Construct an instance of the CostBreakdown model + costBreakdownModel := new(catalogmanagementv1.CostBreakdown) + costBreakdownModel.TotalHourlyCost = core.StringPtr("testString") + costBreakdownModel.TotalMonthlyCOst = core.StringPtr("testString") + costBreakdownModel.Resources = []catalogmanagementv1.CostResource{*costResourceModel} + + // Construct an instance of the CostSummary model + costSummaryModel := new(catalogmanagementv1.CostSummary) + costSummaryModel.TotalDetectedResources = core.Int64Ptr(int64(38)) + costSummaryModel.TotalSupportedResources = core.Int64Ptr(int64(38)) + costSummaryModel.TotalUnsupportedResources = core.Int64Ptr(int64(38)) + costSummaryModel.TotalUsageBasedResources = core.Int64Ptr(int64(38)) + costSummaryModel.TotalNoPriceResources = core.Int64Ptr(int64(38)) + costSummaryModel.UnsupportedResourceCounts = make(map[string]int64) + costSummaryModel.NoPriceResourceCounts = make(map[string]int64) + + // Construct an instance of the Project model + projectModel := new(catalogmanagementv1.Project) + projectModel.Name = core.StringPtr("testString") + projectModel.Metadata = make(map[string]interface{}) + projectModel.PastBreakdown = costBreakdownModel + projectModel.Breakdown = costBreakdownModel + projectModel.Diff = costBreakdownModel + projectModel.Summary = costSummaryModel + + // Construct an instance of the CostEstimate model + costEstimateModel := new(catalogmanagementv1.CostEstimate) + costEstimateModel.Version = core.StringPtr("testString") + costEstimateModel.Currency = core.StringPtr("testString") + costEstimateModel.Projects = []catalogmanagementv1.Project{*projectModel} + costEstimateModel.Summary = costSummaryModel + costEstimateModel.TotalHourlyCost = core.StringPtr("testString") + costEstimateModel.TotalMonthlyCost = core.StringPtr("testString") + costEstimateModel.PastTotalHourlyCost = core.StringPtr("testString") + costEstimateModel.PastTotalMonthlyCost = core.StringPtr("testString") + costEstimateModel.DiffTotalHourlyCost = core.StringPtr("testString") + costEstimateModel.DiffTotalMonthlyCost = core.StringPtr("testString") + costEstimateModel.TimeGenerated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + + // Construct an instance of the Dependency model + dependencyModel := new(catalogmanagementv1.Dependency) + dependencyModel.CatalogID = core.StringPtr("testString") + dependencyModel.ID = core.StringPtr("testString") + dependencyModel.Name = core.StringPtr("testString") + dependencyModel.Version = core.StringPtr("testString") + dependencyModel.Flavors = []string{"testString"} + + // Construct an instance of the SolutionInfo model + solutionInfoModel := new(catalogmanagementv1.SolutionInfo) + solutionInfoModel.ArchitectureDiagrams = []catalogmanagementv1.ArchitectureDiagram{*architectureDiagramModel} + solutionInfoModel.Features = []catalogmanagementv1.Feature{*featureModel} + solutionInfoModel.CostEstimate = costEstimateModel + solutionInfoModel.Dependencies = []catalogmanagementv1.Dependency{*dependencyModel} + + // Construct an instance of the Version model + versionModel := new(catalogmanagementv1.Version) + versionModel.ID = core.StringPtr("testString") + versionModel.Rev = core.StringPtr("testString") + versionModel.CRN = core.StringPtr("testString") + versionModel.Version = core.StringPtr("testString") + versionModel.Flavor = flavorModel + versionModel.Sha = core.StringPtr("testString") + versionModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + versionModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + versionModel.OfferingID = core.StringPtr("testString") + versionModel.CatalogID = core.StringPtr("testString") + versionModel.KindID = core.StringPtr("testString") + versionModel.Tags = []string{"testString"} + versionModel.RepoURL = core.StringPtr("testString") + versionModel.SourceURL = core.StringPtr("testString") + versionModel.TgzURL = core.StringPtr("testString") + versionModel.Configuration = []catalogmanagementv1.Configuration{*configurationModel} + versionModel.Outputs = []catalogmanagementv1.Output{*outputModel} + versionModel.IamPermissions = []catalogmanagementv1.IamPermission{*iamPermissionModel} + versionModel.Metadata = make(map[string]interface{}) + versionModel.Validation = validationModel + versionModel.RequiredResources = []catalogmanagementv1.Resource{*resourceModel} + versionModel.SingleInstance = core.BoolPtr(true) + versionModel.Install = scriptModel + versionModel.PreInstall = []catalogmanagementv1.Script{*scriptModel} + versionModel.Entitlement = versionEntitlementModel + versionModel.Licenses = []catalogmanagementv1.License{*licenseModel} + versionModel.ImageManifestURL = core.StringPtr("testString") + versionModel.Deprecated = core.BoolPtr(true) + versionModel.PackageVersion = core.StringPtr("testString") + versionModel.State = stateModel + versionModel.VersionLocator = core.StringPtr("testString") + versionModel.LongDescription = core.StringPtr("testString") + versionModel.LongDescriptionI18n = make(map[string]string) + versionModel.WhitelistedAccounts = []string{"testString"} + versionModel.ImagePullKeyName = core.StringPtr("testString") + versionModel.DeprecatePending = deprecatePendingModel + versionModel.SolutionInfo = solutionInfoModel + versionModel.IsConsumable = core.BoolPtr(true) + + // Construct an instance of the Deployment model + deploymentModel := new(catalogmanagementv1.Deployment) + deploymentModel.ID = core.StringPtr("testString") + deploymentModel.Label = core.StringPtr("testString") + deploymentModel.Name = core.StringPtr("testString") + deploymentModel.ShortDescription = core.StringPtr("testString") + deploymentModel.LongDescription = core.StringPtr("testString") + deploymentModel.Metadata = make(map[string]interface{}) + deploymentModel.Tags = []string{"testString"} + deploymentModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + deploymentModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + + // Construct an instance of the Plan model + planModel := new(catalogmanagementv1.Plan) + planModel.ID = core.StringPtr("testString") + planModel.Label = core.StringPtr("testString") + planModel.Name = core.StringPtr("testString") + planModel.ShortDescription = core.StringPtr("testString") + planModel.LongDescription = core.StringPtr("testString") + planModel.Metadata = make(map[string]interface{}) + planModel.Tags = []string{"testString"} + planModel.AdditionalFeatures = []catalogmanagementv1.Feature{*featureModel} + planModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + planModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + planModel.Deployments = []catalogmanagementv1.Deployment{*deploymentModel} + + // Construct an instance of the Kind model + kindModel := new(catalogmanagementv1.Kind) + kindModel.ID = core.StringPtr("testString") + kindModel.FormatKind = core.StringPtr("testString") + kindModel.InstallKind = core.StringPtr("testString") + kindModel.TargetKind = core.StringPtr("testString") + kindModel.Metadata = make(map[string]interface{}) + kindModel.Tags = []string{"testString"} + kindModel.AdditionalFeatures = []catalogmanagementv1.Feature{*featureModel} + kindModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + kindModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + kindModel.Versions = []catalogmanagementv1.Version{*versionModel} + kindModel.Plans = []catalogmanagementv1.Plan{*planModel} + + // Construct an instance of the ProviderInfo model + providerInfoModel := new(catalogmanagementv1.ProviderInfo) + providerInfoModel.ID = core.StringPtr("testString") + providerInfoModel.Name = core.StringPtr("testString") + + // Construct an instance of the RepoInfo model + repoInfoModel := new(catalogmanagementv1.RepoInfo) + repoInfoModel.Token = core.StringPtr("testString") + repoInfoModel.Type = core.StringPtr("testString") + + // Construct an instance of the ImagePullKey model + imagePullKeyModel := new(catalogmanagementv1.ImagePullKey) + imagePullKeyModel.Name = core.StringPtr("testString") + imagePullKeyModel.Value = core.StringPtr("testString") + imagePullKeyModel.Description = core.StringPtr("testString") + + // Construct an instance of the SupportWaitTime model + supportWaitTimeModel := new(catalogmanagementv1.SupportWaitTime) + supportWaitTimeModel.Value = core.Int64Ptr(int64(38)) + supportWaitTimeModel.Type = core.StringPtr("testString") + + // Construct an instance of the SupportTime model + supportTimeModel := new(catalogmanagementv1.SupportTime) + supportTimeModel.Day = core.Int64Ptr(int64(38)) + supportTimeModel.StartTime = core.StringPtr("testString") + supportTimeModel.EndTime = core.StringPtr("testString") + + // Construct an instance of the SupportAvailability model + supportAvailabilityModel := new(catalogmanagementv1.SupportAvailability) + supportAvailabilityModel.Times = []catalogmanagementv1.SupportTime{*supportTimeModel} + supportAvailabilityModel.Timezone = core.StringPtr("testString") + supportAvailabilityModel.AlwaysAvailable = core.BoolPtr(true) + + // Construct an instance of the SupportDetail model + supportDetailModel := new(catalogmanagementv1.SupportDetail) + supportDetailModel.Type = core.StringPtr("testString") + supportDetailModel.Contact = core.StringPtr("testString") + supportDetailModel.ResponseWaitTime = supportWaitTimeModel + supportDetailModel.Availability = supportAvailabilityModel + + // Construct an instance of the SupportEscalation model + supportEscalationModel := new(catalogmanagementv1.SupportEscalation) + supportEscalationModel.EscalationWaitTime = supportWaitTimeModel + supportEscalationModel.ResponseWaitTime = supportWaitTimeModel + supportEscalationModel.Contact = core.StringPtr("testString") + + // Construct an instance of the Support model + supportModel := new(catalogmanagementv1.Support) + supportModel.URL = core.StringPtr("testString") + supportModel.Process = core.StringPtr("testString") + supportModel.ProcessI18n = make(map[string]string) + supportModel.Locations = []string{"testString"} + supportModel.SupportDetails = []catalogmanagementv1.SupportDetail{*supportDetailModel} + supportModel.SupportEscalation = supportEscalationModel + supportModel.SupportType = core.StringPtr("testString") + + // Construct an instance of the LearnMoreLinks model + learnMoreLinksModel := new(catalogmanagementv1.LearnMoreLinks) + learnMoreLinksModel.FirstParty = core.StringPtr("testString") + learnMoreLinksModel.ThirdParty = core.StringPtr("testString") + + // Construct an instance of the Constraint model + constraintModel := new(catalogmanagementv1.Constraint) + constraintModel.Type = core.StringPtr("testString") + constraintModel.Rule = core.StringPtr("testString") + + // Construct an instance of the Badge model + badgeModel := new(catalogmanagementv1.Badge) + badgeModel.ID = core.StringPtr("testString") + badgeModel.Label = core.StringPtr("testString") + badgeModel.LabelI18n = make(map[string]string) + badgeModel.Description = core.StringPtr("testString") + badgeModel.DescriptionI18n = make(map[string]string) + badgeModel.Icon = core.StringPtr("testString") + badgeModel.Authority = core.StringPtr("testString") + badgeModel.Tag = core.StringPtr("testString") + badgeModel.LearnMoreLinks = learnMoreLinksModel + badgeModel.Constraints = []catalogmanagementv1.Constraint{*constraintModel} + + // Construct an instance of the CreateOfferingOptions model + createOfferingOptionsModel := new(catalogmanagementv1.CreateOfferingOptions) + createOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") + createOfferingOptionsModel.ID = core.StringPtr("testString") + createOfferingOptionsModel.Rev = core.StringPtr("testString") + createOfferingOptionsModel.URL = core.StringPtr("testString") + createOfferingOptionsModel.CRN = core.StringPtr("testString") + createOfferingOptionsModel.Label = core.StringPtr("testString") + createOfferingOptionsModel.LabelI18n = make(map[string]string) + createOfferingOptionsModel.Name = core.StringPtr("testString") + createOfferingOptionsModel.OfferingIconURL = core.StringPtr("testString") + createOfferingOptionsModel.OfferingDocsURL = core.StringPtr("testString") + createOfferingOptionsModel.OfferingSupportURL = core.StringPtr("testString") + createOfferingOptionsModel.Tags = []string{"testString"} + createOfferingOptionsModel.Keywords = []string{"testString"} + createOfferingOptionsModel.Rating = ratingModel + createOfferingOptionsModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + createOfferingOptionsModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + createOfferingOptionsModel.ShortDescription = core.StringPtr("testString") + createOfferingOptionsModel.ShortDescriptionI18n = make(map[string]string) + createOfferingOptionsModel.LongDescription = core.StringPtr("testString") + createOfferingOptionsModel.LongDescriptionI18n = make(map[string]string) + createOfferingOptionsModel.Features = []catalogmanagementv1.Feature{*featureModel} + createOfferingOptionsModel.Kinds = []catalogmanagementv1.Kind{*kindModel} + createOfferingOptionsModel.PcManaged = core.BoolPtr(true) + createOfferingOptionsModel.PublishApproved = core.BoolPtr(true) + createOfferingOptionsModel.ShareWithAll = core.BoolPtr(true) + createOfferingOptionsModel.ShareWithIBM = core.BoolPtr(true) + createOfferingOptionsModel.ShareEnabled = core.BoolPtr(true) + createOfferingOptionsModel.PermitRequestIBMPublicPublish = core.BoolPtr(true) + createOfferingOptionsModel.IBMPublishApproved = core.BoolPtr(true) + createOfferingOptionsModel.PublicPublishApproved = core.BoolPtr(true) + createOfferingOptionsModel.PublicOriginalCRN = core.StringPtr("testString") + createOfferingOptionsModel.PublishPublicCRN = core.StringPtr("testString") + createOfferingOptionsModel.PortalApprovalRecord = core.StringPtr("testString") + createOfferingOptionsModel.PortalUIURL = core.StringPtr("testString") + createOfferingOptionsModel.CatalogID = core.StringPtr("testString") + createOfferingOptionsModel.CatalogName = core.StringPtr("testString") + createOfferingOptionsModel.Metadata = make(map[string]interface{}) + createOfferingOptionsModel.Disclaimer = core.StringPtr("testString") + createOfferingOptionsModel.Hidden = core.BoolPtr(true) + createOfferingOptionsModel.Provider = core.StringPtr("testString") + createOfferingOptionsModel.ProviderInfo = providerInfoModel + createOfferingOptionsModel.RepoInfo = repoInfoModel + createOfferingOptionsModel.ImagePullKeys = []catalogmanagementv1.ImagePullKey{*imagePullKeyModel} + createOfferingOptionsModel.Support = supportModel + createOfferingOptionsModel.Media = []catalogmanagementv1.MediaItem{*mediaItemModel} + createOfferingOptionsModel.DeprecatePending = deprecatePendingModel + createOfferingOptionsModel.ProductKind = core.StringPtr("testString") + createOfferingOptionsModel.Badges = []catalogmanagementv1.Badge{*badgeModel} + createOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := catalogManagementService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := catalogManagementService.CreateOffering(createOfferingOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the CreateOfferingOptions model with no property values + createOfferingOptionsModelNew := new(catalogmanagementv1.CreateOfferingOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = catalogManagementService.CreateOffering(createOfferingOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(201) + })) + }) + It(`Invoke CreateOffering successfully`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Construct an instance of the Rating model + ratingModel := new(catalogmanagementv1.Rating) + ratingModel.OneStarCount = core.Int64Ptr(int64(38)) + ratingModel.TwoStarCount = core.Int64Ptr(int64(38)) + ratingModel.ThreeStarCount = core.Int64Ptr(int64(38)) + ratingModel.FourStarCount = core.Int64Ptr(int64(38)) + + // Construct an instance of the Feature model + featureModel := new(catalogmanagementv1.Feature) + featureModel.Title = core.StringPtr("testString") + featureModel.TitleI18n = make(map[string]string) + featureModel.Description = core.StringPtr("testString") + featureModel.DescriptionI18n = make(map[string]string) + + // Construct an instance of the Flavor model + flavorModel := new(catalogmanagementv1.Flavor) + flavorModel.Name = core.StringPtr("testString") + flavorModel.Label = core.StringPtr("testString") + flavorModel.LabelI18n = make(map[string]string) + flavorModel.Index = core.Int64Ptr(int64(38)) + + // Construct an instance of the RenderTypeAssociationsParametersItem model + renderTypeAssociationsParametersItemModel := new(catalogmanagementv1.RenderTypeAssociationsParametersItem) + renderTypeAssociationsParametersItemModel.Name = core.StringPtr("testString") + renderTypeAssociationsParametersItemModel.OptionsRefresh = core.BoolPtr(true) + + // Construct an instance of the RenderTypeAssociations model + renderTypeAssociationsModel := new(catalogmanagementv1.RenderTypeAssociations) + renderTypeAssociationsModel.Parameters = []catalogmanagementv1.RenderTypeAssociationsParametersItem{*renderTypeAssociationsParametersItemModel} + + // Construct an instance of the RenderType model + renderTypeModel := new(catalogmanagementv1.RenderType) + renderTypeModel.Type = core.StringPtr("testString") + renderTypeModel.Grouping = core.StringPtr("testString") + renderTypeModel.OriginalGrouping = core.StringPtr("testString") + renderTypeModel.GroupingIndex = core.Int64Ptr(int64(38)) + renderTypeModel.ConfigConstraints = map[string]interface{}{"anyKey": "anyValue"} + renderTypeModel.Associations = renderTypeAssociationsModel + + // Construct an instance of the Configuration model + configurationModel := new(catalogmanagementv1.Configuration) + configurationModel.Key = core.StringPtr("testString") + configurationModel.Type = core.StringPtr("testString") + configurationModel.DefaultValue = core.StringPtr("testString") + configurationModel.DisplayName = core.StringPtr("testString") + configurationModel.ValueConstraint = core.StringPtr("testString") + configurationModel.Description = core.StringPtr("testString") + configurationModel.Required = core.BoolPtr(true) + configurationModel.Options = []interface{}{"testString"} + configurationModel.Hidden = core.BoolPtr(true) + configurationModel.CustomConfig = renderTypeModel + configurationModel.TypeMetadata = core.StringPtr("testString") + + // Construct an instance of the Output model + outputModel := new(catalogmanagementv1.Output) + outputModel.Key = core.StringPtr("testString") + outputModel.Description = core.StringPtr("testString") + + // Construct an instance of the IamResource model + iamResourceModel := new(catalogmanagementv1.IamResource) + iamResourceModel.Name = core.StringPtr("testString") + iamResourceModel.Description = core.StringPtr("testString") + iamResourceModel.RoleCrns = []string{"testString"} + + // Construct an instance of the IamPermission model + iamPermissionModel := new(catalogmanagementv1.IamPermission) + iamPermissionModel.ServiceName = core.StringPtr("testString") + iamPermissionModel.RoleCrns = []string{"testString"} + iamPermissionModel.Resources = []catalogmanagementv1.IamResource{*iamResourceModel} + + // Construct an instance of the Validation model + validationModel := new(catalogmanagementv1.Validation) + validationModel.Validated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + validationModel.Requested = CreateMockDateTime("2019-01-01T12:00:00.000Z") + validationModel.State = core.StringPtr("testString") + validationModel.LastOperation = core.StringPtr("testString") + validationModel.Target = make(map[string]interface{}) + validationModel.Message = core.StringPtr("testString") + + // Construct an instance of the Resource model + resourceModel := new(catalogmanagementv1.Resource) + resourceModel.Type = core.StringPtr("mem") + resourceModel.Value = core.StringPtr("testString") + + // Construct an instance of the Script model + scriptModel := new(catalogmanagementv1.Script) + scriptModel.Instructions = core.StringPtr("testString") + scriptModel.InstructionsI18n = make(map[string]string) + scriptModel.Script = core.StringPtr("testString") + scriptModel.ScriptPermission = core.StringPtr("testString") + scriptModel.DeleteScript = core.StringPtr("testString") + scriptModel.Scope = core.StringPtr("testString") + + // Construct an instance of the VersionEntitlement model + versionEntitlementModel := new(catalogmanagementv1.VersionEntitlement) + versionEntitlementModel.ProviderName = core.StringPtr("testString") + versionEntitlementModel.ProviderID = core.StringPtr("testString") + versionEntitlementModel.ProductID = core.StringPtr("testString") + versionEntitlementModel.PartNumbers = []string{"testString"} + versionEntitlementModel.ImageRepoName = core.StringPtr("testString") + + // Construct an instance of the License model + licenseModel := new(catalogmanagementv1.License) + licenseModel.ID = core.StringPtr("testString") + licenseModel.Name = core.StringPtr("testString") + licenseModel.Type = core.StringPtr("testString") + licenseModel.URL = core.StringPtr("testString") + licenseModel.Description = core.StringPtr("testString") + + // Construct an instance of the State model + stateModel := new(catalogmanagementv1.State) + stateModel.Current = core.StringPtr("testString") + stateModel.CurrentEntered = CreateMockDateTime("2019-01-01T12:00:00.000Z") + stateModel.Pending = core.StringPtr("testString") + stateModel.PendingRequested = CreateMockDateTime("2019-01-01T12:00:00.000Z") + stateModel.Previous = core.StringPtr("testString") + + // Construct an instance of the DeprecatePending model + deprecatePendingModel := new(catalogmanagementv1.DeprecatePending) + deprecatePendingModel.DeprecateDate = CreateMockDateTime("2019-01-01T12:00:00.000Z") + deprecatePendingModel.DeprecateState = core.StringPtr("testString") + deprecatePendingModel.Description = core.StringPtr("testString") + + // Construct an instance of the URLProxy model + urlProxyModel := new(catalogmanagementv1.URLProxy) + urlProxyModel.URL = core.StringPtr("testString") + urlProxyModel.Sha = core.StringPtr("testString") + + // Construct an instance of the MediaItem model + mediaItemModel := new(catalogmanagementv1.MediaItem) + mediaItemModel.URL = core.StringPtr("testString") + mediaItemModel.APIURL = core.StringPtr("testString") + mediaItemModel.URLProxy = urlProxyModel + mediaItemModel.Caption = core.StringPtr("testString") + mediaItemModel.CaptionI18n = make(map[string]string) + mediaItemModel.Type = core.StringPtr("testString") + mediaItemModel.ThumbnailURL = core.StringPtr("testString") + + // Construct an instance of the ArchitectureDiagram model + architectureDiagramModel := new(catalogmanagementv1.ArchitectureDiagram) + architectureDiagramModel.Diagram = mediaItemModel + architectureDiagramModel.Description = core.StringPtr("testString") + architectureDiagramModel.DescriptionI18n = make(map[string]string) + + // Construct an instance of the CostComponent model + costComponentModel := new(catalogmanagementv1.CostComponent) + costComponentModel.Name = core.StringPtr("testString") + costComponentModel.Unit = core.StringPtr("testString") + costComponentModel.HourlyQuantity = core.StringPtr("testString") + costComponentModel.MonthlyQuantity = core.StringPtr("testString") + costComponentModel.Price = core.StringPtr("testString") + costComponentModel.HourlyCost = core.StringPtr("testString") + costComponentModel.MonthlyCost = core.StringPtr("testString") + + // Construct an instance of the CostResource model + costResourceModel := new(catalogmanagementv1.CostResource) + costResourceModel.Name = core.StringPtr("testString") + costResourceModel.Metadata = make(map[string]interface{}) + costResourceModel.HourlyCost = core.StringPtr("testString") + costResourceModel.MonthlyCost = core.StringPtr("testString") + costResourceModel.CostComponents = []catalogmanagementv1.CostComponent{*costComponentModel} + + // Construct an instance of the CostBreakdown model + costBreakdownModel := new(catalogmanagementv1.CostBreakdown) + costBreakdownModel.TotalHourlyCost = core.StringPtr("testString") + costBreakdownModel.TotalMonthlyCOst = core.StringPtr("testString") + costBreakdownModel.Resources = []catalogmanagementv1.CostResource{*costResourceModel} + + // Construct an instance of the CostSummary model + costSummaryModel := new(catalogmanagementv1.CostSummary) + costSummaryModel.TotalDetectedResources = core.Int64Ptr(int64(38)) + costSummaryModel.TotalSupportedResources = core.Int64Ptr(int64(38)) + costSummaryModel.TotalUnsupportedResources = core.Int64Ptr(int64(38)) + costSummaryModel.TotalUsageBasedResources = core.Int64Ptr(int64(38)) + costSummaryModel.TotalNoPriceResources = core.Int64Ptr(int64(38)) + costSummaryModel.UnsupportedResourceCounts = make(map[string]int64) + costSummaryModel.NoPriceResourceCounts = make(map[string]int64) + + // Construct an instance of the Project model + projectModel := new(catalogmanagementv1.Project) + projectModel.Name = core.StringPtr("testString") + projectModel.Metadata = make(map[string]interface{}) + projectModel.PastBreakdown = costBreakdownModel + projectModel.Breakdown = costBreakdownModel + projectModel.Diff = costBreakdownModel + projectModel.Summary = costSummaryModel + + // Construct an instance of the CostEstimate model + costEstimateModel := new(catalogmanagementv1.CostEstimate) + costEstimateModel.Version = core.StringPtr("testString") + costEstimateModel.Currency = core.StringPtr("testString") + costEstimateModel.Projects = []catalogmanagementv1.Project{*projectModel} + costEstimateModel.Summary = costSummaryModel + costEstimateModel.TotalHourlyCost = core.StringPtr("testString") + costEstimateModel.TotalMonthlyCost = core.StringPtr("testString") + costEstimateModel.PastTotalHourlyCost = core.StringPtr("testString") + costEstimateModel.PastTotalMonthlyCost = core.StringPtr("testString") + costEstimateModel.DiffTotalHourlyCost = core.StringPtr("testString") + costEstimateModel.DiffTotalMonthlyCost = core.StringPtr("testString") + costEstimateModel.TimeGenerated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + + // Construct an instance of the Dependency model + dependencyModel := new(catalogmanagementv1.Dependency) + dependencyModel.CatalogID = core.StringPtr("testString") + dependencyModel.ID = core.StringPtr("testString") + dependencyModel.Name = core.StringPtr("testString") + dependencyModel.Version = core.StringPtr("testString") + dependencyModel.Flavors = []string{"testString"} + + // Construct an instance of the SolutionInfo model + solutionInfoModel := new(catalogmanagementv1.SolutionInfo) + solutionInfoModel.ArchitectureDiagrams = []catalogmanagementv1.ArchitectureDiagram{*architectureDiagramModel} + solutionInfoModel.Features = []catalogmanagementv1.Feature{*featureModel} + solutionInfoModel.CostEstimate = costEstimateModel + solutionInfoModel.Dependencies = []catalogmanagementv1.Dependency{*dependencyModel} + + // Construct an instance of the Version model + versionModel := new(catalogmanagementv1.Version) + versionModel.ID = core.StringPtr("testString") + versionModel.Rev = core.StringPtr("testString") + versionModel.CRN = core.StringPtr("testString") + versionModel.Version = core.StringPtr("testString") + versionModel.Flavor = flavorModel + versionModel.Sha = core.StringPtr("testString") + versionModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + versionModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + versionModel.OfferingID = core.StringPtr("testString") + versionModel.CatalogID = core.StringPtr("testString") + versionModel.KindID = core.StringPtr("testString") + versionModel.Tags = []string{"testString"} + versionModel.RepoURL = core.StringPtr("testString") + versionModel.SourceURL = core.StringPtr("testString") + versionModel.TgzURL = core.StringPtr("testString") + versionModel.Configuration = []catalogmanagementv1.Configuration{*configurationModel} + versionModel.Outputs = []catalogmanagementv1.Output{*outputModel} + versionModel.IamPermissions = []catalogmanagementv1.IamPermission{*iamPermissionModel} + versionModel.Metadata = make(map[string]interface{}) + versionModel.Validation = validationModel + versionModel.RequiredResources = []catalogmanagementv1.Resource{*resourceModel} + versionModel.SingleInstance = core.BoolPtr(true) + versionModel.Install = scriptModel + versionModel.PreInstall = []catalogmanagementv1.Script{*scriptModel} + versionModel.Entitlement = versionEntitlementModel + versionModel.Licenses = []catalogmanagementv1.License{*licenseModel} + versionModel.ImageManifestURL = core.StringPtr("testString") + versionModel.Deprecated = core.BoolPtr(true) + versionModel.PackageVersion = core.StringPtr("testString") + versionModel.State = stateModel + versionModel.VersionLocator = core.StringPtr("testString") + versionModel.LongDescription = core.StringPtr("testString") + versionModel.LongDescriptionI18n = make(map[string]string) + versionModel.WhitelistedAccounts = []string{"testString"} + versionModel.ImagePullKeyName = core.StringPtr("testString") + versionModel.DeprecatePending = deprecatePendingModel + versionModel.SolutionInfo = solutionInfoModel + versionModel.IsConsumable = core.BoolPtr(true) + + // Construct an instance of the Deployment model + deploymentModel := new(catalogmanagementv1.Deployment) + deploymentModel.ID = core.StringPtr("testString") + deploymentModel.Label = core.StringPtr("testString") + deploymentModel.Name = core.StringPtr("testString") + deploymentModel.ShortDescription = core.StringPtr("testString") + deploymentModel.LongDescription = core.StringPtr("testString") + deploymentModel.Metadata = make(map[string]interface{}) + deploymentModel.Tags = []string{"testString"} + deploymentModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + deploymentModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + + // Construct an instance of the Plan model + planModel := new(catalogmanagementv1.Plan) + planModel.ID = core.StringPtr("testString") + planModel.Label = core.StringPtr("testString") + planModel.Name = core.StringPtr("testString") + planModel.ShortDescription = core.StringPtr("testString") + planModel.LongDescription = core.StringPtr("testString") + planModel.Metadata = make(map[string]interface{}) + planModel.Tags = []string{"testString"} + planModel.AdditionalFeatures = []catalogmanagementv1.Feature{*featureModel} + planModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + planModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + planModel.Deployments = []catalogmanagementv1.Deployment{*deploymentModel} + + // Construct an instance of the Kind model + kindModel := new(catalogmanagementv1.Kind) + kindModel.ID = core.StringPtr("testString") + kindModel.FormatKind = core.StringPtr("testString") + kindModel.InstallKind = core.StringPtr("testString") + kindModel.TargetKind = core.StringPtr("testString") + kindModel.Metadata = make(map[string]interface{}) + kindModel.Tags = []string{"testString"} + kindModel.AdditionalFeatures = []catalogmanagementv1.Feature{*featureModel} + kindModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + kindModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + kindModel.Versions = []catalogmanagementv1.Version{*versionModel} + kindModel.Plans = []catalogmanagementv1.Plan{*planModel} + + // Construct an instance of the ProviderInfo model + providerInfoModel := new(catalogmanagementv1.ProviderInfo) + providerInfoModel.ID = core.StringPtr("testString") + providerInfoModel.Name = core.StringPtr("testString") + + // Construct an instance of the RepoInfo model + repoInfoModel := new(catalogmanagementv1.RepoInfo) + repoInfoModel.Token = core.StringPtr("testString") + repoInfoModel.Type = core.StringPtr("testString") + + // Construct an instance of the ImagePullKey model + imagePullKeyModel := new(catalogmanagementv1.ImagePullKey) + imagePullKeyModel.Name = core.StringPtr("testString") + imagePullKeyModel.Value = core.StringPtr("testString") + imagePullKeyModel.Description = core.StringPtr("testString") + + // Construct an instance of the SupportWaitTime model + supportWaitTimeModel := new(catalogmanagementv1.SupportWaitTime) + supportWaitTimeModel.Value = core.Int64Ptr(int64(38)) + supportWaitTimeModel.Type = core.StringPtr("testString") + + // Construct an instance of the SupportTime model + supportTimeModel := new(catalogmanagementv1.SupportTime) + supportTimeModel.Day = core.Int64Ptr(int64(38)) + supportTimeModel.StartTime = core.StringPtr("testString") + supportTimeModel.EndTime = core.StringPtr("testString") + + // Construct an instance of the SupportAvailability model + supportAvailabilityModel := new(catalogmanagementv1.SupportAvailability) + supportAvailabilityModel.Times = []catalogmanagementv1.SupportTime{*supportTimeModel} + supportAvailabilityModel.Timezone = core.StringPtr("testString") + supportAvailabilityModel.AlwaysAvailable = core.BoolPtr(true) + + // Construct an instance of the SupportDetail model + supportDetailModel := new(catalogmanagementv1.SupportDetail) + supportDetailModel.Type = core.StringPtr("testString") + supportDetailModel.Contact = core.StringPtr("testString") + supportDetailModel.ResponseWaitTime = supportWaitTimeModel + supportDetailModel.Availability = supportAvailabilityModel + + // Construct an instance of the SupportEscalation model + supportEscalationModel := new(catalogmanagementv1.SupportEscalation) + supportEscalationModel.EscalationWaitTime = supportWaitTimeModel + supportEscalationModel.ResponseWaitTime = supportWaitTimeModel + supportEscalationModel.Contact = core.StringPtr("testString") + + // Construct an instance of the Support model + supportModel := new(catalogmanagementv1.Support) + supportModel.URL = core.StringPtr("testString") + supportModel.Process = core.StringPtr("testString") + supportModel.ProcessI18n = make(map[string]string) + supportModel.Locations = []string{"testString"} + supportModel.SupportDetails = []catalogmanagementv1.SupportDetail{*supportDetailModel} + supportModel.SupportEscalation = supportEscalationModel + supportModel.SupportType = core.StringPtr("testString") + + // Construct an instance of the LearnMoreLinks model + learnMoreLinksModel := new(catalogmanagementv1.LearnMoreLinks) + learnMoreLinksModel.FirstParty = core.StringPtr("testString") + learnMoreLinksModel.ThirdParty = core.StringPtr("testString") + + // Construct an instance of the Constraint model + constraintModel := new(catalogmanagementv1.Constraint) + constraintModel.Type = core.StringPtr("testString") + constraintModel.Rule = core.StringPtr("testString") + + // Construct an instance of the Badge model + badgeModel := new(catalogmanagementv1.Badge) + badgeModel.ID = core.StringPtr("testString") + badgeModel.Label = core.StringPtr("testString") + badgeModel.LabelI18n = make(map[string]string) + badgeModel.Description = core.StringPtr("testString") + badgeModel.DescriptionI18n = make(map[string]string) + badgeModel.Icon = core.StringPtr("testString") + badgeModel.Authority = core.StringPtr("testString") + badgeModel.Tag = core.StringPtr("testString") + badgeModel.LearnMoreLinks = learnMoreLinksModel + badgeModel.Constraints = []catalogmanagementv1.Constraint{*constraintModel} + + // Construct an instance of the CreateOfferingOptions model + createOfferingOptionsModel := new(catalogmanagementv1.CreateOfferingOptions) + createOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") + createOfferingOptionsModel.ID = core.StringPtr("testString") + createOfferingOptionsModel.Rev = core.StringPtr("testString") + createOfferingOptionsModel.URL = core.StringPtr("testString") + createOfferingOptionsModel.CRN = core.StringPtr("testString") + createOfferingOptionsModel.Label = core.StringPtr("testString") + createOfferingOptionsModel.LabelI18n = make(map[string]string) + createOfferingOptionsModel.Name = core.StringPtr("testString") + createOfferingOptionsModel.OfferingIconURL = core.StringPtr("testString") + createOfferingOptionsModel.OfferingDocsURL = core.StringPtr("testString") + createOfferingOptionsModel.OfferingSupportURL = core.StringPtr("testString") + createOfferingOptionsModel.Tags = []string{"testString"} + createOfferingOptionsModel.Keywords = []string{"testString"} + createOfferingOptionsModel.Rating = ratingModel + createOfferingOptionsModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + createOfferingOptionsModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + createOfferingOptionsModel.ShortDescription = core.StringPtr("testString") + createOfferingOptionsModel.ShortDescriptionI18n = make(map[string]string) + createOfferingOptionsModel.LongDescription = core.StringPtr("testString") + createOfferingOptionsModel.LongDescriptionI18n = make(map[string]string) + createOfferingOptionsModel.Features = []catalogmanagementv1.Feature{*featureModel} + createOfferingOptionsModel.Kinds = []catalogmanagementv1.Kind{*kindModel} + createOfferingOptionsModel.PcManaged = core.BoolPtr(true) + createOfferingOptionsModel.PublishApproved = core.BoolPtr(true) + createOfferingOptionsModel.ShareWithAll = core.BoolPtr(true) + createOfferingOptionsModel.ShareWithIBM = core.BoolPtr(true) + createOfferingOptionsModel.ShareEnabled = core.BoolPtr(true) + createOfferingOptionsModel.PermitRequestIBMPublicPublish = core.BoolPtr(true) + createOfferingOptionsModel.IBMPublishApproved = core.BoolPtr(true) + createOfferingOptionsModel.PublicPublishApproved = core.BoolPtr(true) + createOfferingOptionsModel.PublicOriginalCRN = core.StringPtr("testString") + createOfferingOptionsModel.PublishPublicCRN = core.StringPtr("testString") + createOfferingOptionsModel.PortalApprovalRecord = core.StringPtr("testString") + createOfferingOptionsModel.PortalUIURL = core.StringPtr("testString") + createOfferingOptionsModel.CatalogID = core.StringPtr("testString") + createOfferingOptionsModel.CatalogName = core.StringPtr("testString") + createOfferingOptionsModel.Metadata = make(map[string]interface{}) + createOfferingOptionsModel.Disclaimer = core.StringPtr("testString") + createOfferingOptionsModel.Hidden = core.BoolPtr(true) + createOfferingOptionsModel.Provider = core.StringPtr("testString") + createOfferingOptionsModel.ProviderInfo = providerInfoModel + createOfferingOptionsModel.RepoInfo = repoInfoModel + createOfferingOptionsModel.ImagePullKeys = []catalogmanagementv1.ImagePullKey{*imagePullKeyModel} + createOfferingOptionsModel.Support = supportModel + createOfferingOptionsModel.Media = []catalogmanagementv1.MediaItem{*mediaItemModel} + createOfferingOptionsModel.DeprecatePending = deprecatePendingModel + createOfferingOptionsModel.ProductKind = core.StringPtr("testString") + createOfferingOptionsModel.Badges = []catalogmanagementv1.Badge{*badgeModel} + createOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := catalogManagementService.CreateOffering(createOfferingOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ImportOfferingVersion(importOfferingVersionOptions *ImportOfferingVersionOptions) - Operation response error`, func() { + importOfferingVersionPath := "/catalogs/testString/offerings/testString/version" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(importOfferingVersionPath)) + Expect(req.Method).To(Equal("POST")) + Expect(req.Header["X-Auth-Token"]).ToNot(BeNil()) + Expect(req.Header["X-Auth-Token"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["zipurl"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["targetVersion"]).To(Equal([]string{"testString"})) + // TODO: Add check for includeConfig query parameter + // TODO: Add check for isVSI query parameter + Expect(req.URL.Query()["repotype"]).To(Equal([]string{"testString"})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(201) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke ImportOfferingVersion with error: Operation response processing error`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Construct an instance of the Flavor model + flavorModel := new(catalogmanagementv1.Flavor) + flavorModel.Name = core.StringPtr("testString") + flavorModel.Label = core.StringPtr("testString") + flavorModel.LabelI18n = make(map[string]string) + flavorModel.Index = core.Int64Ptr(int64(38)) + + // Construct an instance of the ImportOfferingBodyMetadataOperatingSystem model + importOfferingBodyMetadataOperatingSystemModel := new(catalogmanagementv1.ImportOfferingBodyMetadataOperatingSystem) + importOfferingBodyMetadataOperatingSystemModel.DedicatedHostOnly = core.BoolPtr(true) + importOfferingBodyMetadataOperatingSystemModel.Vendor = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.Name = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.Href = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.DisplayName = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.Family = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.Version = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.Architecture = core.StringPtr("testString") + + // Construct an instance of the ImportOfferingBodyMetadataFile model + importOfferingBodyMetadataFileModel := new(catalogmanagementv1.ImportOfferingBodyMetadataFile) + importOfferingBodyMetadataFileModel.Size = core.Int64Ptr(int64(38)) + + // Construct an instance of the ImportOfferingBodyMetadataImagesItem model + importOfferingBodyMetadataImagesItemModel := new(catalogmanagementv1.ImportOfferingBodyMetadataImagesItem) + importOfferingBodyMetadataImagesItemModel.ID = core.StringPtr("testString") + importOfferingBodyMetadataImagesItemModel.Name = core.StringPtr("testString") + importOfferingBodyMetadataImagesItemModel.Region = core.StringPtr("testString") + + // Construct an instance of the ImportOfferingBodyMetadata model + importOfferingBodyMetadataModel := new(catalogmanagementv1.ImportOfferingBodyMetadata) + importOfferingBodyMetadataModel.OperatingSystem = importOfferingBodyMetadataOperatingSystemModel + importOfferingBodyMetadataModel.File = importOfferingBodyMetadataFileModel + importOfferingBodyMetadataModel.MinimumProvisionedSize = core.Int64Ptr(int64(38)) + importOfferingBodyMetadataModel.Images = []catalogmanagementv1.ImportOfferingBodyMetadataImagesItem{*importOfferingBodyMetadataImagesItemModel} + + // Construct an instance of the ImportOfferingVersionOptions model + importOfferingVersionOptionsModel := new(catalogmanagementv1.ImportOfferingVersionOptions) + importOfferingVersionOptionsModel.CatalogIdentifier = core.StringPtr("testString") + importOfferingVersionOptionsModel.OfferingID = core.StringPtr("testString") + importOfferingVersionOptionsModel.Tags = []string{"testString"} + importOfferingVersionOptionsModel.Content = CreateMockByteArray("This is a mock byte array value.") + importOfferingVersionOptionsModel.Name = core.StringPtr("testString") + importOfferingVersionOptionsModel.Label = core.StringPtr("testString") + importOfferingVersionOptionsModel.InstallKind = core.StringPtr("testString") + importOfferingVersionOptionsModel.TargetKinds = []string{"testString"} + importOfferingVersionOptionsModel.FormatKind = core.StringPtr("testString") + importOfferingVersionOptionsModel.ProductKind = core.StringPtr("testString") + importOfferingVersionOptionsModel.Sha = core.StringPtr("testString") + importOfferingVersionOptionsModel.Version = core.StringPtr("testString") + importOfferingVersionOptionsModel.Flavor = flavorModel + importOfferingVersionOptionsModel.Metadata = importOfferingBodyMetadataModel + importOfferingVersionOptionsModel.WorkingDirectory = core.StringPtr("testString") + importOfferingVersionOptionsModel.Zipurl = core.StringPtr("testString") + importOfferingVersionOptionsModel.TargetVersion = core.StringPtr("testString") + importOfferingVersionOptionsModel.IncludeConfig = core.BoolPtr(true) + importOfferingVersionOptionsModel.IsVsi = core.BoolPtr(true) + importOfferingVersionOptionsModel.Repotype = core.StringPtr("testString") + importOfferingVersionOptionsModel.XAuthToken = core.StringPtr("testString") + importOfferingVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := catalogManagementService.ImportOfferingVersion(importOfferingVersionOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + catalogManagementService.EnableRetries(0, 0) + result, response, operationErr = catalogManagementService.ImportOfferingVersion(importOfferingVersionOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ImportOfferingVersion(importOfferingVersionOptions *ImportOfferingVersionOptions)`, func() { + importOfferingVersionPath := "/catalogs/testString/offerings/testString/version" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(importOfferingVersionPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + Expect(req.Header["X-Auth-Token"]).ToNot(BeNil()) + Expect(req.Header["X-Auth-Token"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["zipurl"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["targetVersion"]).To(Equal([]string{"testString"})) + // TODO: Add check for includeConfig query parameter + // TODO: Add check for isVSI query parameter + Expect(req.URL.Query()["repotype"]).To(Equal([]string{"testString"})) + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "url": "URL", "crn": "CRN", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "name": "Name", "offering_icon_url": "OfferingIconURL", "offering_docs_url": "OfferingDocsURL", "offering_support_url": "OfferingSupportURL", "tags": ["Tags"], "keywords": ["Keywords"], "rating": {"one_star_count": 12, "two_star_count": 12, "three_star_count": 14, "four_star_count": 13}, "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "short_description": "ShortDescription", "short_description_i18n": {"mapKey": "Inner"}, "long_description": "LongDescription", "long_description_i18n": {"mapKey": "Inner"}, "features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "kinds": [{"id": "ID", "format_kind": "FormatKind", "install_kind": "InstallKind", "target_kind": "TargetKind", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "additional_features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "versions": [{"id": "ID", "_rev": "Rev", "crn": "CRN", "version": "Version", "flavor": {"name": "Name", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "index": 5}, "sha": "Sha", "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "offering_id": "OfferingID", "catalog_id": "CatalogID", "kind_id": "KindID", "tags": ["Tags"], "repo_url": "RepoURL", "source_url": "SourceURL", "tgz_url": "TgzURL", "configuration": [{"key": "Key", "type": "Type", "default_value": "anyValue", "display_name": "DisplayName", "value_constraint": "ValueConstraint", "description": "Description", "required": true, "options": ["anyValue"], "hidden": true, "custom_config": {"type": "Type", "grouping": "Grouping", "original_grouping": "OriginalGrouping", "grouping_index": 13, "config_constraints": {"anyKey": "anyValue"}, "associations": {"parameters": [{"name": "Name", "optionsRefresh": true}]}}, "type_metadata": "TypeMetadata"}], "outputs": [{"key": "Key", "description": "Description"}], "iam_permissions": [{"service_name": "ServiceName", "role_crns": ["RoleCrns"], "resources": [{"name": "Name", "description": "Description", "role_crns": ["RoleCrns"]}]}], "metadata": {"mapKey": "anyValue"}, "validation": {"validated": "2019-01-01T12:00:00.000Z", "requested": "2019-01-01T12:00:00.000Z", "state": "State", "last_operation": "LastOperation", "target": {"mapKey": "anyValue"}, "message": "Message"}, "required_resources": [{"type": "mem", "value": "anyValue"}], "single_instance": true, "install": {"instructions": "Instructions", "instructions_i18n": {"mapKey": "Inner"}, "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}, "pre_install": [{"instructions": "Instructions", "instructions_i18n": {"mapKey": "Inner"}, "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}], "entitlement": {"provider_name": "ProviderName", "provider_id": "ProviderID", "product_id": "ProductID", "part_numbers": ["PartNumbers"], "image_repo_name": "ImageRepoName"}, "licenses": [{"id": "ID", "name": "Name", "type": "Type", "url": "URL", "description": "Description"}], "image_manifest_url": "ImageManifestURL", "deprecated": true, "package_version": "PackageVersion", "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "version_locator": "VersionLocator", "long_description": "LongDescription", "long_description_i18n": {"mapKey": "Inner"}, "whitelisted_accounts": ["WhitelistedAccounts"], "image_pull_key_name": "ImagePullKeyName", "deprecate_pending": {"deprecate_date": "2019-01-01T12:00:00.000Z", "deprecate_state": "DeprecateState", "description": "Description"}, "solution_info": {"architecture_diagrams": [{"diagram": {"url": "URL", "api_url": "APIURL", "url_proxy": {"url": "URL", "sha": "Sha"}, "caption": "Caption", "caption_i18n": {"mapKey": "Inner"}, "type": "Type", "thumbnail_url": "ThumbnailURL"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "cost_estimate": {"version": "Version", "currency": "Currency", "projects": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "pastBreakdown": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "breakdown": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "diff": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "summary": {"totalDetectedResources": 22, "totalSupportedResources": 23, "totalUnsupportedResources": 25, "totalUsageBasedResources": 24, "totalNoPriceResources": 21, "unsupportedResourceCounts": {"mapKey": 5}, "noPriceResourceCounts": {"mapKey": 5}}}], "summary": {"totalDetectedResources": 22, "totalSupportedResources": 23, "totalUnsupportedResources": 25, "totalUsageBasedResources": 24, "totalNoPriceResources": 21, "unsupportedResourceCounts": {"mapKey": 5}, "noPriceResourceCounts": {"mapKey": 5}}, "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z"}, "dependencies": [{"catalog_id": "CatalogID", "id": "ID", "name": "Name", "version": "Version", "flavors": ["Flavors"]}]}, "is_consumable": true}], "plans": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "additional_features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "deployments": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z"}]}]}], "pc_managed": false, "publish_approved": false, "share_with_all": true, "share_with_ibm": true, "share_enabled": true, "permit_request_ibm_public_publish": false, "ibm_publish_approved": true, "public_publish_approved": false, "public_original_crn": "PublicOriginalCRN", "publish_public_crn": "PublishPublicCRN", "portal_approval_record": "PortalApprovalRecord", "portal_ui_url": "PortalUIURL", "catalog_id": "CatalogID", "catalog_name": "CatalogName", "metadata": {"mapKey": "anyValue"}, "disclaimer": "Disclaimer", "hidden": true, "provider": "Provider", "provider_info": {"id": "ID", "name": "Name"}, "repo_info": {"token": "Token", "type": "Type"}, "image_pull_keys": [{"name": "Name", "value": "Value", "description": "Description"}], "support": {"url": "URL", "process": "Process", "process_i18n": {"mapKey": "Inner"}, "locations": ["Locations"], "support_details": [{"type": "Type", "contact": "Contact", "response_wait_time": {"value": 5, "type": "Type"}, "availability": {"times": [{"day": 3, "start_time": "StartTime", "end_time": "EndTime"}], "timezone": "Timezone", "always_available": false}}], "support_escalation": {"escalation_wait_time": {"value": 5, "type": "Type"}, "response_wait_time": {"value": 5, "type": "Type"}, "contact": "Contact"}, "support_type": "SupportType"}, "media": [{"url": "URL", "api_url": "APIURL", "url_proxy": {"url": "URL", "sha": "Sha"}, "caption": "Caption", "caption_i18n": {"mapKey": "Inner"}, "type": "Type", "thumbnail_url": "ThumbnailURL"}], "deprecate_pending": {"deprecate_date": "2019-01-01T12:00:00.000Z", "deprecate_state": "DeprecateState", "description": "Description"}, "product_kind": "ProductKind", "badges": [{"id": "ID", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}, "icon": "Icon", "authority": "Authority", "tag": "Tag", "learn_more_links": {"first_party": "FirstParty", "third_party": "ThirdParty"}, "constraints": [{"type": "Type", "rule": "anyValue"}]}]}`) + })) + }) + It(`Invoke ImportOfferingVersion successfully with retries`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + catalogManagementService.EnableRetries(0, 0) + + // Construct an instance of the Flavor model + flavorModel := new(catalogmanagementv1.Flavor) + flavorModel.Name = core.StringPtr("testString") + flavorModel.Label = core.StringPtr("testString") + flavorModel.LabelI18n = make(map[string]string) + flavorModel.Index = core.Int64Ptr(int64(38)) + + // Construct an instance of the ImportOfferingBodyMetadataOperatingSystem model + importOfferingBodyMetadataOperatingSystemModel := new(catalogmanagementv1.ImportOfferingBodyMetadataOperatingSystem) + importOfferingBodyMetadataOperatingSystemModel.DedicatedHostOnly = core.BoolPtr(true) + importOfferingBodyMetadataOperatingSystemModel.Vendor = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.Name = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.Href = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.DisplayName = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.Family = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.Version = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.Architecture = core.StringPtr("testString") + + // Construct an instance of the ImportOfferingBodyMetadataFile model + importOfferingBodyMetadataFileModel := new(catalogmanagementv1.ImportOfferingBodyMetadataFile) + importOfferingBodyMetadataFileModel.Size = core.Int64Ptr(int64(38)) + + // Construct an instance of the ImportOfferingBodyMetadataImagesItem model + importOfferingBodyMetadataImagesItemModel := new(catalogmanagementv1.ImportOfferingBodyMetadataImagesItem) + importOfferingBodyMetadataImagesItemModel.ID = core.StringPtr("testString") + importOfferingBodyMetadataImagesItemModel.Name = core.StringPtr("testString") + importOfferingBodyMetadataImagesItemModel.Region = core.StringPtr("testString") + + // Construct an instance of the ImportOfferingBodyMetadata model + importOfferingBodyMetadataModel := new(catalogmanagementv1.ImportOfferingBodyMetadata) + importOfferingBodyMetadataModel.OperatingSystem = importOfferingBodyMetadataOperatingSystemModel + importOfferingBodyMetadataModel.File = importOfferingBodyMetadataFileModel + importOfferingBodyMetadataModel.MinimumProvisionedSize = core.Int64Ptr(int64(38)) + importOfferingBodyMetadataModel.Images = []catalogmanagementv1.ImportOfferingBodyMetadataImagesItem{*importOfferingBodyMetadataImagesItemModel} + + // Construct an instance of the ImportOfferingVersionOptions model + importOfferingVersionOptionsModel := new(catalogmanagementv1.ImportOfferingVersionOptions) + importOfferingVersionOptionsModel.CatalogIdentifier = core.StringPtr("testString") + importOfferingVersionOptionsModel.OfferingID = core.StringPtr("testString") + importOfferingVersionOptionsModel.Tags = []string{"testString"} + importOfferingVersionOptionsModel.Content = CreateMockByteArray("This is a mock byte array value.") + importOfferingVersionOptionsModel.Name = core.StringPtr("testString") + importOfferingVersionOptionsModel.Label = core.StringPtr("testString") + importOfferingVersionOptionsModel.InstallKind = core.StringPtr("testString") + importOfferingVersionOptionsModel.TargetKinds = []string{"testString"} + importOfferingVersionOptionsModel.FormatKind = core.StringPtr("testString") + importOfferingVersionOptionsModel.ProductKind = core.StringPtr("testString") + importOfferingVersionOptionsModel.Sha = core.StringPtr("testString") + importOfferingVersionOptionsModel.Version = core.StringPtr("testString") + importOfferingVersionOptionsModel.Flavor = flavorModel + importOfferingVersionOptionsModel.Metadata = importOfferingBodyMetadataModel + importOfferingVersionOptionsModel.WorkingDirectory = core.StringPtr("testString") + importOfferingVersionOptionsModel.Zipurl = core.StringPtr("testString") + importOfferingVersionOptionsModel.TargetVersion = core.StringPtr("testString") + importOfferingVersionOptionsModel.IncludeConfig = core.BoolPtr(true) + importOfferingVersionOptionsModel.IsVsi = core.BoolPtr(true) + importOfferingVersionOptionsModel.Repotype = core.StringPtr("testString") + importOfferingVersionOptionsModel.XAuthToken = core.StringPtr("testString") + importOfferingVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := catalogManagementService.ImportOfferingVersionWithContext(ctx, importOfferingVersionOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + catalogManagementService.DisableRetries() + result, response, operationErr := catalogManagementService.ImportOfferingVersion(importOfferingVersionOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = catalogManagementService.ImportOfferingVersionWithContext(ctx, importOfferingVersionOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(importOfferingVersionPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + Expect(req.Header["X-Auth-Token"]).ToNot(BeNil()) + Expect(req.Header["X-Auth-Token"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["zipurl"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["targetVersion"]).To(Equal([]string{"testString"})) + // TODO: Add check for includeConfig query parameter + // TODO: Add check for isVSI query parameter + Expect(req.URL.Query()["repotype"]).To(Equal([]string{"testString"})) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "url": "URL", "crn": "CRN", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "name": "Name", "offering_icon_url": "OfferingIconURL", "offering_docs_url": "OfferingDocsURL", "offering_support_url": "OfferingSupportURL", "tags": ["Tags"], "keywords": ["Keywords"], "rating": {"one_star_count": 12, "two_star_count": 12, "three_star_count": 14, "four_star_count": 13}, "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "short_description": "ShortDescription", "short_description_i18n": {"mapKey": "Inner"}, "long_description": "LongDescription", "long_description_i18n": {"mapKey": "Inner"}, "features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "kinds": [{"id": "ID", "format_kind": "FormatKind", "install_kind": "InstallKind", "target_kind": "TargetKind", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "additional_features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "versions": [{"id": "ID", "_rev": "Rev", "crn": "CRN", "version": "Version", "flavor": {"name": "Name", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "index": 5}, "sha": "Sha", "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "offering_id": "OfferingID", "catalog_id": "CatalogID", "kind_id": "KindID", "tags": ["Tags"], "repo_url": "RepoURL", "source_url": "SourceURL", "tgz_url": "TgzURL", "configuration": [{"key": "Key", "type": "Type", "default_value": "anyValue", "display_name": "DisplayName", "value_constraint": "ValueConstraint", "description": "Description", "required": true, "options": ["anyValue"], "hidden": true, "custom_config": {"type": "Type", "grouping": "Grouping", "original_grouping": "OriginalGrouping", "grouping_index": 13, "config_constraints": {"anyKey": "anyValue"}, "associations": {"parameters": [{"name": "Name", "optionsRefresh": true}]}}, "type_metadata": "TypeMetadata"}], "outputs": [{"key": "Key", "description": "Description"}], "iam_permissions": [{"service_name": "ServiceName", "role_crns": ["RoleCrns"], "resources": [{"name": "Name", "description": "Description", "role_crns": ["RoleCrns"]}]}], "metadata": {"mapKey": "anyValue"}, "validation": {"validated": "2019-01-01T12:00:00.000Z", "requested": "2019-01-01T12:00:00.000Z", "state": "State", "last_operation": "LastOperation", "target": {"mapKey": "anyValue"}, "message": "Message"}, "required_resources": [{"type": "mem", "value": "anyValue"}], "single_instance": true, "install": {"instructions": "Instructions", "instructions_i18n": {"mapKey": "Inner"}, "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}, "pre_install": [{"instructions": "Instructions", "instructions_i18n": {"mapKey": "Inner"}, "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}], "entitlement": {"provider_name": "ProviderName", "provider_id": "ProviderID", "product_id": "ProductID", "part_numbers": ["PartNumbers"], "image_repo_name": "ImageRepoName"}, "licenses": [{"id": "ID", "name": "Name", "type": "Type", "url": "URL", "description": "Description"}], "image_manifest_url": "ImageManifestURL", "deprecated": true, "package_version": "PackageVersion", "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "version_locator": "VersionLocator", "long_description": "LongDescription", "long_description_i18n": {"mapKey": "Inner"}, "whitelisted_accounts": ["WhitelistedAccounts"], "image_pull_key_name": "ImagePullKeyName", "deprecate_pending": {"deprecate_date": "2019-01-01T12:00:00.000Z", "deprecate_state": "DeprecateState", "description": "Description"}, "solution_info": {"architecture_diagrams": [{"diagram": {"url": "URL", "api_url": "APIURL", "url_proxy": {"url": "URL", "sha": "Sha"}, "caption": "Caption", "caption_i18n": {"mapKey": "Inner"}, "type": "Type", "thumbnail_url": "ThumbnailURL"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "cost_estimate": {"version": "Version", "currency": "Currency", "projects": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "pastBreakdown": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "breakdown": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "diff": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "summary": {"totalDetectedResources": 22, "totalSupportedResources": 23, "totalUnsupportedResources": 25, "totalUsageBasedResources": 24, "totalNoPriceResources": 21, "unsupportedResourceCounts": {"mapKey": 5}, "noPriceResourceCounts": {"mapKey": 5}}}], "summary": {"totalDetectedResources": 22, "totalSupportedResources": 23, "totalUnsupportedResources": 25, "totalUsageBasedResources": 24, "totalNoPriceResources": 21, "unsupportedResourceCounts": {"mapKey": 5}, "noPriceResourceCounts": {"mapKey": 5}}, "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z"}, "dependencies": [{"catalog_id": "CatalogID", "id": "ID", "name": "Name", "version": "Version", "flavors": ["Flavors"]}]}, "is_consumable": true}], "plans": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "additional_features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "deployments": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z"}]}]}], "pc_managed": false, "publish_approved": false, "share_with_all": true, "share_with_ibm": true, "share_enabled": true, "permit_request_ibm_public_publish": false, "ibm_publish_approved": true, "public_publish_approved": false, "public_original_crn": "PublicOriginalCRN", "publish_public_crn": "PublishPublicCRN", "portal_approval_record": "PortalApprovalRecord", "portal_ui_url": "PortalUIURL", "catalog_id": "CatalogID", "catalog_name": "CatalogName", "metadata": {"mapKey": "anyValue"}, "disclaimer": "Disclaimer", "hidden": true, "provider": "Provider", "provider_info": {"id": "ID", "name": "Name"}, "repo_info": {"token": "Token", "type": "Type"}, "image_pull_keys": [{"name": "Name", "value": "Value", "description": "Description"}], "support": {"url": "URL", "process": "Process", "process_i18n": {"mapKey": "Inner"}, "locations": ["Locations"], "support_details": [{"type": "Type", "contact": "Contact", "response_wait_time": {"value": 5, "type": "Type"}, "availability": {"times": [{"day": 3, "start_time": "StartTime", "end_time": "EndTime"}], "timezone": "Timezone", "always_available": false}}], "support_escalation": {"escalation_wait_time": {"value": 5, "type": "Type"}, "response_wait_time": {"value": 5, "type": "Type"}, "contact": "Contact"}, "support_type": "SupportType"}, "media": [{"url": "URL", "api_url": "APIURL", "url_proxy": {"url": "URL", "sha": "Sha"}, "caption": "Caption", "caption_i18n": {"mapKey": "Inner"}, "type": "Type", "thumbnail_url": "ThumbnailURL"}], "deprecate_pending": {"deprecate_date": "2019-01-01T12:00:00.000Z", "deprecate_state": "DeprecateState", "description": "Description"}, "product_kind": "ProductKind", "badges": [{"id": "ID", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}, "icon": "Icon", "authority": "Authority", "tag": "Tag", "learn_more_links": {"first_party": "FirstParty", "third_party": "ThirdParty"}, "constraints": [{"type": "Type", "rule": "anyValue"}]}]}`) + })) + }) + It(`Invoke ImportOfferingVersion successfully`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := catalogManagementService.ImportOfferingVersion(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the Flavor model + flavorModel := new(catalogmanagementv1.Flavor) + flavorModel.Name = core.StringPtr("testString") + flavorModel.Label = core.StringPtr("testString") + flavorModel.LabelI18n = make(map[string]string) + flavorModel.Index = core.Int64Ptr(int64(38)) + + // Construct an instance of the ImportOfferingBodyMetadataOperatingSystem model + importOfferingBodyMetadataOperatingSystemModel := new(catalogmanagementv1.ImportOfferingBodyMetadataOperatingSystem) + importOfferingBodyMetadataOperatingSystemModel.DedicatedHostOnly = core.BoolPtr(true) + importOfferingBodyMetadataOperatingSystemModel.Vendor = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.Name = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.Href = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.DisplayName = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.Family = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.Version = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.Architecture = core.StringPtr("testString") + + // Construct an instance of the ImportOfferingBodyMetadataFile model + importOfferingBodyMetadataFileModel := new(catalogmanagementv1.ImportOfferingBodyMetadataFile) + importOfferingBodyMetadataFileModel.Size = core.Int64Ptr(int64(38)) + + // Construct an instance of the ImportOfferingBodyMetadataImagesItem model + importOfferingBodyMetadataImagesItemModel := new(catalogmanagementv1.ImportOfferingBodyMetadataImagesItem) + importOfferingBodyMetadataImagesItemModel.ID = core.StringPtr("testString") + importOfferingBodyMetadataImagesItemModel.Name = core.StringPtr("testString") + importOfferingBodyMetadataImagesItemModel.Region = core.StringPtr("testString") + + // Construct an instance of the ImportOfferingBodyMetadata model + importOfferingBodyMetadataModel := new(catalogmanagementv1.ImportOfferingBodyMetadata) + importOfferingBodyMetadataModel.OperatingSystem = importOfferingBodyMetadataOperatingSystemModel + importOfferingBodyMetadataModel.File = importOfferingBodyMetadataFileModel + importOfferingBodyMetadataModel.MinimumProvisionedSize = core.Int64Ptr(int64(38)) + importOfferingBodyMetadataModel.Images = []catalogmanagementv1.ImportOfferingBodyMetadataImagesItem{*importOfferingBodyMetadataImagesItemModel} + + // Construct an instance of the ImportOfferingVersionOptions model + importOfferingVersionOptionsModel := new(catalogmanagementv1.ImportOfferingVersionOptions) + importOfferingVersionOptionsModel.CatalogIdentifier = core.StringPtr("testString") + importOfferingVersionOptionsModel.OfferingID = core.StringPtr("testString") + importOfferingVersionOptionsModel.Tags = []string{"testString"} + importOfferingVersionOptionsModel.Content = CreateMockByteArray("This is a mock byte array value.") + importOfferingVersionOptionsModel.Name = core.StringPtr("testString") + importOfferingVersionOptionsModel.Label = core.StringPtr("testString") + importOfferingVersionOptionsModel.InstallKind = core.StringPtr("testString") + importOfferingVersionOptionsModel.TargetKinds = []string{"testString"} + importOfferingVersionOptionsModel.FormatKind = core.StringPtr("testString") + importOfferingVersionOptionsModel.ProductKind = core.StringPtr("testString") + importOfferingVersionOptionsModel.Sha = core.StringPtr("testString") + importOfferingVersionOptionsModel.Version = core.StringPtr("testString") + importOfferingVersionOptionsModel.Flavor = flavorModel + importOfferingVersionOptionsModel.Metadata = importOfferingBodyMetadataModel + importOfferingVersionOptionsModel.WorkingDirectory = core.StringPtr("testString") + importOfferingVersionOptionsModel.Zipurl = core.StringPtr("testString") + importOfferingVersionOptionsModel.TargetVersion = core.StringPtr("testString") + importOfferingVersionOptionsModel.IncludeConfig = core.BoolPtr(true) + importOfferingVersionOptionsModel.IsVsi = core.BoolPtr(true) + importOfferingVersionOptionsModel.Repotype = core.StringPtr("testString") + importOfferingVersionOptionsModel.XAuthToken = core.StringPtr("testString") + importOfferingVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = catalogManagementService.ImportOfferingVersion(importOfferingVersionOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ImportOfferingVersion with error: Operation validation and request error`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Construct an instance of the Flavor model + flavorModel := new(catalogmanagementv1.Flavor) + flavorModel.Name = core.StringPtr("testString") + flavorModel.Label = core.StringPtr("testString") + flavorModel.LabelI18n = make(map[string]string) + flavorModel.Index = core.Int64Ptr(int64(38)) + + // Construct an instance of the ImportOfferingBodyMetadataOperatingSystem model + importOfferingBodyMetadataOperatingSystemModel := new(catalogmanagementv1.ImportOfferingBodyMetadataOperatingSystem) + importOfferingBodyMetadataOperatingSystemModel.DedicatedHostOnly = core.BoolPtr(true) + importOfferingBodyMetadataOperatingSystemModel.Vendor = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.Name = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.Href = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.DisplayName = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.Family = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.Version = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.Architecture = core.StringPtr("testString") + + // Construct an instance of the ImportOfferingBodyMetadataFile model + importOfferingBodyMetadataFileModel := new(catalogmanagementv1.ImportOfferingBodyMetadataFile) + importOfferingBodyMetadataFileModel.Size = core.Int64Ptr(int64(38)) + + // Construct an instance of the ImportOfferingBodyMetadataImagesItem model + importOfferingBodyMetadataImagesItemModel := new(catalogmanagementv1.ImportOfferingBodyMetadataImagesItem) + importOfferingBodyMetadataImagesItemModel.ID = core.StringPtr("testString") + importOfferingBodyMetadataImagesItemModel.Name = core.StringPtr("testString") + importOfferingBodyMetadataImagesItemModel.Region = core.StringPtr("testString") + + // Construct an instance of the ImportOfferingBodyMetadata model + importOfferingBodyMetadataModel := new(catalogmanagementv1.ImportOfferingBodyMetadata) + importOfferingBodyMetadataModel.OperatingSystem = importOfferingBodyMetadataOperatingSystemModel + importOfferingBodyMetadataModel.File = importOfferingBodyMetadataFileModel + importOfferingBodyMetadataModel.MinimumProvisionedSize = core.Int64Ptr(int64(38)) + importOfferingBodyMetadataModel.Images = []catalogmanagementv1.ImportOfferingBodyMetadataImagesItem{*importOfferingBodyMetadataImagesItemModel} + + // Construct an instance of the ImportOfferingVersionOptions model + importOfferingVersionOptionsModel := new(catalogmanagementv1.ImportOfferingVersionOptions) + importOfferingVersionOptionsModel.CatalogIdentifier = core.StringPtr("testString") + importOfferingVersionOptionsModel.OfferingID = core.StringPtr("testString") + importOfferingVersionOptionsModel.Tags = []string{"testString"} + importOfferingVersionOptionsModel.Content = CreateMockByteArray("This is a mock byte array value.") + importOfferingVersionOptionsModel.Name = core.StringPtr("testString") + importOfferingVersionOptionsModel.Label = core.StringPtr("testString") + importOfferingVersionOptionsModel.InstallKind = core.StringPtr("testString") + importOfferingVersionOptionsModel.TargetKinds = []string{"testString"} + importOfferingVersionOptionsModel.FormatKind = core.StringPtr("testString") + importOfferingVersionOptionsModel.ProductKind = core.StringPtr("testString") + importOfferingVersionOptionsModel.Sha = core.StringPtr("testString") + importOfferingVersionOptionsModel.Version = core.StringPtr("testString") + importOfferingVersionOptionsModel.Flavor = flavorModel + importOfferingVersionOptionsModel.Metadata = importOfferingBodyMetadataModel + importOfferingVersionOptionsModel.WorkingDirectory = core.StringPtr("testString") + importOfferingVersionOptionsModel.Zipurl = core.StringPtr("testString") + importOfferingVersionOptionsModel.TargetVersion = core.StringPtr("testString") + importOfferingVersionOptionsModel.IncludeConfig = core.BoolPtr(true) + importOfferingVersionOptionsModel.IsVsi = core.BoolPtr(true) + importOfferingVersionOptionsModel.Repotype = core.StringPtr("testString") + importOfferingVersionOptionsModel.XAuthToken = core.StringPtr("testString") + importOfferingVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := catalogManagementService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := catalogManagementService.ImportOfferingVersion(importOfferingVersionOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the ImportOfferingVersionOptions model with no property values + importOfferingVersionOptionsModelNew := new(catalogmanagementv1.ImportOfferingVersionOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = catalogManagementService.ImportOfferingVersion(importOfferingVersionOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(201) + })) + }) + It(`Invoke ImportOfferingVersion successfully`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Construct an instance of the Flavor model + flavorModel := new(catalogmanagementv1.Flavor) + flavorModel.Name = core.StringPtr("testString") + flavorModel.Label = core.StringPtr("testString") + flavorModel.LabelI18n = make(map[string]string) + flavorModel.Index = core.Int64Ptr(int64(38)) + + // Construct an instance of the ImportOfferingBodyMetadataOperatingSystem model + importOfferingBodyMetadataOperatingSystemModel := new(catalogmanagementv1.ImportOfferingBodyMetadataOperatingSystem) + importOfferingBodyMetadataOperatingSystemModel.DedicatedHostOnly = core.BoolPtr(true) + importOfferingBodyMetadataOperatingSystemModel.Vendor = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.Name = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.Href = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.DisplayName = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.Family = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.Version = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.Architecture = core.StringPtr("testString") + + // Construct an instance of the ImportOfferingBodyMetadataFile model + importOfferingBodyMetadataFileModel := new(catalogmanagementv1.ImportOfferingBodyMetadataFile) + importOfferingBodyMetadataFileModel.Size = core.Int64Ptr(int64(38)) + + // Construct an instance of the ImportOfferingBodyMetadataImagesItem model + importOfferingBodyMetadataImagesItemModel := new(catalogmanagementv1.ImportOfferingBodyMetadataImagesItem) + importOfferingBodyMetadataImagesItemModel.ID = core.StringPtr("testString") + importOfferingBodyMetadataImagesItemModel.Name = core.StringPtr("testString") + importOfferingBodyMetadataImagesItemModel.Region = core.StringPtr("testString") + + // Construct an instance of the ImportOfferingBodyMetadata model + importOfferingBodyMetadataModel := new(catalogmanagementv1.ImportOfferingBodyMetadata) + importOfferingBodyMetadataModel.OperatingSystem = importOfferingBodyMetadataOperatingSystemModel + importOfferingBodyMetadataModel.File = importOfferingBodyMetadataFileModel + importOfferingBodyMetadataModel.MinimumProvisionedSize = core.Int64Ptr(int64(38)) + importOfferingBodyMetadataModel.Images = []catalogmanagementv1.ImportOfferingBodyMetadataImagesItem{*importOfferingBodyMetadataImagesItemModel} + + // Construct an instance of the ImportOfferingVersionOptions model + importOfferingVersionOptionsModel := new(catalogmanagementv1.ImportOfferingVersionOptions) + importOfferingVersionOptionsModel.CatalogIdentifier = core.StringPtr("testString") + importOfferingVersionOptionsModel.OfferingID = core.StringPtr("testString") + importOfferingVersionOptionsModel.Tags = []string{"testString"} + importOfferingVersionOptionsModel.Content = CreateMockByteArray("This is a mock byte array value.") + importOfferingVersionOptionsModel.Name = core.StringPtr("testString") + importOfferingVersionOptionsModel.Label = core.StringPtr("testString") + importOfferingVersionOptionsModel.InstallKind = core.StringPtr("testString") + importOfferingVersionOptionsModel.TargetKinds = []string{"testString"} + importOfferingVersionOptionsModel.FormatKind = core.StringPtr("testString") + importOfferingVersionOptionsModel.ProductKind = core.StringPtr("testString") + importOfferingVersionOptionsModel.Sha = core.StringPtr("testString") + importOfferingVersionOptionsModel.Version = core.StringPtr("testString") + importOfferingVersionOptionsModel.Flavor = flavorModel + importOfferingVersionOptionsModel.Metadata = importOfferingBodyMetadataModel + importOfferingVersionOptionsModel.WorkingDirectory = core.StringPtr("testString") + importOfferingVersionOptionsModel.Zipurl = core.StringPtr("testString") + importOfferingVersionOptionsModel.TargetVersion = core.StringPtr("testString") + importOfferingVersionOptionsModel.IncludeConfig = core.BoolPtr(true) + importOfferingVersionOptionsModel.IsVsi = core.BoolPtr(true) + importOfferingVersionOptionsModel.Repotype = core.StringPtr("testString") + importOfferingVersionOptionsModel.XAuthToken = core.StringPtr("testString") + importOfferingVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := catalogManagementService.ImportOfferingVersion(importOfferingVersionOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ImportOffering(importOfferingOptions *ImportOfferingOptions) - Operation response error`, func() { + importOfferingPath := "/catalogs/testString/import/offerings" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(importOfferingPath)) + Expect(req.Method).To(Equal("POST")) + Expect(req.Header["X-Auth-Token"]).ToNot(BeNil()) + Expect(req.Header["X-Auth-Token"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["zipurl"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["offeringID"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["targetVersion"]).To(Equal([]string{"testString"})) + // TODO: Add check for includeConfig query parameter + // TODO: Add check for isVSI query parameter + Expect(req.URL.Query()["repotype"]).To(Equal([]string{"testString"})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(201) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke ImportOffering with error: Operation response processing error`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Construct an instance of the Flavor model + flavorModel := new(catalogmanagementv1.Flavor) + flavorModel.Name = core.StringPtr("testString") + flavorModel.Label = core.StringPtr("testString") + flavorModel.LabelI18n = make(map[string]string) + flavorModel.Index = core.Int64Ptr(int64(38)) + + // Construct an instance of the ImportOfferingBodyMetadataOperatingSystem model + importOfferingBodyMetadataOperatingSystemModel := new(catalogmanagementv1.ImportOfferingBodyMetadataOperatingSystem) + importOfferingBodyMetadataOperatingSystemModel.DedicatedHostOnly = core.BoolPtr(true) + importOfferingBodyMetadataOperatingSystemModel.Vendor = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.Name = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.Href = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.DisplayName = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.Family = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.Version = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.Architecture = core.StringPtr("testString") + + // Construct an instance of the ImportOfferingBodyMetadataFile model + importOfferingBodyMetadataFileModel := new(catalogmanagementv1.ImportOfferingBodyMetadataFile) + importOfferingBodyMetadataFileModel.Size = core.Int64Ptr(int64(38)) + + // Construct an instance of the ImportOfferingBodyMetadataImagesItem model + importOfferingBodyMetadataImagesItemModel := new(catalogmanagementv1.ImportOfferingBodyMetadataImagesItem) + importOfferingBodyMetadataImagesItemModel.ID = core.StringPtr("testString") + importOfferingBodyMetadataImagesItemModel.Name = core.StringPtr("testString") + importOfferingBodyMetadataImagesItemModel.Region = core.StringPtr("testString") + + // Construct an instance of the ImportOfferingBodyMetadata model + importOfferingBodyMetadataModel := new(catalogmanagementv1.ImportOfferingBodyMetadata) + importOfferingBodyMetadataModel.OperatingSystem = importOfferingBodyMetadataOperatingSystemModel + importOfferingBodyMetadataModel.File = importOfferingBodyMetadataFileModel + importOfferingBodyMetadataModel.MinimumProvisionedSize = core.Int64Ptr(int64(38)) + importOfferingBodyMetadataModel.Images = []catalogmanagementv1.ImportOfferingBodyMetadataImagesItem{*importOfferingBodyMetadataImagesItemModel} + + // Construct an instance of the ImportOfferingOptions model + importOfferingOptionsModel := new(catalogmanagementv1.ImportOfferingOptions) + importOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") + importOfferingOptionsModel.Tags = []string{"testString"} + importOfferingOptionsModel.Content = CreateMockByteArray("This is a mock byte array value.") + importOfferingOptionsModel.Name = core.StringPtr("testString") + importOfferingOptionsModel.Label = core.StringPtr("testString") + importOfferingOptionsModel.InstallKind = core.StringPtr("testString") + importOfferingOptionsModel.TargetKinds = []string{"testString"} + importOfferingOptionsModel.FormatKind = core.StringPtr("testString") + importOfferingOptionsModel.ProductKind = core.StringPtr("testString") + importOfferingOptionsModel.Sha = core.StringPtr("testString") + importOfferingOptionsModel.Version = core.StringPtr("testString") + importOfferingOptionsModel.Flavor = flavorModel + importOfferingOptionsModel.Metadata = importOfferingBodyMetadataModel + importOfferingOptionsModel.WorkingDirectory = core.StringPtr("testString") + importOfferingOptionsModel.Zipurl = core.StringPtr("testString") + importOfferingOptionsModel.OfferingID = core.StringPtr("testString") + importOfferingOptionsModel.TargetVersion = core.StringPtr("testString") + importOfferingOptionsModel.IncludeConfig = core.BoolPtr(true) + importOfferingOptionsModel.IsVsi = core.BoolPtr(true) + importOfferingOptionsModel.Repotype = core.StringPtr("testString") + importOfferingOptionsModel.XAuthToken = core.StringPtr("testString") + importOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := catalogManagementService.ImportOffering(importOfferingOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + catalogManagementService.EnableRetries(0, 0) + result, response, operationErr = catalogManagementService.ImportOffering(importOfferingOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ImportOffering(importOfferingOptions *ImportOfferingOptions)`, func() { + importOfferingPath := "/catalogs/testString/import/offerings" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(importOfferingPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + Expect(req.Header["X-Auth-Token"]).ToNot(BeNil()) + Expect(req.Header["X-Auth-Token"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["zipurl"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["offeringID"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["targetVersion"]).To(Equal([]string{"testString"})) + // TODO: Add check for includeConfig query parameter + // TODO: Add check for isVSI query parameter + Expect(req.URL.Query()["repotype"]).To(Equal([]string{"testString"})) + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "url": "URL", "crn": "CRN", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "name": "Name", "offering_icon_url": "OfferingIconURL", "offering_docs_url": "OfferingDocsURL", "offering_support_url": "OfferingSupportURL", "tags": ["Tags"], "keywords": ["Keywords"], "rating": {"one_star_count": 12, "two_star_count": 12, "three_star_count": 14, "four_star_count": 13}, "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "short_description": "ShortDescription", "short_description_i18n": {"mapKey": "Inner"}, "long_description": "LongDescription", "long_description_i18n": {"mapKey": "Inner"}, "features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "kinds": [{"id": "ID", "format_kind": "FormatKind", "install_kind": "InstallKind", "target_kind": "TargetKind", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "additional_features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "versions": [{"id": "ID", "_rev": "Rev", "crn": "CRN", "version": "Version", "flavor": {"name": "Name", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "index": 5}, "sha": "Sha", "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "offering_id": "OfferingID", "catalog_id": "CatalogID", "kind_id": "KindID", "tags": ["Tags"], "repo_url": "RepoURL", "source_url": "SourceURL", "tgz_url": "TgzURL", "configuration": [{"key": "Key", "type": "Type", "default_value": "anyValue", "display_name": "DisplayName", "value_constraint": "ValueConstraint", "description": "Description", "required": true, "options": ["anyValue"], "hidden": true, "custom_config": {"type": "Type", "grouping": "Grouping", "original_grouping": "OriginalGrouping", "grouping_index": 13, "config_constraints": {"anyKey": "anyValue"}, "associations": {"parameters": [{"name": "Name", "optionsRefresh": true}]}}, "type_metadata": "TypeMetadata"}], "outputs": [{"key": "Key", "description": "Description"}], "iam_permissions": [{"service_name": "ServiceName", "role_crns": ["RoleCrns"], "resources": [{"name": "Name", "description": "Description", "role_crns": ["RoleCrns"]}]}], "metadata": {"mapKey": "anyValue"}, "validation": {"validated": "2019-01-01T12:00:00.000Z", "requested": "2019-01-01T12:00:00.000Z", "state": "State", "last_operation": "LastOperation", "target": {"mapKey": "anyValue"}, "message": "Message"}, "required_resources": [{"type": "mem", "value": "anyValue"}], "single_instance": true, "install": {"instructions": "Instructions", "instructions_i18n": {"mapKey": "Inner"}, "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}, "pre_install": [{"instructions": "Instructions", "instructions_i18n": {"mapKey": "Inner"}, "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}], "entitlement": {"provider_name": "ProviderName", "provider_id": "ProviderID", "product_id": "ProductID", "part_numbers": ["PartNumbers"], "image_repo_name": "ImageRepoName"}, "licenses": [{"id": "ID", "name": "Name", "type": "Type", "url": "URL", "description": "Description"}], "image_manifest_url": "ImageManifestURL", "deprecated": true, "package_version": "PackageVersion", "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "version_locator": "VersionLocator", "long_description": "LongDescription", "long_description_i18n": {"mapKey": "Inner"}, "whitelisted_accounts": ["WhitelistedAccounts"], "image_pull_key_name": "ImagePullKeyName", "deprecate_pending": {"deprecate_date": "2019-01-01T12:00:00.000Z", "deprecate_state": "DeprecateState", "description": "Description"}, "solution_info": {"architecture_diagrams": [{"diagram": {"url": "URL", "api_url": "APIURL", "url_proxy": {"url": "URL", "sha": "Sha"}, "caption": "Caption", "caption_i18n": {"mapKey": "Inner"}, "type": "Type", "thumbnail_url": "ThumbnailURL"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "cost_estimate": {"version": "Version", "currency": "Currency", "projects": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "pastBreakdown": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "breakdown": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "diff": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "summary": {"totalDetectedResources": 22, "totalSupportedResources": 23, "totalUnsupportedResources": 25, "totalUsageBasedResources": 24, "totalNoPriceResources": 21, "unsupportedResourceCounts": {"mapKey": 5}, "noPriceResourceCounts": {"mapKey": 5}}}], "summary": {"totalDetectedResources": 22, "totalSupportedResources": 23, "totalUnsupportedResources": 25, "totalUsageBasedResources": 24, "totalNoPriceResources": 21, "unsupportedResourceCounts": {"mapKey": 5}, "noPriceResourceCounts": {"mapKey": 5}}, "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z"}, "dependencies": [{"catalog_id": "CatalogID", "id": "ID", "name": "Name", "version": "Version", "flavors": ["Flavors"]}]}, "is_consumable": true}], "plans": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "additional_features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "deployments": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z"}]}]}], "pc_managed": false, "publish_approved": false, "share_with_all": true, "share_with_ibm": true, "share_enabled": true, "permit_request_ibm_public_publish": false, "ibm_publish_approved": true, "public_publish_approved": false, "public_original_crn": "PublicOriginalCRN", "publish_public_crn": "PublishPublicCRN", "portal_approval_record": "PortalApprovalRecord", "portal_ui_url": "PortalUIURL", "catalog_id": "CatalogID", "catalog_name": "CatalogName", "metadata": {"mapKey": "anyValue"}, "disclaimer": "Disclaimer", "hidden": true, "provider": "Provider", "provider_info": {"id": "ID", "name": "Name"}, "repo_info": {"token": "Token", "type": "Type"}, "image_pull_keys": [{"name": "Name", "value": "Value", "description": "Description"}], "support": {"url": "URL", "process": "Process", "process_i18n": {"mapKey": "Inner"}, "locations": ["Locations"], "support_details": [{"type": "Type", "contact": "Contact", "response_wait_time": {"value": 5, "type": "Type"}, "availability": {"times": [{"day": 3, "start_time": "StartTime", "end_time": "EndTime"}], "timezone": "Timezone", "always_available": false}}], "support_escalation": {"escalation_wait_time": {"value": 5, "type": "Type"}, "response_wait_time": {"value": 5, "type": "Type"}, "contact": "Contact"}, "support_type": "SupportType"}, "media": [{"url": "URL", "api_url": "APIURL", "url_proxy": {"url": "URL", "sha": "Sha"}, "caption": "Caption", "caption_i18n": {"mapKey": "Inner"}, "type": "Type", "thumbnail_url": "ThumbnailURL"}], "deprecate_pending": {"deprecate_date": "2019-01-01T12:00:00.000Z", "deprecate_state": "DeprecateState", "description": "Description"}, "product_kind": "ProductKind", "badges": [{"id": "ID", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}, "icon": "Icon", "authority": "Authority", "tag": "Tag", "learn_more_links": {"first_party": "FirstParty", "third_party": "ThirdParty"}, "constraints": [{"type": "Type", "rule": "anyValue"}]}]}`) + })) + }) + It(`Invoke ImportOffering successfully with retries`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + catalogManagementService.EnableRetries(0, 0) + + // Construct an instance of the Flavor model + flavorModel := new(catalogmanagementv1.Flavor) + flavorModel.Name = core.StringPtr("testString") + flavorModel.Label = core.StringPtr("testString") + flavorModel.LabelI18n = make(map[string]string) + flavorModel.Index = core.Int64Ptr(int64(38)) + + // Construct an instance of the ImportOfferingBodyMetadataOperatingSystem model + importOfferingBodyMetadataOperatingSystemModel := new(catalogmanagementv1.ImportOfferingBodyMetadataOperatingSystem) + importOfferingBodyMetadataOperatingSystemModel.DedicatedHostOnly = core.BoolPtr(true) + importOfferingBodyMetadataOperatingSystemModel.Vendor = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.Name = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.Href = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.DisplayName = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.Family = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.Version = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.Architecture = core.StringPtr("testString") + + // Construct an instance of the ImportOfferingBodyMetadataFile model + importOfferingBodyMetadataFileModel := new(catalogmanagementv1.ImportOfferingBodyMetadataFile) + importOfferingBodyMetadataFileModel.Size = core.Int64Ptr(int64(38)) + + // Construct an instance of the ImportOfferingBodyMetadataImagesItem model + importOfferingBodyMetadataImagesItemModel := new(catalogmanagementv1.ImportOfferingBodyMetadataImagesItem) + importOfferingBodyMetadataImagesItemModel.ID = core.StringPtr("testString") + importOfferingBodyMetadataImagesItemModel.Name = core.StringPtr("testString") + importOfferingBodyMetadataImagesItemModel.Region = core.StringPtr("testString") + + // Construct an instance of the ImportOfferingBodyMetadata model + importOfferingBodyMetadataModel := new(catalogmanagementv1.ImportOfferingBodyMetadata) + importOfferingBodyMetadataModel.OperatingSystem = importOfferingBodyMetadataOperatingSystemModel + importOfferingBodyMetadataModel.File = importOfferingBodyMetadataFileModel + importOfferingBodyMetadataModel.MinimumProvisionedSize = core.Int64Ptr(int64(38)) + importOfferingBodyMetadataModel.Images = []catalogmanagementv1.ImportOfferingBodyMetadataImagesItem{*importOfferingBodyMetadataImagesItemModel} + + // Construct an instance of the ImportOfferingOptions model + importOfferingOptionsModel := new(catalogmanagementv1.ImportOfferingOptions) + importOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") + importOfferingOptionsModel.Tags = []string{"testString"} + importOfferingOptionsModel.Content = CreateMockByteArray("This is a mock byte array value.") + importOfferingOptionsModel.Name = core.StringPtr("testString") + importOfferingOptionsModel.Label = core.StringPtr("testString") + importOfferingOptionsModel.InstallKind = core.StringPtr("testString") + importOfferingOptionsModel.TargetKinds = []string{"testString"} + importOfferingOptionsModel.FormatKind = core.StringPtr("testString") + importOfferingOptionsModel.ProductKind = core.StringPtr("testString") + importOfferingOptionsModel.Sha = core.StringPtr("testString") + importOfferingOptionsModel.Version = core.StringPtr("testString") + importOfferingOptionsModel.Flavor = flavorModel + importOfferingOptionsModel.Metadata = importOfferingBodyMetadataModel + importOfferingOptionsModel.WorkingDirectory = core.StringPtr("testString") + importOfferingOptionsModel.Zipurl = core.StringPtr("testString") + importOfferingOptionsModel.OfferingID = core.StringPtr("testString") + importOfferingOptionsModel.TargetVersion = core.StringPtr("testString") + importOfferingOptionsModel.IncludeConfig = core.BoolPtr(true) + importOfferingOptionsModel.IsVsi = core.BoolPtr(true) + importOfferingOptionsModel.Repotype = core.StringPtr("testString") + importOfferingOptionsModel.XAuthToken = core.StringPtr("testString") + importOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := catalogManagementService.ImportOfferingWithContext(ctx, importOfferingOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + catalogManagementService.DisableRetries() + result, response, operationErr := catalogManagementService.ImportOffering(importOfferingOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = catalogManagementService.ImportOfferingWithContext(ctx, importOfferingOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(importOfferingPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + Expect(req.Header["X-Auth-Token"]).ToNot(BeNil()) + Expect(req.Header["X-Auth-Token"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["zipurl"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["offeringID"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["targetVersion"]).To(Equal([]string{"testString"})) + // TODO: Add check for includeConfig query parameter + // TODO: Add check for isVSI query parameter + Expect(req.URL.Query()["repotype"]).To(Equal([]string{"testString"})) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "url": "URL", "crn": "CRN", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "name": "Name", "offering_icon_url": "OfferingIconURL", "offering_docs_url": "OfferingDocsURL", "offering_support_url": "OfferingSupportURL", "tags": ["Tags"], "keywords": ["Keywords"], "rating": {"one_star_count": 12, "two_star_count": 12, "three_star_count": 14, "four_star_count": 13}, "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "short_description": "ShortDescription", "short_description_i18n": {"mapKey": "Inner"}, "long_description": "LongDescription", "long_description_i18n": {"mapKey": "Inner"}, "features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "kinds": [{"id": "ID", "format_kind": "FormatKind", "install_kind": "InstallKind", "target_kind": "TargetKind", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "additional_features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "versions": [{"id": "ID", "_rev": "Rev", "crn": "CRN", "version": "Version", "flavor": {"name": "Name", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "index": 5}, "sha": "Sha", "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "offering_id": "OfferingID", "catalog_id": "CatalogID", "kind_id": "KindID", "tags": ["Tags"], "repo_url": "RepoURL", "source_url": "SourceURL", "tgz_url": "TgzURL", "configuration": [{"key": "Key", "type": "Type", "default_value": "anyValue", "display_name": "DisplayName", "value_constraint": "ValueConstraint", "description": "Description", "required": true, "options": ["anyValue"], "hidden": true, "custom_config": {"type": "Type", "grouping": "Grouping", "original_grouping": "OriginalGrouping", "grouping_index": 13, "config_constraints": {"anyKey": "anyValue"}, "associations": {"parameters": [{"name": "Name", "optionsRefresh": true}]}}, "type_metadata": "TypeMetadata"}], "outputs": [{"key": "Key", "description": "Description"}], "iam_permissions": [{"service_name": "ServiceName", "role_crns": ["RoleCrns"], "resources": [{"name": "Name", "description": "Description", "role_crns": ["RoleCrns"]}]}], "metadata": {"mapKey": "anyValue"}, "validation": {"validated": "2019-01-01T12:00:00.000Z", "requested": "2019-01-01T12:00:00.000Z", "state": "State", "last_operation": "LastOperation", "target": {"mapKey": "anyValue"}, "message": "Message"}, "required_resources": [{"type": "mem", "value": "anyValue"}], "single_instance": true, "install": {"instructions": "Instructions", "instructions_i18n": {"mapKey": "Inner"}, "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}, "pre_install": [{"instructions": "Instructions", "instructions_i18n": {"mapKey": "Inner"}, "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}], "entitlement": {"provider_name": "ProviderName", "provider_id": "ProviderID", "product_id": "ProductID", "part_numbers": ["PartNumbers"], "image_repo_name": "ImageRepoName"}, "licenses": [{"id": "ID", "name": "Name", "type": "Type", "url": "URL", "description": "Description"}], "image_manifest_url": "ImageManifestURL", "deprecated": true, "package_version": "PackageVersion", "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "version_locator": "VersionLocator", "long_description": "LongDescription", "long_description_i18n": {"mapKey": "Inner"}, "whitelisted_accounts": ["WhitelistedAccounts"], "image_pull_key_name": "ImagePullKeyName", "deprecate_pending": {"deprecate_date": "2019-01-01T12:00:00.000Z", "deprecate_state": "DeprecateState", "description": "Description"}, "solution_info": {"architecture_diagrams": [{"diagram": {"url": "URL", "api_url": "APIURL", "url_proxy": {"url": "URL", "sha": "Sha"}, "caption": "Caption", "caption_i18n": {"mapKey": "Inner"}, "type": "Type", "thumbnail_url": "ThumbnailURL"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "cost_estimate": {"version": "Version", "currency": "Currency", "projects": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "pastBreakdown": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "breakdown": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "diff": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "summary": {"totalDetectedResources": 22, "totalSupportedResources": 23, "totalUnsupportedResources": 25, "totalUsageBasedResources": 24, "totalNoPriceResources": 21, "unsupportedResourceCounts": {"mapKey": 5}, "noPriceResourceCounts": {"mapKey": 5}}}], "summary": {"totalDetectedResources": 22, "totalSupportedResources": 23, "totalUnsupportedResources": 25, "totalUsageBasedResources": 24, "totalNoPriceResources": 21, "unsupportedResourceCounts": {"mapKey": 5}, "noPriceResourceCounts": {"mapKey": 5}}, "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z"}, "dependencies": [{"catalog_id": "CatalogID", "id": "ID", "name": "Name", "version": "Version", "flavors": ["Flavors"]}]}, "is_consumable": true}], "plans": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "additional_features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "deployments": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z"}]}]}], "pc_managed": false, "publish_approved": false, "share_with_all": true, "share_with_ibm": true, "share_enabled": true, "permit_request_ibm_public_publish": false, "ibm_publish_approved": true, "public_publish_approved": false, "public_original_crn": "PublicOriginalCRN", "publish_public_crn": "PublishPublicCRN", "portal_approval_record": "PortalApprovalRecord", "portal_ui_url": "PortalUIURL", "catalog_id": "CatalogID", "catalog_name": "CatalogName", "metadata": {"mapKey": "anyValue"}, "disclaimer": "Disclaimer", "hidden": true, "provider": "Provider", "provider_info": {"id": "ID", "name": "Name"}, "repo_info": {"token": "Token", "type": "Type"}, "image_pull_keys": [{"name": "Name", "value": "Value", "description": "Description"}], "support": {"url": "URL", "process": "Process", "process_i18n": {"mapKey": "Inner"}, "locations": ["Locations"], "support_details": [{"type": "Type", "contact": "Contact", "response_wait_time": {"value": 5, "type": "Type"}, "availability": {"times": [{"day": 3, "start_time": "StartTime", "end_time": "EndTime"}], "timezone": "Timezone", "always_available": false}}], "support_escalation": {"escalation_wait_time": {"value": 5, "type": "Type"}, "response_wait_time": {"value": 5, "type": "Type"}, "contact": "Contact"}, "support_type": "SupportType"}, "media": [{"url": "URL", "api_url": "APIURL", "url_proxy": {"url": "URL", "sha": "Sha"}, "caption": "Caption", "caption_i18n": {"mapKey": "Inner"}, "type": "Type", "thumbnail_url": "ThumbnailURL"}], "deprecate_pending": {"deprecate_date": "2019-01-01T12:00:00.000Z", "deprecate_state": "DeprecateState", "description": "Description"}, "product_kind": "ProductKind", "badges": [{"id": "ID", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}, "icon": "Icon", "authority": "Authority", "tag": "Tag", "learn_more_links": {"first_party": "FirstParty", "third_party": "ThirdParty"}, "constraints": [{"type": "Type", "rule": "anyValue"}]}]}`) + })) + }) + It(`Invoke ImportOffering successfully`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := catalogManagementService.ImportOffering(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the Flavor model + flavorModel := new(catalogmanagementv1.Flavor) + flavorModel.Name = core.StringPtr("testString") + flavorModel.Label = core.StringPtr("testString") + flavorModel.LabelI18n = make(map[string]string) + flavorModel.Index = core.Int64Ptr(int64(38)) + + // Construct an instance of the ImportOfferingBodyMetadataOperatingSystem model + importOfferingBodyMetadataOperatingSystemModel := new(catalogmanagementv1.ImportOfferingBodyMetadataOperatingSystem) + importOfferingBodyMetadataOperatingSystemModel.DedicatedHostOnly = core.BoolPtr(true) + importOfferingBodyMetadataOperatingSystemModel.Vendor = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.Name = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.Href = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.DisplayName = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.Family = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.Version = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.Architecture = core.StringPtr("testString") + + // Construct an instance of the ImportOfferingBodyMetadataFile model + importOfferingBodyMetadataFileModel := new(catalogmanagementv1.ImportOfferingBodyMetadataFile) + importOfferingBodyMetadataFileModel.Size = core.Int64Ptr(int64(38)) + + // Construct an instance of the ImportOfferingBodyMetadataImagesItem model + importOfferingBodyMetadataImagesItemModel := new(catalogmanagementv1.ImportOfferingBodyMetadataImagesItem) + importOfferingBodyMetadataImagesItemModel.ID = core.StringPtr("testString") + importOfferingBodyMetadataImagesItemModel.Name = core.StringPtr("testString") + importOfferingBodyMetadataImagesItemModel.Region = core.StringPtr("testString") + + // Construct an instance of the ImportOfferingBodyMetadata model + importOfferingBodyMetadataModel := new(catalogmanagementv1.ImportOfferingBodyMetadata) + importOfferingBodyMetadataModel.OperatingSystem = importOfferingBodyMetadataOperatingSystemModel + importOfferingBodyMetadataModel.File = importOfferingBodyMetadataFileModel + importOfferingBodyMetadataModel.MinimumProvisionedSize = core.Int64Ptr(int64(38)) + importOfferingBodyMetadataModel.Images = []catalogmanagementv1.ImportOfferingBodyMetadataImagesItem{*importOfferingBodyMetadataImagesItemModel} + + // Construct an instance of the ImportOfferingOptions model + importOfferingOptionsModel := new(catalogmanagementv1.ImportOfferingOptions) + importOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") + importOfferingOptionsModel.Tags = []string{"testString"} + importOfferingOptionsModel.Content = CreateMockByteArray("This is a mock byte array value.") + importOfferingOptionsModel.Name = core.StringPtr("testString") + importOfferingOptionsModel.Label = core.StringPtr("testString") + importOfferingOptionsModel.InstallKind = core.StringPtr("testString") + importOfferingOptionsModel.TargetKinds = []string{"testString"} + importOfferingOptionsModel.FormatKind = core.StringPtr("testString") + importOfferingOptionsModel.ProductKind = core.StringPtr("testString") + importOfferingOptionsModel.Sha = core.StringPtr("testString") + importOfferingOptionsModel.Version = core.StringPtr("testString") + importOfferingOptionsModel.Flavor = flavorModel + importOfferingOptionsModel.Metadata = importOfferingBodyMetadataModel + importOfferingOptionsModel.WorkingDirectory = core.StringPtr("testString") + importOfferingOptionsModel.Zipurl = core.StringPtr("testString") + importOfferingOptionsModel.OfferingID = core.StringPtr("testString") + importOfferingOptionsModel.TargetVersion = core.StringPtr("testString") + importOfferingOptionsModel.IncludeConfig = core.BoolPtr(true) + importOfferingOptionsModel.IsVsi = core.BoolPtr(true) + importOfferingOptionsModel.Repotype = core.StringPtr("testString") + importOfferingOptionsModel.XAuthToken = core.StringPtr("testString") + importOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = catalogManagementService.ImportOffering(importOfferingOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ImportOffering with error: Operation validation and request error`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Construct an instance of the Flavor model + flavorModel := new(catalogmanagementv1.Flavor) + flavorModel.Name = core.StringPtr("testString") + flavorModel.Label = core.StringPtr("testString") + flavorModel.LabelI18n = make(map[string]string) + flavorModel.Index = core.Int64Ptr(int64(38)) + + // Construct an instance of the ImportOfferingBodyMetadataOperatingSystem model + importOfferingBodyMetadataOperatingSystemModel := new(catalogmanagementv1.ImportOfferingBodyMetadataOperatingSystem) + importOfferingBodyMetadataOperatingSystemModel.DedicatedHostOnly = core.BoolPtr(true) + importOfferingBodyMetadataOperatingSystemModel.Vendor = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.Name = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.Href = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.DisplayName = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.Family = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.Version = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.Architecture = core.StringPtr("testString") + + // Construct an instance of the ImportOfferingBodyMetadataFile model + importOfferingBodyMetadataFileModel := new(catalogmanagementv1.ImportOfferingBodyMetadataFile) + importOfferingBodyMetadataFileModel.Size = core.Int64Ptr(int64(38)) + + // Construct an instance of the ImportOfferingBodyMetadataImagesItem model + importOfferingBodyMetadataImagesItemModel := new(catalogmanagementv1.ImportOfferingBodyMetadataImagesItem) + importOfferingBodyMetadataImagesItemModel.ID = core.StringPtr("testString") + importOfferingBodyMetadataImagesItemModel.Name = core.StringPtr("testString") + importOfferingBodyMetadataImagesItemModel.Region = core.StringPtr("testString") + + // Construct an instance of the ImportOfferingBodyMetadata model + importOfferingBodyMetadataModel := new(catalogmanagementv1.ImportOfferingBodyMetadata) + importOfferingBodyMetadataModel.OperatingSystem = importOfferingBodyMetadataOperatingSystemModel + importOfferingBodyMetadataModel.File = importOfferingBodyMetadataFileModel + importOfferingBodyMetadataModel.MinimumProvisionedSize = core.Int64Ptr(int64(38)) + importOfferingBodyMetadataModel.Images = []catalogmanagementv1.ImportOfferingBodyMetadataImagesItem{*importOfferingBodyMetadataImagesItemModel} + + // Construct an instance of the ImportOfferingOptions model + importOfferingOptionsModel := new(catalogmanagementv1.ImportOfferingOptions) + importOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") + importOfferingOptionsModel.Tags = []string{"testString"} + importOfferingOptionsModel.Content = CreateMockByteArray("This is a mock byte array value.") + importOfferingOptionsModel.Name = core.StringPtr("testString") + importOfferingOptionsModel.Label = core.StringPtr("testString") + importOfferingOptionsModel.InstallKind = core.StringPtr("testString") + importOfferingOptionsModel.TargetKinds = []string{"testString"} + importOfferingOptionsModel.FormatKind = core.StringPtr("testString") + importOfferingOptionsModel.ProductKind = core.StringPtr("testString") + importOfferingOptionsModel.Sha = core.StringPtr("testString") + importOfferingOptionsModel.Version = core.StringPtr("testString") + importOfferingOptionsModel.Flavor = flavorModel + importOfferingOptionsModel.Metadata = importOfferingBodyMetadataModel + importOfferingOptionsModel.WorkingDirectory = core.StringPtr("testString") + importOfferingOptionsModel.Zipurl = core.StringPtr("testString") + importOfferingOptionsModel.OfferingID = core.StringPtr("testString") + importOfferingOptionsModel.TargetVersion = core.StringPtr("testString") + importOfferingOptionsModel.IncludeConfig = core.BoolPtr(true) + importOfferingOptionsModel.IsVsi = core.BoolPtr(true) + importOfferingOptionsModel.Repotype = core.StringPtr("testString") + importOfferingOptionsModel.XAuthToken = core.StringPtr("testString") + importOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := catalogManagementService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := catalogManagementService.ImportOffering(importOfferingOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the ImportOfferingOptions model with no property values + importOfferingOptionsModelNew := new(catalogmanagementv1.ImportOfferingOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = catalogManagementService.ImportOffering(importOfferingOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(201) + })) + }) + It(`Invoke ImportOffering successfully`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Construct an instance of the Flavor model + flavorModel := new(catalogmanagementv1.Flavor) + flavorModel.Name = core.StringPtr("testString") + flavorModel.Label = core.StringPtr("testString") + flavorModel.LabelI18n = make(map[string]string) + flavorModel.Index = core.Int64Ptr(int64(38)) + + // Construct an instance of the ImportOfferingBodyMetadataOperatingSystem model + importOfferingBodyMetadataOperatingSystemModel := new(catalogmanagementv1.ImportOfferingBodyMetadataOperatingSystem) + importOfferingBodyMetadataOperatingSystemModel.DedicatedHostOnly = core.BoolPtr(true) + importOfferingBodyMetadataOperatingSystemModel.Vendor = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.Name = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.Href = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.DisplayName = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.Family = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.Version = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.Architecture = core.StringPtr("testString") + + // Construct an instance of the ImportOfferingBodyMetadataFile model + importOfferingBodyMetadataFileModel := new(catalogmanagementv1.ImportOfferingBodyMetadataFile) + importOfferingBodyMetadataFileModel.Size = core.Int64Ptr(int64(38)) + + // Construct an instance of the ImportOfferingBodyMetadataImagesItem model + importOfferingBodyMetadataImagesItemModel := new(catalogmanagementv1.ImportOfferingBodyMetadataImagesItem) + importOfferingBodyMetadataImagesItemModel.ID = core.StringPtr("testString") + importOfferingBodyMetadataImagesItemModel.Name = core.StringPtr("testString") + importOfferingBodyMetadataImagesItemModel.Region = core.StringPtr("testString") + + // Construct an instance of the ImportOfferingBodyMetadata model + importOfferingBodyMetadataModel := new(catalogmanagementv1.ImportOfferingBodyMetadata) + importOfferingBodyMetadataModel.OperatingSystem = importOfferingBodyMetadataOperatingSystemModel + importOfferingBodyMetadataModel.File = importOfferingBodyMetadataFileModel + importOfferingBodyMetadataModel.MinimumProvisionedSize = core.Int64Ptr(int64(38)) + importOfferingBodyMetadataModel.Images = []catalogmanagementv1.ImportOfferingBodyMetadataImagesItem{*importOfferingBodyMetadataImagesItemModel} + + // Construct an instance of the ImportOfferingOptions model + importOfferingOptionsModel := new(catalogmanagementv1.ImportOfferingOptions) + importOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") + importOfferingOptionsModel.Tags = []string{"testString"} + importOfferingOptionsModel.Content = CreateMockByteArray("This is a mock byte array value.") + importOfferingOptionsModel.Name = core.StringPtr("testString") + importOfferingOptionsModel.Label = core.StringPtr("testString") + importOfferingOptionsModel.InstallKind = core.StringPtr("testString") + importOfferingOptionsModel.TargetKinds = []string{"testString"} + importOfferingOptionsModel.FormatKind = core.StringPtr("testString") + importOfferingOptionsModel.ProductKind = core.StringPtr("testString") + importOfferingOptionsModel.Sha = core.StringPtr("testString") + importOfferingOptionsModel.Version = core.StringPtr("testString") + importOfferingOptionsModel.Flavor = flavorModel + importOfferingOptionsModel.Metadata = importOfferingBodyMetadataModel + importOfferingOptionsModel.WorkingDirectory = core.StringPtr("testString") + importOfferingOptionsModel.Zipurl = core.StringPtr("testString") + importOfferingOptionsModel.OfferingID = core.StringPtr("testString") + importOfferingOptionsModel.TargetVersion = core.StringPtr("testString") + importOfferingOptionsModel.IncludeConfig = core.BoolPtr(true) + importOfferingOptionsModel.IsVsi = core.BoolPtr(true) + importOfferingOptionsModel.Repotype = core.StringPtr("testString") + importOfferingOptionsModel.XAuthToken = core.StringPtr("testString") + importOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := catalogManagementService.ImportOffering(importOfferingOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ReloadOffering(reloadOfferingOptions *ReloadOfferingOptions) - Operation response error`, func() { + reloadOfferingPath := "/catalogs/testString/offerings/testString/reload" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(reloadOfferingPath)) + Expect(req.Method).To(Equal("PUT")) + Expect(req.URL.Query()["targetVersion"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["zipurl"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["repoType"]).To(Equal([]string{"testString"})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke ReloadOffering with error: Operation response processing error`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Construct an instance of the Flavor model + flavorModel := new(catalogmanagementv1.Flavor) + flavorModel.Name = core.StringPtr("testString") + flavorModel.Label = core.StringPtr("testString") + flavorModel.LabelI18n = make(map[string]string) + flavorModel.Index = core.Int64Ptr(int64(38)) + + // Construct an instance of the ReloadOfferingOptions model + reloadOfferingOptionsModel := new(catalogmanagementv1.ReloadOfferingOptions) + reloadOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") + reloadOfferingOptionsModel.OfferingID = core.StringPtr("testString") + reloadOfferingOptionsModel.TargetVersion = core.StringPtr("testString") + reloadOfferingOptionsModel.Tags = []string{"testString"} + reloadOfferingOptionsModel.Content = CreateMockByteArray("This is a mock byte array value.") + reloadOfferingOptionsModel.TargetKinds = []string{"testString"} + reloadOfferingOptionsModel.FormatKind = core.StringPtr("testString") + reloadOfferingOptionsModel.Flavor = flavorModel + reloadOfferingOptionsModel.WorkingDirectory = core.StringPtr("testString") + reloadOfferingOptionsModel.Zipurl = core.StringPtr("testString") + reloadOfferingOptionsModel.RepoType = core.StringPtr("testString") + reloadOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := catalogManagementService.ReloadOffering(reloadOfferingOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + catalogManagementService.EnableRetries(0, 0) + result, response, operationErr = catalogManagementService.ReloadOffering(reloadOfferingOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ReloadOffering(reloadOfferingOptions *ReloadOfferingOptions)`, func() { + reloadOfferingPath := "/catalogs/testString/offerings/testString/reload" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(reloadOfferingPath)) + Expect(req.Method).To(Equal("PUT")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + Expect(req.URL.Query()["targetVersion"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["zipurl"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["repoType"]).To(Equal([]string{"testString"})) + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "url": "URL", "crn": "CRN", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "name": "Name", "offering_icon_url": "OfferingIconURL", "offering_docs_url": "OfferingDocsURL", "offering_support_url": "OfferingSupportURL", "tags": ["Tags"], "keywords": ["Keywords"], "rating": {"one_star_count": 12, "two_star_count": 12, "three_star_count": 14, "four_star_count": 13}, "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "short_description": "ShortDescription", "short_description_i18n": {"mapKey": "Inner"}, "long_description": "LongDescription", "long_description_i18n": {"mapKey": "Inner"}, "features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "kinds": [{"id": "ID", "format_kind": "FormatKind", "install_kind": "InstallKind", "target_kind": "TargetKind", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "additional_features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "versions": [{"id": "ID", "_rev": "Rev", "crn": "CRN", "version": "Version", "flavor": {"name": "Name", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "index": 5}, "sha": "Sha", "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "offering_id": "OfferingID", "catalog_id": "CatalogID", "kind_id": "KindID", "tags": ["Tags"], "repo_url": "RepoURL", "source_url": "SourceURL", "tgz_url": "TgzURL", "configuration": [{"key": "Key", "type": "Type", "default_value": "anyValue", "display_name": "DisplayName", "value_constraint": "ValueConstraint", "description": "Description", "required": true, "options": ["anyValue"], "hidden": true, "custom_config": {"type": "Type", "grouping": "Grouping", "original_grouping": "OriginalGrouping", "grouping_index": 13, "config_constraints": {"anyKey": "anyValue"}, "associations": {"parameters": [{"name": "Name", "optionsRefresh": true}]}}, "type_metadata": "TypeMetadata"}], "outputs": [{"key": "Key", "description": "Description"}], "iam_permissions": [{"service_name": "ServiceName", "role_crns": ["RoleCrns"], "resources": [{"name": "Name", "description": "Description", "role_crns": ["RoleCrns"]}]}], "metadata": {"mapKey": "anyValue"}, "validation": {"validated": "2019-01-01T12:00:00.000Z", "requested": "2019-01-01T12:00:00.000Z", "state": "State", "last_operation": "LastOperation", "target": {"mapKey": "anyValue"}, "message": "Message"}, "required_resources": [{"type": "mem", "value": "anyValue"}], "single_instance": true, "install": {"instructions": "Instructions", "instructions_i18n": {"mapKey": "Inner"}, "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}, "pre_install": [{"instructions": "Instructions", "instructions_i18n": {"mapKey": "Inner"}, "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}], "entitlement": {"provider_name": "ProviderName", "provider_id": "ProviderID", "product_id": "ProductID", "part_numbers": ["PartNumbers"], "image_repo_name": "ImageRepoName"}, "licenses": [{"id": "ID", "name": "Name", "type": "Type", "url": "URL", "description": "Description"}], "image_manifest_url": "ImageManifestURL", "deprecated": true, "package_version": "PackageVersion", "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "version_locator": "VersionLocator", "long_description": "LongDescription", "long_description_i18n": {"mapKey": "Inner"}, "whitelisted_accounts": ["WhitelistedAccounts"], "image_pull_key_name": "ImagePullKeyName", "deprecate_pending": {"deprecate_date": "2019-01-01T12:00:00.000Z", "deprecate_state": "DeprecateState", "description": "Description"}, "solution_info": {"architecture_diagrams": [{"diagram": {"url": "URL", "api_url": "APIURL", "url_proxy": {"url": "URL", "sha": "Sha"}, "caption": "Caption", "caption_i18n": {"mapKey": "Inner"}, "type": "Type", "thumbnail_url": "ThumbnailURL"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "cost_estimate": {"version": "Version", "currency": "Currency", "projects": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "pastBreakdown": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "breakdown": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "diff": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "summary": {"totalDetectedResources": 22, "totalSupportedResources": 23, "totalUnsupportedResources": 25, "totalUsageBasedResources": 24, "totalNoPriceResources": 21, "unsupportedResourceCounts": {"mapKey": 5}, "noPriceResourceCounts": {"mapKey": 5}}}], "summary": {"totalDetectedResources": 22, "totalSupportedResources": 23, "totalUnsupportedResources": 25, "totalUsageBasedResources": 24, "totalNoPriceResources": 21, "unsupportedResourceCounts": {"mapKey": 5}, "noPriceResourceCounts": {"mapKey": 5}}, "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z"}, "dependencies": [{"catalog_id": "CatalogID", "id": "ID", "name": "Name", "version": "Version", "flavors": ["Flavors"]}]}, "is_consumable": true}], "plans": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "additional_features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "deployments": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z"}]}]}], "pc_managed": false, "publish_approved": false, "share_with_all": true, "share_with_ibm": true, "share_enabled": true, "permit_request_ibm_public_publish": false, "ibm_publish_approved": true, "public_publish_approved": false, "public_original_crn": "PublicOriginalCRN", "publish_public_crn": "PublishPublicCRN", "portal_approval_record": "PortalApprovalRecord", "portal_ui_url": "PortalUIURL", "catalog_id": "CatalogID", "catalog_name": "CatalogName", "metadata": {"mapKey": "anyValue"}, "disclaimer": "Disclaimer", "hidden": true, "provider": "Provider", "provider_info": {"id": "ID", "name": "Name"}, "repo_info": {"token": "Token", "type": "Type"}, "image_pull_keys": [{"name": "Name", "value": "Value", "description": "Description"}], "support": {"url": "URL", "process": "Process", "process_i18n": {"mapKey": "Inner"}, "locations": ["Locations"], "support_details": [{"type": "Type", "contact": "Contact", "response_wait_time": {"value": 5, "type": "Type"}, "availability": {"times": [{"day": 3, "start_time": "StartTime", "end_time": "EndTime"}], "timezone": "Timezone", "always_available": false}}], "support_escalation": {"escalation_wait_time": {"value": 5, "type": "Type"}, "response_wait_time": {"value": 5, "type": "Type"}, "contact": "Contact"}, "support_type": "SupportType"}, "media": [{"url": "URL", "api_url": "APIURL", "url_proxy": {"url": "URL", "sha": "Sha"}, "caption": "Caption", "caption_i18n": {"mapKey": "Inner"}, "type": "Type", "thumbnail_url": "ThumbnailURL"}], "deprecate_pending": {"deprecate_date": "2019-01-01T12:00:00.000Z", "deprecate_state": "DeprecateState", "description": "Description"}, "product_kind": "ProductKind", "badges": [{"id": "ID", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}, "icon": "Icon", "authority": "Authority", "tag": "Tag", "learn_more_links": {"first_party": "FirstParty", "third_party": "ThirdParty"}, "constraints": [{"type": "Type", "rule": "anyValue"}]}]}`) + })) + }) + It(`Invoke ReloadOffering successfully with retries`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + catalogManagementService.EnableRetries(0, 0) + + // Construct an instance of the Flavor model + flavorModel := new(catalogmanagementv1.Flavor) + flavorModel.Name = core.StringPtr("testString") + flavorModel.Label = core.StringPtr("testString") + flavorModel.LabelI18n = make(map[string]string) + flavorModel.Index = core.Int64Ptr(int64(38)) + + // Construct an instance of the ReloadOfferingOptions model + reloadOfferingOptionsModel := new(catalogmanagementv1.ReloadOfferingOptions) + reloadOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") + reloadOfferingOptionsModel.OfferingID = core.StringPtr("testString") + reloadOfferingOptionsModel.TargetVersion = core.StringPtr("testString") + reloadOfferingOptionsModel.Tags = []string{"testString"} + reloadOfferingOptionsModel.Content = CreateMockByteArray("This is a mock byte array value.") + reloadOfferingOptionsModel.TargetKinds = []string{"testString"} + reloadOfferingOptionsModel.FormatKind = core.StringPtr("testString") + reloadOfferingOptionsModel.Flavor = flavorModel + reloadOfferingOptionsModel.WorkingDirectory = core.StringPtr("testString") + reloadOfferingOptionsModel.Zipurl = core.StringPtr("testString") + reloadOfferingOptionsModel.RepoType = core.StringPtr("testString") + reloadOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := catalogManagementService.ReloadOfferingWithContext(ctx, reloadOfferingOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + catalogManagementService.DisableRetries() + result, response, operationErr := catalogManagementService.ReloadOffering(reloadOfferingOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = catalogManagementService.ReloadOfferingWithContext(ctx, reloadOfferingOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(reloadOfferingPath)) + Expect(req.Method).To(Equal("PUT")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + Expect(req.URL.Query()["targetVersion"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["zipurl"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["repoType"]).To(Equal([]string{"testString"})) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "url": "URL", "crn": "CRN", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "name": "Name", "offering_icon_url": "OfferingIconURL", "offering_docs_url": "OfferingDocsURL", "offering_support_url": "OfferingSupportURL", "tags": ["Tags"], "keywords": ["Keywords"], "rating": {"one_star_count": 12, "two_star_count": 12, "three_star_count": 14, "four_star_count": 13}, "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "short_description": "ShortDescription", "short_description_i18n": {"mapKey": "Inner"}, "long_description": "LongDescription", "long_description_i18n": {"mapKey": "Inner"}, "features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "kinds": [{"id": "ID", "format_kind": "FormatKind", "install_kind": "InstallKind", "target_kind": "TargetKind", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "additional_features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "versions": [{"id": "ID", "_rev": "Rev", "crn": "CRN", "version": "Version", "flavor": {"name": "Name", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "index": 5}, "sha": "Sha", "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "offering_id": "OfferingID", "catalog_id": "CatalogID", "kind_id": "KindID", "tags": ["Tags"], "repo_url": "RepoURL", "source_url": "SourceURL", "tgz_url": "TgzURL", "configuration": [{"key": "Key", "type": "Type", "default_value": "anyValue", "display_name": "DisplayName", "value_constraint": "ValueConstraint", "description": "Description", "required": true, "options": ["anyValue"], "hidden": true, "custom_config": {"type": "Type", "grouping": "Grouping", "original_grouping": "OriginalGrouping", "grouping_index": 13, "config_constraints": {"anyKey": "anyValue"}, "associations": {"parameters": [{"name": "Name", "optionsRefresh": true}]}}, "type_metadata": "TypeMetadata"}], "outputs": [{"key": "Key", "description": "Description"}], "iam_permissions": [{"service_name": "ServiceName", "role_crns": ["RoleCrns"], "resources": [{"name": "Name", "description": "Description", "role_crns": ["RoleCrns"]}]}], "metadata": {"mapKey": "anyValue"}, "validation": {"validated": "2019-01-01T12:00:00.000Z", "requested": "2019-01-01T12:00:00.000Z", "state": "State", "last_operation": "LastOperation", "target": {"mapKey": "anyValue"}, "message": "Message"}, "required_resources": [{"type": "mem", "value": "anyValue"}], "single_instance": true, "install": {"instructions": "Instructions", "instructions_i18n": {"mapKey": "Inner"}, "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}, "pre_install": [{"instructions": "Instructions", "instructions_i18n": {"mapKey": "Inner"}, "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}], "entitlement": {"provider_name": "ProviderName", "provider_id": "ProviderID", "product_id": "ProductID", "part_numbers": ["PartNumbers"], "image_repo_name": "ImageRepoName"}, "licenses": [{"id": "ID", "name": "Name", "type": "Type", "url": "URL", "description": "Description"}], "image_manifest_url": "ImageManifestURL", "deprecated": true, "package_version": "PackageVersion", "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "version_locator": "VersionLocator", "long_description": "LongDescription", "long_description_i18n": {"mapKey": "Inner"}, "whitelisted_accounts": ["WhitelistedAccounts"], "image_pull_key_name": "ImagePullKeyName", "deprecate_pending": {"deprecate_date": "2019-01-01T12:00:00.000Z", "deprecate_state": "DeprecateState", "description": "Description"}, "solution_info": {"architecture_diagrams": [{"diagram": {"url": "URL", "api_url": "APIURL", "url_proxy": {"url": "URL", "sha": "Sha"}, "caption": "Caption", "caption_i18n": {"mapKey": "Inner"}, "type": "Type", "thumbnail_url": "ThumbnailURL"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "cost_estimate": {"version": "Version", "currency": "Currency", "projects": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "pastBreakdown": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "breakdown": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "diff": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "summary": {"totalDetectedResources": 22, "totalSupportedResources": 23, "totalUnsupportedResources": 25, "totalUsageBasedResources": 24, "totalNoPriceResources": 21, "unsupportedResourceCounts": {"mapKey": 5}, "noPriceResourceCounts": {"mapKey": 5}}}], "summary": {"totalDetectedResources": 22, "totalSupportedResources": 23, "totalUnsupportedResources": 25, "totalUsageBasedResources": 24, "totalNoPriceResources": 21, "unsupportedResourceCounts": {"mapKey": 5}, "noPriceResourceCounts": {"mapKey": 5}}, "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z"}, "dependencies": [{"catalog_id": "CatalogID", "id": "ID", "name": "Name", "version": "Version", "flavors": ["Flavors"]}]}, "is_consumable": true}], "plans": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "additional_features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "deployments": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z"}]}]}], "pc_managed": false, "publish_approved": false, "share_with_all": true, "share_with_ibm": true, "share_enabled": true, "permit_request_ibm_public_publish": false, "ibm_publish_approved": true, "public_publish_approved": false, "public_original_crn": "PublicOriginalCRN", "publish_public_crn": "PublishPublicCRN", "portal_approval_record": "PortalApprovalRecord", "portal_ui_url": "PortalUIURL", "catalog_id": "CatalogID", "catalog_name": "CatalogName", "metadata": {"mapKey": "anyValue"}, "disclaimer": "Disclaimer", "hidden": true, "provider": "Provider", "provider_info": {"id": "ID", "name": "Name"}, "repo_info": {"token": "Token", "type": "Type"}, "image_pull_keys": [{"name": "Name", "value": "Value", "description": "Description"}], "support": {"url": "URL", "process": "Process", "process_i18n": {"mapKey": "Inner"}, "locations": ["Locations"], "support_details": [{"type": "Type", "contact": "Contact", "response_wait_time": {"value": 5, "type": "Type"}, "availability": {"times": [{"day": 3, "start_time": "StartTime", "end_time": "EndTime"}], "timezone": "Timezone", "always_available": false}}], "support_escalation": {"escalation_wait_time": {"value": 5, "type": "Type"}, "response_wait_time": {"value": 5, "type": "Type"}, "contact": "Contact"}, "support_type": "SupportType"}, "media": [{"url": "URL", "api_url": "APIURL", "url_proxy": {"url": "URL", "sha": "Sha"}, "caption": "Caption", "caption_i18n": {"mapKey": "Inner"}, "type": "Type", "thumbnail_url": "ThumbnailURL"}], "deprecate_pending": {"deprecate_date": "2019-01-01T12:00:00.000Z", "deprecate_state": "DeprecateState", "description": "Description"}, "product_kind": "ProductKind", "badges": [{"id": "ID", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}, "icon": "Icon", "authority": "Authority", "tag": "Tag", "learn_more_links": {"first_party": "FirstParty", "third_party": "ThirdParty"}, "constraints": [{"type": "Type", "rule": "anyValue"}]}]}`) + })) + }) + It(`Invoke ReloadOffering successfully`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := catalogManagementService.ReloadOffering(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the Flavor model + flavorModel := new(catalogmanagementv1.Flavor) + flavorModel.Name = core.StringPtr("testString") + flavorModel.Label = core.StringPtr("testString") + flavorModel.LabelI18n = make(map[string]string) + flavorModel.Index = core.Int64Ptr(int64(38)) + + // Construct an instance of the ReloadOfferingOptions model + reloadOfferingOptionsModel := new(catalogmanagementv1.ReloadOfferingOptions) + reloadOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") + reloadOfferingOptionsModel.OfferingID = core.StringPtr("testString") + reloadOfferingOptionsModel.TargetVersion = core.StringPtr("testString") + reloadOfferingOptionsModel.Tags = []string{"testString"} + reloadOfferingOptionsModel.Content = CreateMockByteArray("This is a mock byte array value.") + reloadOfferingOptionsModel.TargetKinds = []string{"testString"} + reloadOfferingOptionsModel.FormatKind = core.StringPtr("testString") + reloadOfferingOptionsModel.Flavor = flavorModel + reloadOfferingOptionsModel.WorkingDirectory = core.StringPtr("testString") + reloadOfferingOptionsModel.Zipurl = core.StringPtr("testString") + reloadOfferingOptionsModel.RepoType = core.StringPtr("testString") + reloadOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = catalogManagementService.ReloadOffering(reloadOfferingOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ReloadOffering with error: Operation validation and request error`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Construct an instance of the Flavor model + flavorModel := new(catalogmanagementv1.Flavor) + flavorModel.Name = core.StringPtr("testString") + flavorModel.Label = core.StringPtr("testString") + flavorModel.LabelI18n = make(map[string]string) + flavorModel.Index = core.Int64Ptr(int64(38)) + + // Construct an instance of the ReloadOfferingOptions model + reloadOfferingOptionsModel := new(catalogmanagementv1.ReloadOfferingOptions) + reloadOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") + reloadOfferingOptionsModel.OfferingID = core.StringPtr("testString") + reloadOfferingOptionsModel.TargetVersion = core.StringPtr("testString") + reloadOfferingOptionsModel.Tags = []string{"testString"} + reloadOfferingOptionsModel.Content = CreateMockByteArray("This is a mock byte array value.") + reloadOfferingOptionsModel.TargetKinds = []string{"testString"} + reloadOfferingOptionsModel.FormatKind = core.StringPtr("testString") + reloadOfferingOptionsModel.Flavor = flavorModel + reloadOfferingOptionsModel.WorkingDirectory = core.StringPtr("testString") + reloadOfferingOptionsModel.Zipurl = core.StringPtr("testString") + reloadOfferingOptionsModel.RepoType = core.StringPtr("testString") + reloadOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := catalogManagementService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := catalogManagementService.ReloadOffering(reloadOfferingOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the ReloadOfferingOptions model with no property values + reloadOfferingOptionsModelNew := new(catalogmanagementv1.ReloadOfferingOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = catalogManagementService.ReloadOffering(reloadOfferingOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke ReloadOffering successfully`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Construct an instance of the Flavor model + flavorModel := new(catalogmanagementv1.Flavor) + flavorModel.Name = core.StringPtr("testString") + flavorModel.Label = core.StringPtr("testString") + flavorModel.LabelI18n = make(map[string]string) + flavorModel.Index = core.Int64Ptr(int64(38)) + + // Construct an instance of the ReloadOfferingOptions model + reloadOfferingOptionsModel := new(catalogmanagementv1.ReloadOfferingOptions) + reloadOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") + reloadOfferingOptionsModel.OfferingID = core.StringPtr("testString") + reloadOfferingOptionsModel.TargetVersion = core.StringPtr("testString") + reloadOfferingOptionsModel.Tags = []string{"testString"} + reloadOfferingOptionsModel.Content = CreateMockByteArray("This is a mock byte array value.") + reloadOfferingOptionsModel.TargetKinds = []string{"testString"} + reloadOfferingOptionsModel.FormatKind = core.StringPtr("testString") + reloadOfferingOptionsModel.Flavor = flavorModel + reloadOfferingOptionsModel.WorkingDirectory = core.StringPtr("testString") + reloadOfferingOptionsModel.Zipurl = core.StringPtr("testString") + reloadOfferingOptionsModel.RepoType = core.StringPtr("testString") + reloadOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := catalogManagementService.ReloadOffering(reloadOfferingOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetOffering(getOfferingOptions *GetOfferingOptions) - Operation response error`, func() { + getOfferingPath := "/catalogs/testString/offerings/testString" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getOfferingPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["type"]).To(Equal([]string{"testString"})) + // TODO: Add check for digest query parameter + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke GetOffering with error: Operation response processing error`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Construct an instance of the GetOfferingOptions model + getOfferingOptionsModel := new(catalogmanagementv1.GetOfferingOptions) + getOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") + getOfferingOptionsModel.OfferingID = core.StringPtr("testString") + getOfferingOptionsModel.Type = core.StringPtr("testString") + getOfferingOptionsModel.Digest = core.BoolPtr(true) + getOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := catalogManagementService.GetOffering(getOfferingOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + catalogManagementService.EnableRetries(0, 0) + result, response, operationErr = catalogManagementService.GetOffering(getOfferingOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetOffering(getOfferingOptions *GetOfferingOptions)`, func() { + getOfferingPath := "/catalogs/testString/offerings/testString" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getOfferingPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["type"]).To(Equal([]string{"testString"})) + // TODO: Add check for digest query parameter + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "url": "URL", "crn": "CRN", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "name": "Name", "offering_icon_url": "OfferingIconURL", "offering_docs_url": "OfferingDocsURL", "offering_support_url": "OfferingSupportURL", "tags": ["Tags"], "keywords": ["Keywords"], "rating": {"one_star_count": 12, "two_star_count": 12, "three_star_count": 14, "four_star_count": 13}, "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "short_description": "ShortDescription", "short_description_i18n": {"mapKey": "Inner"}, "long_description": "LongDescription", "long_description_i18n": {"mapKey": "Inner"}, "features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "kinds": [{"id": "ID", "format_kind": "FormatKind", "install_kind": "InstallKind", "target_kind": "TargetKind", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "additional_features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "versions": [{"id": "ID", "_rev": "Rev", "crn": "CRN", "version": "Version", "flavor": {"name": "Name", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "index": 5}, "sha": "Sha", "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "offering_id": "OfferingID", "catalog_id": "CatalogID", "kind_id": "KindID", "tags": ["Tags"], "repo_url": "RepoURL", "source_url": "SourceURL", "tgz_url": "TgzURL", "configuration": [{"key": "Key", "type": "Type", "default_value": "anyValue", "display_name": "DisplayName", "value_constraint": "ValueConstraint", "description": "Description", "required": true, "options": ["anyValue"], "hidden": true, "custom_config": {"type": "Type", "grouping": "Grouping", "original_grouping": "OriginalGrouping", "grouping_index": 13, "config_constraints": {"anyKey": "anyValue"}, "associations": {"parameters": [{"name": "Name", "optionsRefresh": true}]}}, "type_metadata": "TypeMetadata"}], "outputs": [{"key": "Key", "description": "Description"}], "iam_permissions": [{"service_name": "ServiceName", "role_crns": ["RoleCrns"], "resources": [{"name": "Name", "description": "Description", "role_crns": ["RoleCrns"]}]}], "metadata": {"mapKey": "anyValue"}, "validation": {"validated": "2019-01-01T12:00:00.000Z", "requested": "2019-01-01T12:00:00.000Z", "state": "State", "last_operation": "LastOperation", "target": {"mapKey": "anyValue"}, "message": "Message"}, "required_resources": [{"type": "mem", "value": "anyValue"}], "single_instance": true, "install": {"instructions": "Instructions", "instructions_i18n": {"mapKey": "Inner"}, "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}, "pre_install": [{"instructions": "Instructions", "instructions_i18n": {"mapKey": "Inner"}, "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}], "entitlement": {"provider_name": "ProviderName", "provider_id": "ProviderID", "product_id": "ProductID", "part_numbers": ["PartNumbers"], "image_repo_name": "ImageRepoName"}, "licenses": [{"id": "ID", "name": "Name", "type": "Type", "url": "URL", "description": "Description"}], "image_manifest_url": "ImageManifestURL", "deprecated": true, "package_version": "PackageVersion", "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "version_locator": "VersionLocator", "long_description": "LongDescription", "long_description_i18n": {"mapKey": "Inner"}, "whitelisted_accounts": ["WhitelistedAccounts"], "image_pull_key_name": "ImagePullKeyName", "deprecate_pending": {"deprecate_date": "2019-01-01T12:00:00.000Z", "deprecate_state": "DeprecateState", "description": "Description"}, "solution_info": {"architecture_diagrams": [{"diagram": {"url": "URL", "api_url": "APIURL", "url_proxy": {"url": "URL", "sha": "Sha"}, "caption": "Caption", "caption_i18n": {"mapKey": "Inner"}, "type": "Type", "thumbnail_url": "ThumbnailURL"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "cost_estimate": {"version": "Version", "currency": "Currency", "projects": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "pastBreakdown": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "breakdown": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "diff": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "summary": {"totalDetectedResources": 22, "totalSupportedResources": 23, "totalUnsupportedResources": 25, "totalUsageBasedResources": 24, "totalNoPriceResources": 21, "unsupportedResourceCounts": {"mapKey": 5}, "noPriceResourceCounts": {"mapKey": 5}}}], "summary": {"totalDetectedResources": 22, "totalSupportedResources": 23, "totalUnsupportedResources": 25, "totalUsageBasedResources": 24, "totalNoPriceResources": 21, "unsupportedResourceCounts": {"mapKey": 5}, "noPriceResourceCounts": {"mapKey": 5}}, "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z"}, "dependencies": [{"catalog_id": "CatalogID", "id": "ID", "name": "Name", "version": "Version", "flavors": ["Flavors"]}]}, "is_consumable": true}], "plans": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "additional_features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "deployments": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z"}]}]}], "pc_managed": false, "publish_approved": false, "share_with_all": true, "share_with_ibm": true, "share_enabled": true, "permit_request_ibm_public_publish": false, "ibm_publish_approved": true, "public_publish_approved": false, "public_original_crn": "PublicOriginalCRN", "publish_public_crn": "PublishPublicCRN", "portal_approval_record": "PortalApprovalRecord", "portal_ui_url": "PortalUIURL", "catalog_id": "CatalogID", "catalog_name": "CatalogName", "metadata": {"mapKey": "anyValue"}, "disclaimer": "Disclaimer", "hidden": true, "provider": "Provider", "provider_info": {"id": "ID", "name": "Name"}, "repo_info": {"token": "Token", "type": "Type"}, "image_pull_keys": [{"name": "Name", "value": "Value", "description": "Description"}], "support": {"url": "URL", "process": "Process", "process_i18n": {"mapKey": "Inner"}, "locations": ["Locations"], "support_details": [{"type": "Type", "contact": "Contact", "response_wait_time": {"value": 5, "type": "Type"}, "availability": {"times": [{"day": 3, "start_time": "StartTime", "end_time": "EndTime"}], "timezone": "Timezone", "always_available": false}}], "support_escalation": {"escalation_wait_time": {"value": 5, "type": "Type"}, "response_wait_time": {"value": 5, "type": "Type"}, "contact": "Contact"}, "support_type": "SupportType"}, "media": [{"url": "URL", "api_url": "APIURL", "url_proxy": {"url": "URL", "sha": "Sha"}, "caption": "Caption", "caption_i18n": {"mapKey": "Inner"}, "type": "Type", "thumbnail_url": "ThumbnailURL"}], "deprecate_pending": {"deprecate_date": "2019-01-01T12:00:00.000Z", "deprecate_state": "DeprecateState", "description": "Description"}, "product_kind": "ProductKind", "badges": [{"id": "ID", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}, "icon": "Icon", "authority": "Authority", "tag": "Tag", "learn_more_links": {"first_party": "FirstParty", "third_party": "ThirdParty"}, "constraints": [{"type": "Type", "rule": "anyValue"}]}]}`) + })) + }) + It(`Invoke GetOffering successfully with retries`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + catalogManagementService.EnableRetries(0, 0) + + // Construct an instance of the GetOfferingOptions model + getOfferingOptionsModel := new(catalogmanagementv1.GetOfferingOptions) + getOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") + getOfferingOptionsModel.OfferingID = core.StringPtr("testString") + getOfferingOptionsModel.Type = core.StringPtr("testString") + getOfferingOptionsModel.Digest = core.BoolPtr(true) + getOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := catalogManagementService.GetOfferingWithContext(ctx, getOfferingOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + catalogManagementService.DisableRetries() + result, response, operationErr := catalogManagementService.GetOffering(getOfferingOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = catalogManagementService.GetOfferingWithContext(ctx, getOfferingOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getOfferingPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["type"]).To(Equal([]string{"testString"})) + // TODO: Add check for digest query parameter + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "url": "URL", "crn": "CRN", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "name": "Name", "offering_icon_url": "OfferingIconURL", "offering_docs_url": "OfferingDocsURL", "offering_support_url": "OfferingSupportURL", "tags": ["Tags"], "keywords": ["Keywords"], "rating": {"one_star_count": 12, "two_star_count": 12, "three_star_count": 14, "four_star_count": 13}, "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "short_description": "ShortDescription", "short_description_i18n": {"mapKey": "Inner"}, "long_description": "LongDescription", "long_description_i18n": {"mapKey": "Inner"}, "features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "kinds": [{"id": "ID", "format_kind": "FormatKind", "install_kind": "InstallKind", "target_kind": "TargetKind", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "additional_features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "versions": [{"id": "ID", "_rev": "Rev", "crn": "CRN", "version": "Version", "flavor": {"name": "Name", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "index": 5}, "sha": "Sha", "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "offering_id": "OfferingID", "catalog_id": "CatalogID", "kind_id": "KindID", "tags": ["Tags"], "repo_url": "RepoURL", "source_url": "SourceURL", "tgz_url": "TgzURL", "configuration": [{"key": "Key", "type": "Type", "default_value": "anyValue", "display_name": "DisplayName", "value_constraint": "ValueConstraint", "description": "Description", "required": true, "options": ["anyValue"], "hidden": true, "custom_config": {"type": "Type", "grouping": "Grouping", "original_grouping": "OriginalGrouping", "grouping_index": 13, "config_constraints": {"anyKey": "anyValue"}, "associations": {"parameters": [{"name": "Name", "optionsRefresh": true}]}}, "type_metadata": "TypeMetadata"}], "outputs": [{"key": "Key", "description": "Description"}], "iam_permissions": [{"service_name": "ServiceName", "role_crns": ["RoleCrns"], "resources": [{"name": "Name", "description": "Description", "role_crns": ["RoleCrns"]}]}], "metadata": {"mapKey": "anyValue"}, "validation": {"validated": "2019-01-01T12:00:00.000Z", "requested": "2019-01-01T12:00:00.000Z", "state": "State", "last_operation": "LastOperation", "target": {"mapKey": "anyValue"}, "message": "Message"}, "required_resources": [{"type": "mem", "value": "anyValue"}], "single_instance": true, "install": {"instructions": "Instructions", "instructions_i18n": {"mapKey": "Inner"}, "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}, "pre_install": [{"instructions": "Instructions", "instructions_i18n": {"mapKey": "Inner"}, "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}], "entitlement": {"provider_name": "ProviderName", "provider_id": "ProviderID", "product_id": "ProductID", "part_numbers": ["PartNumbers"], "image_repo_name": "ImageRepoName"}, "licenses": [{"id": "ID", "name": "Name", "type": "Type", "url": "URL", "description": "Description"}], "image_manifest_url": "ImageManifestURL", "deprecated": true, "package_version": "PackageVersion", "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "version_locator": "VersionLocator", "long_description": "LongDescription", "long_description_i18n": {"mapKey": "Inner"}, "whitelisted_accounts": ["WhitelistedAccounts"], "image_pull_key_name": "ImagePullKeyName", "deprecate_pending": {"deprecate_date": "2019-01-01T12:00:00.000Z", "deprecate_state": "DeprecateState", "description": "Description"}, "solution_info": {"architecture_diagrams": [{"diagram": {"url": "URL", "api_url": "APIURL", "url_proxy": {"url": "URL", "sha": "Sha"}, "caption": "Caption", "caption_i18n": {"mapKey": "Inner"}, "type": "Type", "thumbnail_url": "ThumbnailURL"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "cost_estimate": {"version": "Version", "currency": "Currency", "projects": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "pastBreakdown": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "breakdown": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "diff": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "summary": {"totalDetectedResources": 22, "totalSupportedResources": 23, "totalUnsupportedResources": 25, "totalUsageBasedResources": 24, "totalNoPriceResources": 21, "unsupportedResourceCounts": {"mapKey": 5}, "noPriceResourceCounts": {"mapKey": 5}}}], "summary": {"totalDetectedResources": 22, "totalSupportedResources": 23, "totalUnsupportedResources": 25, "totalUsageBasedResources": 24, "totalNoPriceResources": 21, "unsupportedResourceCounts": {"mapKey": 5}, "noPriceResourceCounts": {"mapKey": 5}}, "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z"}, "dependencies": [{"catalog_id": "CatalogID", "id": "ID", "name": "Name", "version": "Version", "flavors": ["Flavors"]}]}, "is_consumable": true}], "plans": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "additional_features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "deployments": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z"}]}]}], "pc_managed": false, "publish_approved": false, "share_with_all": true, "share_with_ibm": true, "share_enabled": true, "permit_request_ibm_public_publish": false, "ibm_publish_approved": true, "public_publish_approved": false, "public_original_crn": "PublicOriginalCRN", "publish_public_crn": "PublishPublicCRN", "portal_approval_record": "PortalApprovalRecord", "portal_ui_url": "PortalUIURL", "catalog_id": "CatalogID", "catalog_name": "CatalogName", "metadata": {"mapKey": "anyValue"}, "disclaimer": "Disclaimer", "hidden": true, "provider": "Provider", "provider_info": {"id": "ID", "name": "Name"}, "repo_info": {"token": "Token", "type": "Type"}, "image_pull_keys": [{"name": "Name", "value": "Value", "description": "Description"}], "support": {"url": "URL", "process": "Process", "process_i18n": {"mapKey": "Inner"}, "locations": ["Locations"], "support_details": [{"type": "Type", "contact": "Contact", "response_wait_time": {"value": 5, "type": "Type"}, "availability": {"times": [{"day": 3, "start_time": "StartTime", "end_time": "EndTime"}], "timezone": "Timezone", "always_available": false}}], "support_escalation": {"escalation_wait_time": {"value": 5, "type": "Type"}, "response_wait_time": {"value": 5, "type": "Type"}, "contact": "Contact"}, "support_type": "SupportType"}, "media": [{"url": "URL", "api_url": "APIURL", "url_proxy": {"url": "URL", "sha": "Sha"}, "caption": "Caption", "caption_i18n": {"mapKey": "Inner"}, "type": "Type", "thumbnail_url": "ThumbnailURL"}], "deprecate_pending": {"deprecate_date": "2019-01-01T12:00:00.000Z", "deprecate_state": "DeprecateState", "description": "Description"}, "product_kind": "ProductKind", "badges": [{"id": "ID", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}, "icon": "Icon", "authority": "Authority", "tag": "Tag", "learn_more_links": {"first_party": "FirstParty", "third_party": "ThirdParty"}, "constraints": [{"type": "Type", "rule": "anyValue"}]}]}`) + })) + }) + It(`Invoke GetOffering successfully`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := catalogManagementService.GetOffering(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetOfferingOptions model + getOfferingOptionsModel := new(catalogmanagementv1.GetOfferingOptions) + getOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") + getOfferingOptionsModel.OfferingID = core.StringPtr("testString") + getOfferingOptionsModel.Type = core.StringPtr("testString") + getOfferingOptionsModel.Digest = core.BoolPtr(true) + getOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = catalogManagementService.GetOffering(getOfferingOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetOffering with error: Operation validation and request error`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Construct an instance of the GetOfferingOptions model + getOfferingOptionsModel := new(catalogmanagementv1.GetOfferingOptions) + getOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") + getOfferingOptionsModel.OfferingID = core.StringPtr("testString") + getOfferingOptionsModel.Type = core.StringPtr("testString") + getOfferingOptionsModel.Digest = core.BoolPtr(true) + getOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := catalogManagementService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := catalogManagementService.GetOffering(getOfferingOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the GetOfferingOptions model with no property values + getOfferingOptionsModelNew := new(catalogmanagementv1.GetOfferingOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = catalogManagementService.GetOffering(getOfferingOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke GetOffering successfully`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Construct an instance of the GetOfferingOptions model + getOfferingOptionsModel := new(catalogmanagementv1.GetOfferingOptions) + getOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") + getOfferingOptionsModel.OfferingID = core.StringPtr("testString") + getOfferingOptionsModel.Type = core.StringPtr("testString") + getOfferingOptionsModel.Digest = core.BoolPtr(true) + getOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := catalogManagementService.GetOffering(getOfferingOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ReplaceOffering(replaceOfferingOptions *ReplaceOfferingOptions) - Operation response error`, func() { + replaceOfferingPath := "/catalogs/testString/offerings/testString" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(replaceOfferingPath)) + Expect(req.Method).To(Equal("PUT")) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke ReplaceOffering with error: Operation response processing error`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Construct an instance of the Rating model + ratingModel := new(catalogmanagementv1.Rating) + ratingModel.OneStarCount = core.Int64Ptr(int64(38)) + ratingModel.TwoStarCount = core.Int64Ptr(int64(38)) + ratingModel.ThreeStarCount = core.Int64Ptr(int64(38)) + ratingModel.FourStarCount = core.Int64Ptr(int64(38)) + + // Construct an instance of the Feature model + featureModel := new(catalogmanagementv1.Feature) + featureModel.Title = core.StringPtr("testString") + featureModel.TitleI18n = make(map[string]string) + featureModel.Description = core.StringPtr("testString") + featureModel.DescriptionI18n = make(map[string]string) + + // Construct an instance of the Flavor model + flavorModel := new(catalogmanagementv1.Flavor) + flavorModel.Name = core.StringPtr("testString") + flavorModel.Label = core.StringPtr("testString") + flavorModel.LabelI18n = make(map[string]string) + flavorModel.Index = core.Int64Ptr(int64(38)) + + // Construct an instance of the RenderTypeAssociationsParametersItem model + renderTypeAssociationsParametersItemModel := new(catalogmanagementv1.RenderTypeAssociationsParametersItem) + renderTypeAssociationsParametersItemModel.Name = core.StringPtr("testString") + renderTypeAssociationsParametersItemModel.OptionsRefresh = core.BoolPtr(true) + + // Construct an instance of the RenderTypeAssociations model + renderTypeAssociationsModel := new(catalogmanagementv1.RenderTypeAssociations) + renderTypeAssociationsModel.Parameters = []catalogmanagementv1.RenderTypeAssociationsParametersItem{*renderTypeAssociationsParametersItemModel} + + // Construct an instance of the RenderType model + renderTypeModel := new(catalogmanagementv1.RenderType) + renderTypeModel.Type = core.StringPtr("testString") + renderTypeModel.Grouping = core.StringPtr("testString") + renderTypeModel.OriginalGrouping = core.StringPtr("testString") + renderTypeModel.GroupingIndex = core.Int64Ptr(int64(38)) + renderTypeModel.ConfigConstraints = map[string]interface{}{"anyKey": "anyValue"} + renderTypeModel.Associations = renderTypeAssociationsModel + + // Construct an instance of the Configuration model + configurationModel := new(catalogmanagementv1.Configuration) + configurationModel.Key = core.StringPtr("testString") + configurationModel.Type = core.StringPtr("testString") + configurationModel.DefaultValue = core.StringPtr("testString") + configurationModel.DisplayName = core.StringPtr("testString") + configurationModel.ValueConstraint = core.StringPtr("testString") + configurationModel.Description = core.StringPtr("testString") + configurationModel.Required = core.BoolPtr(true) + configurationModel.Options = []interface{}{"testString"} + configurationModel.Hidden = core.BoolPtr(true) + configurationModel.CustomConfig = renderTypeModel + configurationModel.TypeMetadata = core.StringPtr("testString") + + // Construct an instance of the Output model + outputModel := new(catalogmanagementv1.Output) + outputModel.Key = core.StringPtr("testString") + outputModel.Description = core.StringPtr("testString") + + // Construct an instance of the IamResource model + iamResourceModel := new(catalogmanagementv1.IamResource) + iamResourceModel.Name = core.StringPtr("testString") + iamResourceModel.Description = core.StringPtr("testString") + iamResourceModel.RoleCrns = []string{"testString"} + + // Construct an instance of the IamPermission model + iamPermissionModel := new(catalogmanagementv1.IamPermission) + iamPermissionModel.ServiceName = core.StringPtr("testString") + iamPermissionModel.RoleCrns = []string{"testString"} + iamPermissionModel.Resources = []catalogmanagementv1.IamResource{*iamResourceModel} + + // Construct an instance of the Validation model + validationModel := new(catalogmanagementv1.Validation) + validationModel.Validated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + validationModel.Requested = CreateMockDateTime("2019-01-01T12:00:00.000Z") + validationModel.State = core.StringPtr("testString") + validationModel.LastOperation = core.StringPtr("testString") + validationModel.Target = make(map[string]interface{}) + validationModel.Message = core.StringPtr("testString") + + // Construct an instance of the Resource model + resourceModel := new(catalogmanagementv1.Resource) + resourceModel.Type = core.StringPtr("mem") + resourceModel.Value = core.StringPtr("testString") + + // Construct an instance of the Script model + scriptModel := new(catalogmanagementv1.Script) + scriptModel.Instructions = core.StringPtr("testString") + scriptModel.InstructionsI18n = make(map[string]string) + scriptModel.Script = core.StringPtr("testString") + scriptModel.ScriptPermission = core.StringPtr("testString") + scriptModel.DeleteScript = core.StringPtr("testString") + scriptModel.Scope = core.StringPtr("testString") + + // Construct an instance of the VersionEntitlement model + versionEntitlementModel := new(catalogmanagementv1.VersionEntitlement) + versionEntitlementModel.ProviderName = core.StringPtr("testString") + versionEntitlementModel.ProviderID = core.StringPtr("testString") + versionEntitlementModel.ProductID = core.StringPtr("testString") + versionEntitlementModel.PartNumbers = []string{"testString"} + versionEntitlementModel.ImageRepoName = core.StringPtr("testString") + + // Construct an instance of the License model + licenseModel := new(catalogmanagementv1.License) + licenseModel.ID = core.StringPtr("testString") + licenseModel.Name = core.StringPtr("testString") + licenseModel.Type = core.StringPtr("testString") + licenseModel.URL = core.StringPtr("testString") + licenseModel.Description = core.StringPtr("testString") + + // Construct an instance of the State model + stateModel := new(catalogmanagementv1.State) + stateModel.Current = core.StringPtr("testString") + stateModel.CurrentEntered = CreateMockDateTime("2019-01-01T12:00:00.000Z") + stateModel.Pending = core.StringPtr("testString") + stateModel.PendingRequested = CreateMockDateTime("2019-01-01T12:00:00.000Z") + stateModel.Previous = core.StringPtr("testString") + + // Construct an instance of the DeprecatePending model + deprecatePendingModel := new(catalogmanagementv1.DeprecatePending) + deprecatePendingModel.DeprecateDate = CreateMockDateTime("2019-01-01T12:00:00.000Z") + deprecatePendingModel.DeprecateState = core.StringPtr("testString") + deprecatePendingModel.Description = core.StringPtr("testString") + + // Construct an instance of the URLProxy model + urlProxyModel := new(catalogmanagementv1.URLProxy) + urlProxyModel.URL = core.StringPtr("testString") + urlProxyModel.Sha = core.StringPtr("testString") + + // Construct an instance of the MediaItem model + mediaItemModel := new(catalogmanagementv1.MediaItem) + mediaItemModel.URL = core.StringPtr("testString") + mediaItemModel.APIURL = core.StringPtr("testString") + mediaItemModel.URLProxy = urlProxyModel + mediaItemModel.Caption = core.StringPtr("testString") + mediaItemModel.CaptionI18n = make(map[string]string) + mediaItemModel.Type = core.StringPtr("testString") + mediaItemModel.ThumbnailURL = core.StringPtr("testString") + + // Construct an instance of the ArchitectureDiagram model + architectureDiagramModel := new(catalogmanagementv1.ArchitectureDiagram) + architectureDiagramModel.Diagram = mediaItemModel + architectureDiagramModel.Description = core.StringPtr("testString") + architectureDiagramModel.DescriptionI18n = make(map[string]string) + + // Construct an instance of the CostComponent model + costComponentModel := new(catalogmanagementv1.CostComponent) + costComponentModel.Name = core.StringPtr("testString") + costComponentModel.Unit = core.StringPtr("testString") + costComponentModel.HourlyQuantity = core.StringPtr("testString") + costComponentModel.MonthlyQuantity = core.StringPtr("testString") + costComponentModel.Price = core.StringPtr("testString") + costComponentModel.HourlyCost = core.StringPtr("testString") + costComponentModel.MonthlyCost = core.StringPtr("testString") + + // Construct an instance of the CostResource model + costResourceModel := new(catalogmanagementv1.CostResource) + costResourceModel.Name = core.StringPtr("testString") + costResourceModel.Metadata = make(map[string]interface{}) + costResourceModel.HourlyCost = core.StringPtr("testString") + costResourceModel.MonthlyCost = core.StringPtr("testString") + costResourceModel.CostComponents = []catalogmanagementv1.CostComponent{*costComponentModel} + + // Construct an instance of the CostBreakdown model + costBreakdownModel := new(catalogmanagementv1.CostBreakdown) + costBreakdownModel.TotalHourlyCost = core.StringPtr("testString") + costBreakdownModel.TotalMonthlyCOst = core.StringPtr("testString") + costBreakdownModel.Resources = []catalogmanagementv1.CostResource{*costResourceModel} + + // Construct an instance of the CostSummary model + costSummaryModel := new(catalogmanagementv1.CostSummary) + costSummaryModel.TotalDetectedResources = core.Int64Ptr(int64(38)) + costSummaryModel.TotalSupportedResources = core.Int64Ptr(int64(38)) + costSummaryModel.TotalUnsupportedResources = core.Int64Ptr(int64(38)) + costSummaryModel.TotalUsageBasedResources = core.Int64Ptr(int64(38)) + costSummaryModel.TotalNoPriceResources = core.Int64Ptr(int64(38)) + costSummaryModel.UnsupportedResourceCounts = make(map[string]int64) + costSummaryModel.NoPriceResourceCounts = make(map[string]int64) + + // Construct an instance of the Project model + projectModel := new(catalogmanagementv1.Project) + projectModel.Name = core.StringPtr("testString") + projectModel.Metadata = make(map[string]interface{}) + projectModel.PastBreakdown = costBreakdownModel + projectModel.Breakdown = costBreakdownModel + projectModel.Diff = costBreakdownModel + projectModel.Summary = costSummaryModel + + // Construct an instance of the CostEstimate model + costEstimateModel := new(catalogmanagementv1.CostEstimate) + costEstimateModel.Version = core.StringPtr("testString") + costEstimateModel.Currency = core.StringPtr("testString") + costEstimateModel.Projects = []catalogmanagementv1.Project{*projectModel} + costEstimateModel.Summary = costSummaryModel + costEstimateModel.TotalHourlyCost = core.StringPtr("testString") + costEstimateModel.TotalMonthlyCost = core.StringPtr("testString") + costEstimateModel.PastTotalHourlyCost = core.StringPtr("testString") + costEstimateModel.PastTotalMonthlyCost = core.StringPtr("testString") + costEstimateModel.DiffTotalHourlyCost = core.StringPtr("testString") + costEstimateModel.DiffTotalMonthlyCost = core.StringPtr("testString") + costEstimateModel.TimeGenerated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + + // Construct an instance of the Dependency model + dependencyModel := new(catalogmanagementv1.Dependency) + dependencyModel.CatalogID = core.StringPtr("testString") + dependencyModel.ID = core.StringPtr("testString") + dependencyModel.Name = core.StringPtr("testString") + dependencyModel.Version = core.StringPtr("testString") + dependencyModel.Flavors = []string{"testString"} + + // Construct an instance of the SolutionInfo model + solutionInfoModel := new(catalogmanagementv1.SolutionInfo) + solutionInfoModel.ArchitectureDiagrams = []catalogmanagementv1.ArchitectureDiagram{*architectureDiagramModel} + solutionInfoModel.Features = []catalogmanagementv1.Feature{*featureModel} + solutionInfoModel.CostEstimate = costEstimateModel + solutionInfoModel.Dependencies = []catalogmanagementv1.Dependency{*dependencyModel} + + // Construct an instance of the Version model + versionModel := new(catalogmanagementv1.Version) + versionModel.ID = core.StringPtr("testString") + versionModel.Rev = core.StringPtr("testString") + versionModel.CRN = core.StringPtr("testString") + versionModel.Version = core.StringPtr("testString") + versionModel.Flavor = flavorModel + versionModel.Sha = core.StringPtr("testString") + versionModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + versionModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + versionModel.OfferingID = core.StringPtr("testString") + versionModel.CatalogID = core.StringPtr("testString") + versionModel.KindID = core.StringPtr("testString") + versionModel.Tags = []string{"testString"} + versionModel.RepoURL = core.StringPtr("testString") + versionModel.SourceURL = core.StringPtr("testString") + versionModel.TgzURL = core.StringPtr("testString") + versionModel.Configuration = []catalogmanagementv1.Configuration{*configurationModel} + versionModel.Outputs = []catalogmanagementv1.Output{*outputModel} + versionModel.IamPermissions = []catalogmanagementv1.IamPermission{*iamPermissionModel} + versionModel.Metadata = make(map[string]interface{}) + versionModel.Validation = validationModel + versionModel.RequiredResources = []catalogmanagementv1.Resource{*resourceModel} + versionModel.SingleInstance = core.BoolPtr(true) + versionModel.Install = scriptModel + versionModel.PreInstall = []catalogmanagementv1.Script{*scriptModel} + versionModel.Entitlement = versionEntitlementModel + versionModel.Licenses = []catalogmanagementv1.License{*licenseModel} + versionModel.ImageManifestURL = core.StringPtr("testString") + versionModel.Deprecated = core.BoolPtr(true) + versionModel.PackageVersion = core.StringPtr("testString") + versionModel.State = stateModel + versionModel.VersionLocator = core.StringPtr("testString") + versionModel.LongDescription = core.StringPtr("testString") + versionModel.LongDescriptionI18n = make(map[string]string) + versionModel.WhitelistedAccounts = []string{"testString"} + versionModel.ImagePullKeyName = core.StringPtr("testString") + versionModel.DeprecatePending = deprecatePendingModel + versionModel.SolutionInfo = solutionInfoModel + versionModel.IsConsumable = core.BoolPtr(true) + + // Construct an instance of the Deployment model + deploymentModel := new(catalogmanagementv1.Deployment) + deploymentModel.ID = core.StringPtr("testString") + deploymentModel.Label = core.StringPtr("testString") + deploymentModel.Name = core.StringPtr("testString") + deploymentModel.ShortDescription = core.StringPtr("testString") + deploymentModel.LongDescription = core.StringPtr("testString") + deploymentModel.Metadata = make(map[string]interface{}) + deploymentModel.Tags = []string{"testString"} + deploymentModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + deploymentModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + + // Construct an instance of the Plan model + planModel := new(catalogmanagementv1.Plan) + planModel.ID = core.StringPtr("testString") + planModel.Label = core.StringPtr("testString") + planModel.Name = core.StringPtr("testString") + planModel.ShortDescription = core.StringPtr("testString") + planModel.LongDescription = core.StringPtr("testString") + planModel.Metadata = make(map[string]interface{}) + planModel.Tags = []string{"testString"} + planModel.AdditionalFeatures = []catalogmanagementv1.Feature{*featureModel} + planModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + planModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + planModel.Deployments = []catalogmanagementv1.Deployment{*deploymentModel} + + // Construct an instance of the Kind model + kindModel := new(catalogmanagementv1.Kind) + kindModel.ID = core.StringPtr("testString") + kindModel.FormatKind = core.StringPtr("testString") + kindModel.InstallKind = core.StringPtr("testString") + kindModel.TargetKind = core.StringPtr("testString") + kindModel.Metadata = make(map[string]interface{}) + kindModel.Tags = []string{"testString"} + kindModel.AdditionalFeatures = []catalogmanagementv1.Feature{*featureModel} + kindModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + kindModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + kindModel.Versions = []catalogmanagementv1.Version{*versionModel} + kindModel.Plans = []catalogmanagementv1.Plan{*planModel} + + // Construct an instance of the ProviderInfo model + providerInfoModel := new(catalogmanagementv1.ProviderInfo) + providerInfoModel.ID = core.StringPtr("testString") + providerInfoModel.Name = core.StringPtr("testString") + + // Construct an instance of the RepoInfo model + repoInfoModel := new(catalogmanagementv1.RepoInfo) + repoInfoModel.Token = core.StringPtr("testString") + repoInfoModel.Type = core.StringPtr("testString") + + // Construct an instance of the ImagePullKey model + imagePullKeyModel := new(catalogmanagementv1.ImagePullKey) + imagePullKeyModel.Name = core.StringPtr("testString") + imagePullKeyModel.Value = core.StringPtr("testString") + imagePullKeyModel.Description = core.StringPtr("testString") + + // Construct an instance of the SupportWaitTime model + supportWaitTimeModel := new(catalogmanagementv1.SupportWaitTime) + supportWaitTimeModel.Value = core.Int64Ptr(int64(38)) + supportWaitTimeModel.Type = core.StringPtr("testString") + + // Construct an instance of the SupportTime model + supportTimeModel := new(catalogmanagementv1.SupportTime) + supportTimeModel.Day = core.Int64Ptr(int64(38)) + supportTimeModel.StartTime = core.StringPtr("testString") + supportTimeModel.EndTime = core.StringPtr("testString") + + // Construct an instance of the SupportAvailability model + supportAvailabilityModel := new(catalogmanagementv1.SupportAvailability) + supportAvailabilityModel.Times = []catalogmanagementv1.SupportTime{*supportTimeModel} + supportAvailabilityModel.Timezone = core.StringPtr("testString") + supportAvailabilityModel.AlwaysAvailable = core.BoolPtr(true) + + // Construct an instance of the SupportDetail model + supportDetailModel := new(catalogmanagementv1.SupportDetail) + supportDetailModel.Type = core.StringPtr("testString") + supportDetailModel.Contact = core.StringPtr("testString") + supportDetailModel.ResponseWaitTime = supportWaitTimeModel + supportDetailModel.Availability = supportAvailabilityModel + + // Construct an instance of the SupportEscalation model + supportEscalationModel := new(catalogmanagementv1.SupportEscalation) + supportEscalationModel.EscalationWaitTime = supportWaitTimeModel + supportEscalationModel.ResponseWaitTime = supportWaitTimeModel + supportEscalationModel.Contact = core.StringPtr("testString") + + // Construct an instance of the Support model + supportModel := new(catalogmanagementv1.Support) + supportModel.URL = core.StringPtr("testString") + supportModel.Process = core.StringPtr("testString") + supportModel.ProcessI18n = make(map[string]string) + supportModel.Locations = []string{"testString"} + supportModel.SupportDetails = []catalogmanagementv1.SupportDetail{*supportDetailModel} + supportModel.SupportEscalation = supportEscalationModel + supportModel.SupportType = core.StringPtr("testString") + + // Construct an instance of the LearnMoreLinks model + learnMoreLinksModel := new(catalogmanagementv1.LearnMoreLinks) + learnMoreLinksModel.FirstParty = core.StringPtr("testString") + learnMoreLinksModel.ThirdParty = core.StringPtr("testString") + + // Construct an instance of the Constraint model + constraintModel := new(catalogmanagementv1.Constraint) + constraintModel.Type = core.StringPtr("testString") + constraintModel.Rule = core.StringPtr("testString") + + // Construct an instance of the Badge model + badgeModel := new(catalogmanagementv1.Badge) + badgeModel.ID = core.StringPtr("testString") + badgeModel.Label = core.StringPtr("testString") + badgeModel.LabelI18n = make(map[string]string) + badgeModel.Description = core.StringPtr("testString") + badgeModel.DescriptionI18n = make(map[string]string) + badgeModel.Icon = core.StringPtr("testString") + badgeModel.Authority = core.StringPtr("testString") + badgeModel.Tag = core.StringPtr("testString") + badgeModel.LearnMoreLinks = learnMoreLinksModel + badgeModel.Constraints = []catalogmanagementv1.Constraint{*constraintModel} + + // Construct an instance of the ReplaceOfferingOptions model + replaceOfferingOptionsModel := new(catalogmanagementv1.ReplaceOfferingOptions) + replaceOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") + replaceOfferingOptionsModel.OfferingID = core.StringPtr("testString") + replaceOfferingOptionsModel.ID = core.StringPtr("testString") + replaceOfferingOptionsModel.Rev = core.StringPtr("testString") + replaceOfferingOptionsModel.URL = core.StringPtr("testString") + replaceOfferingOptionsModel.CRN = core.StringPtr("testString") + replaceOfferingOptionsModel.Label = core.StringPtr("testString") + replaceOfferingOptionsModel.LabelI18n = make(map[string]string) + replaceOfferingOptionsModel.Name = core.StringPtr("testString") + replaceOfferingOptionsModel.OfferingIconURL = core.StringPtr("testString") + replaceOfferingOptionsModel.OfferingDocsURL = core.StringPtr("testString") + replaceOfferingOptionsModel.OfferingSupportURL = core.StringPtr("testString") + replaceOfferingOptionsModel.Tags = []string{"testString"} + replaceOfferingOptionsModel.Keywords = []string{"testString"} + replaceOfferingOptionsModel.Rating = ratingModel + replaceOfferingOptionsModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + replaceOfferingOptionsModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + replaceOfferingOptionsModel.ShortDescription = core.StringPtr("testString") + replaceOfferingOptionsModel.ShortDescriptionI18n = make(map[string]string) + replaceOfferingOptionsModel.LongDescription = core.StringPtr("testString") + replaceOfferingOptionsModel.LongDescriptionI18n = make(map[string]string) + replaceOfferingOptionsModel.Features = []catalogmanagementv1.Feature{*featureModel} + replaceOfferingOptionsModel.Kinds = []catalogmanagementv1.Kind{*kindModel} + replaceOfferingOptionsModel.PcManaged = core.BoolPtr(true) + replaceOfferingOptionsModel.PublishApproved = core.BoolPtr(true) + replaceOfferingOptionsModel.ShareWithAll = core.BoolPtr(true) + replaceOfferingOptionsModel.ShareWithIBM = core.BoolPtr(true) + replaceOfferingOptionsModel.ShareEnabled = core.BoolPtr(true) + replaceOfferingOptionsModel.PermitRequestIBMPublicPublish = core.BoolPtr(true) + replaceOfferingOptionsModel.IBMPublishApproved = core.BoolPtr(true) + replaceOfferingOptionsModel.PublicPublishApproved = core.BoolPtr(true) + replaceOfferingOptionsModel.PublicOriginalCRN = core.StringPtr("testString") + replaceOfferingOptionsModel.PublishPublicCRN = core.StringPtr("testString") + replaceOfferingOptionsModel.PortalApprovalRecord = core.StringPtr("testString") + replaceOfferingOptionsModel.PortalUIURL = core.StringPtr("testString") + replaceOfferingOptionsModel.CatalogID = core.StringPtr("testString") + replaceOfferingOptionsModel.CatalogName = core.StringPtr("testString") + replaceOfferingOptionsModel.Metadata = make(map[string]interface{}) + replaceOfferingOptionsModel.Disclaimer = core.StringPtr("testString") + replaceOfferingOptionsModel.Hidden = core.BoolPtr(true) + replaceOfferingOptionsModel.Provider = core.StringPtr("testString") + replaceOfferingOptionsModel.ProviderInfo = providerInfoModel + replaceOfferingOptionsModel.RepoInfo = repoInfoModel + replaceOfferingOptionsModel.ImagePullKeys = []catalogmanagementv1.ImagePullKey{*imagePullKeyModel} + replaceOfferingOptionsModel.Support = supportModel + replaceOfferingOptionsModel.Media = []catalogmanagementv1.MediaItem{*mediaItemModel} + replaceOfferingOptionsModel.DeprecatePending = deprecatePendingModel + replaceOfferingOptionsModel.ProductKind = core.StringPtr("testString") + replaceOfferingOptionsModel.Badges = []catalogmanagementv1.Badge{*badgeModel} + replaceOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := catalogManagementService.ReplaceOffering(replaceOfferingOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + catalogManagementService.EnableRetries(0, 0) + result, response, operationErr = catalogManagementService.ReplaceOffering(replaceOfferingOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ReplaceOffering(replaceOfferingOptions *ReplaceOfferingOptions)`, func() { + replaceOfferingPath := "/catalogs/testString/offerings/testString" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(replaceOfferingPath)) + Expect(req.Method).To(Equal("PUT")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "url": "URL", "crn": "CRN", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "name": "Name", "offering_icon_url": "OfferingIconURL", "offering_docs_url": "OfferingDocsURL", "offering_support_url": "OfferingSupportURL", "tags": ["Tags"], "keywords": ["Keywords"], "rating": {"one_star_count": 12, "two_star_count": 12, "three_star_count": 14, "four_star_count": 13}, "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "short_description": "ShortDescription", "short_description_i18n": {"mapKey": "Inner"}, "long_description": "LongDescription", "long_description_i18n": {"mapKey": "Inner"}, "features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "kinds": [{"id": "ID", "format_kind": "FormatKind", "install_kind": "InstallKind", "target_kind": "TargetKind", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "additional_features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "versions": [{"id": "ID", "_rev": "Rev", "crn": "CRN", "version": "Version", "flavor": {"name": "Name", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "index": 5}, "sha": "Sha", "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "offering_id": "OfferingID", "catalog_id": "CatalogID", "kind_id": "KindID", "tags": ["Tags"], "repo_url": "RepoURL", "source_url": "SourceURL", "tgz_url": "TgzURL", "configuration": [{"key": "Key", "type": "Type", "default_value": "anyValue", "display_name": "DisplayName", "value_constraint": "ValueConstraint", "description": "Description", "required": true, "options": ["anyValue"], "hidden": true, "custom_config": {"type": "Type", "grouping": "Grouping", "original_grouping": "OriginalGrouping", "grouping_index": 13, "config_constraints": {"anyKey": "anyValue"}, "associations": {"parameters": [{"name": "Name", "optionsRefresh": true}]}}, "type_metadata": "TypeMetadata"}], "outputs": [{"key": "Key", "description": "Description"}], "iam_permissions": [{"service_name": "ServiceName", "role_crns": ["RoleCrns"], "resources": [{"name": "Name", "description": "Description", "role_crns": ["RoleCrns"]}]}], "metadata": {"mapKey": "anyValue"}, "validation": {"validated": "2019-01-01T12:00:00.000Z", "requested": "2019-01-01T12:00:00.000Z", "state": "State", "last_operation": "LastOperation", "target": {"mapKey": "anyValue"}, "message": "Message"}, "required_resources": [{"type": "mem", "value": "anyValue"}], "single_instance": true, "install": {"instructions": "Instructions", "instructions_i18n": {"mapKey": "Inner"}, "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}, "pre_install": [{"instructions": "Instructions", "instructions_i18n": {"mapKey": "Inner"}, "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}], "entitlement": {"provider_name": "ProviderName", "provider_id": "ProviderID", "product_id": "ProductID", "part_numbers": ["PartNumbers"], "image_repo_name": "ImageRepoName"}, "licenses": [{"id": "ID", "name": "Name", "type": "Type", "url": "URL", "description": "Description"}], "image_manifest_url": "ImageManifestURL", "deprecated": true, "package_version": "PackageVersion", "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "version_locator": "VersionLocator", "long_description": "LongDescription", "long_description_i18n": {"mapKey": "Inner"}, "whitelisted_accounts": ["WhitelistedAccounts"], "image_pull_key_name": "ImagePullKeyName", "deprecate_pending": {"deprecate_date": "2019-01-01T12:00:00.000Z", "deprecate_state": "DeprecateState", "description": "Description"}, "solution_info": {"architecture_diagrams": [{"diagram": {"url": "URL", "api_url": "APIURL", "url_proxy": {"url": "URL", "sha": "Sha"}, "caption": "Caption", "caption_i18n": {"mapKey": "Inner"}, "type": "Type", "thumbnail_url": "ThumbnailURL"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "cost_estimate": {"version": "Version", "currency": "Currency", "projects": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "pastBreakdown": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "breakdown": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "diff": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "summary": {"totalDetectedResources": 22, "totalSupportedResources": 23, "totalUnsupportedResources": 25, "totalUsageBasedResources": 24, "totalNoPriceResources": 21, "unsupportedResourceCounts": {"mapKey": 5}, "noPriceResourceCounts": {"mapKey": 5}}}], "summary": {"totalDetectedResources": 22, "totalSupportedResources": 23, "totalUnsupportedResources": 25, "totalUsageBasedResources": 24, "totalNoPriceResources": 21, "unsupportedResourceCounts": {"mapKey": 5}, "noPriceResourceCounts": {"mapKey": 5}}, "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z"}, "dependencies": [{"catalog_id": "CatalogID", "id": "ID", "name": "Name", "version": "Version", "flavors": ["Flavors"]}]}, "is_consumable": true}], "plans": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "additional_features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "deployments": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z"}]}]}], "pc_managed": false, "publish_approved": false, "share_with_all": true, "share_with_ibm": true, "share_enabled": true, "permit_request_ibm_public_publish": false, "ibm_publish_approved": true, "public_publish_approved": false, "public_original_crn": "PublicOriginalCRN", "publish_public_crn": "PublishPublicCRN", "portal_approval_record": "PortalApprovalRecord", "portal_ui_url": "PortalUIURL", "catalog_id": "CatalogID", "catalog_name": "CatalogName", "metadata": {"mapKey": "anyValue"}, "disclaimer": "Disclaimer", "hidden": true, "provider": "Provider", "provider_info": {"id": "ID", "name": "Name"}, "repo_info": {"token": "Token", "type": "Type"}, "image_pull_keys": [{"name": "Name", "value": "Value", "description": "Description"}], "support": {"url": "URL", "process": "Process", "process_i18n": {"mapKey": "Inner"}, "locations": ["Locations"], "support_details": [{"type": "Type", "contact": "Contact", "response_wait_time": {"value": 5, "type": "Type"}, "availability": {"times": [{"day": 3, "start_time": "StartTime", "end_time": "EndTime"}], "timezone": "Timezone", "always_available": false}}], "support_escalation": {"escalation_wait_time": {"value": 5, "type": "Type"}, "response_wait_time": {"value": 5, "type": "Type"}, "contact": "Contact"}, "support_type": "SupportType"}, "media": [{"url": "URL", "api_url": "APIURL", "url_proxy": {"url": "URL", "sha": "Sha"}, "caption": "Caption", "caption_i18n": {"mapKey": "Inner"}, "type": "Type", "thumbnail_url": "ThumbnailURL"}], "deprecate_pending": {"deprecate_date": "2019-01-01T12:00:00.000Z", "deprecate_state": "DeprecateState", "description": "Description"}, "product_kind": "ProductKind", "badges": [{"id": "ID", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}, "icon": "Icon", "authority": "Authority", "tag": "Tag", "learn_more_links": {"first_party": "FirstParty", "third_party": "ThirdParty"}, "constraints": [{"type": "Type", "rule": "anyValue"}]}]}`) + })) + }) + It(`Invoke ReplaceOffering successfully with retries`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + catalogManagementService.EnableRetries(0, 0) + + // Construct an instance of the Rating model + ratingModel := new(catalogmanagementv1.Rating) + ratingModel.OneStarCount = core.Int64Ptr(int64(38)) + ratingModel.TwoStarCount = core.Int64Ptr(int64(38)) + ratingModel.ThreeStarCount = core.Int64Ptr(int64(38)) + ratingModel.FourStarCount = core.Int64Ptr(int64(38)) + + // Construct an instance of the Feature model + featureModel := new(catalogmanagementv1.Feature) + featureModel.Title = core.StringPtr("testString") + featureModel.TitleI18n = make(map[string]string) + featureModel.Description = core.StringPtr("testString") + featureModel.DescriptionI18n = make(map[string]string) + + // Construct an instance of the Flavor model + flavorModel := new(catalogmanagementv1.Flavor) + flavorModel.Name = core.StringPtr("testString") + flavorModel.Label = core.StringPtr("testString") + flavorModel.LabelI18n = make(map[string]string) + flavorModel.Index = core.Int64Ptr(int64(38)) + + // Construct an instance of the RenderTypeAssociationsParametersItem model + renderTypeAssociationsParametersItemModel := new(catalogmanagementv1.RenderTypeAssociationsParametersItem) + renderTypeAssociationsParametersItemModel.Name = core.StringPtr("testString") + renderTypeAssociationsParametersItemModel.OptionsRefresh = core.BoolPtr(true) + + // Construct an instance of the RenderTypeAssociations model + renderTypeAssociationsModel := new(catalogmanagementv1.RenderTypeAssociations) + renderTypeAssociationsModel.Parameters = []catalogmanagementv1.RenderTypeAssociationsParametersItem{*renderTypeAssociationsParametersItemModel} + + // Construct an instance of the RenderType model + renderTypeModel := new(catalogmanagementv1.RenderType) + renderTypeModel.Type = core.StringPtr("testString") + renderTypeModel.Grouping = core.StringPtr("testString") + renderTypeModel.OriginalGrouping = core.StringPtr("testString") + renderTypeModel.GroupingIndex = core.Int64Ptr(int64(38)) + renderTypeModel.ConfigConstraints = map[string]interface{}{"anyKey": "anyValue"} + renderTypeModel.Associations = renderTypeAssociationsModel + + // Construct an instance of the Configuration model + configurationModel := new(catalogmanagementv1.Configuration) + configurationModel.Key = core.StringPtr("testString") + configurationModel.Type = core.StringPtr("testString") + configurationModel.DefaultValue = core.StringPtr("testString") + configurationModel.DisplayName = core.StringPtr("testString") + configurationModel.ValueConstraint = core.StringPtr("testString") + configurationModel.Description = core.StringPtr("testString") + configurationModel.Required = core.BoolPtr(true) + configurationModel.Options = []interface{}{"testString"} + configurationModel.Hidden = core.BoolPtr(true) + configurationModel.CustomConfig = renderTypeModel + configurationModel.TypeMetadata = core.StringPtr("testString") + + // Construct an instance of the Output model + outputModel := new(catalogmanagementv1.Output) + outputModel.Key = core.StringPtr("testString") + outputModel.Description = core.StringPtr("testString") + + // Construct an instance of the IamResource model + iamResourceModel := new(catalogmanagementv1.IamResource) + iamResourceModel.Name = core.StringPtr("testString") + iamResourceModel.Description = core.StringPtr("testString") + iamResourceModel.RoleCrns = []string{"testString"} + + // Construct an instance of the IamPermission model + iamPermissionModel := new(catalogmanagementv1.IamPermission) + iamPermissionModel.ServiceName = core.StringPtr("testString") + iamPermissionModel.RoleCrns = []string{"testString"} + iamPermissionModel.Resources = []catalogmanagementv1.IamResource{*iamResourceModel} + + // Construct an instance of the Validation model + validationModel := new(catalogmanagementv1.Validation) + validationModel.Validated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + validationModel.Requested = CreateMockDateTime("2019-01-01T12:00:00.000Z") + validationModel.State = core.StringPtr("testString") + validationModel.LastOperation = core.StringPtr("testString") + validationModel.Target = make(map[string]interface{}) + validationModel.Message = core.StringPtr("testString") + + // Construct an instance of the Resource model + resourceModel := new(catalogmanagementv1.Resource) + resourceModel.Type = core.StringPtr("mem") + resourceModel.Value = core.StringPtr("testString") + + // Construct an instance of the Script model + scriptModel := new(catalogmanagementv1.Script) + scriptModel.Instructions = core.StringPtr("testString") + scriptModel.InstructionsI18n = make(map[string]string) + scriptModel.Script = core.StringPtr("testString") + scriptModel.ScriptPermission = core.StringPtr("testString") + scriptModel.DeleteScript = core.StringPtr("testString") + scriptModel.Scope = core.StringPtr("testString") + + // Construct an instance of the VersionEntitlement model + versionEntitlementModel := new(catalogmanagementv1.VersionEntitlement) + versionEntitlementModel.ProviderName = core.StringPtr("testString") + versionEntitlementModel.ProviderID = core.StringPtr("testString") + versionEntitlementModel.ProductID = core.StringPtr("testString") + versionEntitlementModel.PartNumbers = []string{"testString"} + versionEntitlementModel.ImageRepoName = core.StringPtr("testString") + + // Construct an instance of the License model + licenseModel := new(catalogmanagementv1.License) + licenseModel.ID = core.StringPtr("testString") + licenseModel.Name = core.StringPtr("testString") + licenseModel.Type = core.StringPtr("testString") + licenseModel.URL = core.StringPtr("testString") + licenseModel.Description = core.StringPtr("testString") + + // Construct an instance of the State model + stateModel := new(catalogmanagementv1.State) + stateModel.Current = core.StringPtr("testString") + stateModel.CurrentEntered = CreateMockDateTime("2019-01-01T12:00:00.000Z") + stateModel.Pending = core.StringPtr("testString") + stateModel.PendingRequested = CreateMockDateTime("2019-01-01T12:00:00.000Z") + stateModel.Previous = core.StringPtr("testString") + + // Construct an instance of the DeprecatePending model + deprecatePendingModel := new(catalogmanagementv1.DeprecatePending) + deprecatePendingModel.DeprecateDate = CreateMockDateTime("2019-01-01T12:00:00.000Z") + deprecatePendingModel.DeprecateState = core.StringPtr("testString") + deprecatePendingModel.Description = core.StringPtr("testString") + + // Construct an instance of the URLProxy model + urlProxyModel := new(catalogmanagementv1.URLProxy) + urlProxyModel.URL = core.StringPtr("testString") + urlProxyModel.Sha = core.StringPtr("testString") + + // Construct an instance of the MediaItem model + mediaItemModel := new(catalogmanagementv1.MediaItem) + mediaItemModel.URL = core.StringPtr("testString") + mediaItemModel.APIURL = core.StringPtr("testString") + mediaItemModel.URLProxy = urlProxyModel + mediaItemModel.Caption = core.StringPtr("testString") + mediaItemModel.CaptionI18n = make(map[string]string) + mediaItemModel.Type = core.StringPtr("testString") + mediaItemModel.ThumbnailURL = core.StringPtr("testString") + + // Construct an instance of the ArchitectureDiagram model + architectureDiagramModel := new(catalogmanagementv1.ArchitectureDiagram) + architectureDiagramModel.Diagram = mediaItemModel + architectureDiagramModel.Description = core.StringPtr("testString") + architectureDiagramModel.DescriptionI18n = make(map[string]string) + + // Construct an instance of the CostComponent model + costComponentModel := new(catalogmanagementv1.CostComponent) + costComponentModel.Name = core.StringPtr("testString") + costComponentModel.Unit = core.StringPtr("testString") + costComponentModel.HourlyQuantity = core.StringPtr("testString") + costComponentModel.MonthlyQuantity = core.StringPtr("testString") + costComponentModel.Price = core.StringPtr("testString") + costComponentModel.HourlyCost = core.StringPtr("testString") + costComponentModel.MonthlyCost = core.StringPtr("testString") + + // Construct an instance of the CostResource model + costResourceModel := new(catalogmanagementv1.CostResource) + costResourceModel.Name = core.StringPtr("testString") + costResourceModel.Metadata = make(map[string]interface{}) + costResourceModel.HourlyCost = core.StringPtr("testString") + costResourceModel.MonthlyCost = core.StringPtr("testString") + costResourceModel.CostComponents = []catalogmanagementv1.CostComponent{*costComponentModel} + + // Construct an instance of the CostBreakdown model + costBreakdownModel := new(catalogmanagementv1.CostBreakdown) + costBreakdownModel.TotalHourlyCost = core.StringPtr("testString") + costBreakdownModel.TotalMonthlyCOst = core.StringPtr("testString") + costBreakdownModel.Resources = []catalogmanagementv1.CostResource{*costResourceModel} + + // Construct an instance of the CostSummary model + costSummaryModel := new(catalogmanagementv1.CostSummary) + costSummaryModel.TotalDetectedResources = core.Int64Ptr(int64(38)) + costSummaryModel.TotalSupportedResources = core.Int64Ptr(int64(38)) + costSummaryModel.TotalUnsupportedResources = core.Int64Ptr(int64(38)) + costSummaryModel.TotalUsageBasedResources = core.Int64Ptr(int64(38)) + costSummaryModel.TotalNoPriceResources = core.Int64Ptr(int64(38)) + costSummaryModel.UnsupportedResourceCounts = make(map[string]int64) + costSummaryModel.NoPriceResourceCounts = make(map[string]int64) + + // Construct an instance of the Project model + projectModel := new(catalogmanagementv1.Project) + projectModel.Name = core.StringPtr("testString") + projectModel.Metadata = make(map[string]interface{}) + projectModel.PastBreakdown = costBreakdownModel + projectModel.Breakdown = costBreakdownModel + projectModel.Diff = costBreakdownModel + projectModel.Summary = costSummaryModel + + // Construct an instance of the CostEstimate model + costEstimateModel := new(catalogmanagementv1.CostEstimate) + costEstimateModel.Version = core.StringPtr("testString") + costEstimateModel.Currency = core.StringPtr("testString") + costEstimateModel.Projects = []catalogmanagementv1.Project{*projectModel} + costEstimateModel.Summary = costSummaryModel + costEstimateModel.TotalHourlyCost = core.StringPtr("testString") + costEstimateModel.TotalMonthlyCost = core.StringPtr("testString") + costEstimateModel.PastTotalHourlyCost = core.StringPtr("testString") + costEstimateModel.PastTotalMonthlyCost = core.StringPtr("testString") + costEstimateModel.DiffTotalHourlyCost = core.StringPtr("testString") + costEstimateModel.DiffTotalMonthlyCost = core.StringPtr("testString") + costEstimateModel.TimeGenerated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + + // Construct an instance of the Dependency model + dependencyModel := new(catalogmanagementv1.Dependency) + dependencyModel.CatalogID = core.StringPtr("testString") + dependencyModel.ID = core.StringPtr("testString") + dependencyModel.Name = core.StringPtr("testString") + dependencyModel.Version = core.StringPtr("testString") + dependencyModel.Flavors = []string{"testString"} + + // Construct an instance of the SolutionInfo model + solutionInfoModel := new(catalogmanagementv1.SolutionInfo) + solutionInfoModel.ArchitectureDiagrams = []catalogmanagementv1.ArchitectureDiagram{*architectureDiagramModel} + solutionInfoModel.Features = []catalogmanagementv1.Feature{*featureModel} + solutionInfoModel.CostEstimate = costEstimateModel + solutionInfoModel.Dependencies = []catalogmanagementv1.Dependency{*dependencyModel} + + // Construct an instance of the Version model + versionModel := new(catalogmanagementv1.Version) + versionModel.ID = core.StringPtr("testString") + versionModel.Rev = core.StringPtr("testString") + versionModel.CRN = core.StringPtr("testString") + versionModel.Version = core.StringPtr("testString") + versionModel.Flavor = flavorModel + versionModel.Sha = core.StringPtr("testString") + versionModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + versionModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + versionModel.OfferingID = core.StringPtr("testString") + versionModel.CatalogID = core.StringPtr("testString") + versionModel.KindID = core.StringPtr("testString") + versionModel.Tags = []string{"testString"} + versionModel.RepoURL = core.StringPtr("testString") + versionModel.SourceURL = core.StringPtr("testString") + versionModel.TgzURL = core.StringPtr("testString") + versionModel.Configuration = []catalogmanagementv1.Configuration{*configurationModel} + versionModel.Outputs = []catalogmanagementv1.Output{*outputModel} + versionModel.IamPermissions = []catalogmanagementv1.IamPermission{*iamPermissionModel} + versionModel.Metadata = make(map[string]interface{}) + versionModel.Validation = validationModel + versionModel.RequiredResources = []catalogmanagementv1.Resource{*resourceModel} + versionModel.SingleInstance = core.BoolPtr(true) + versionModel.Install = scriptModel + versionModel.PreInstall = []catalogmanagementv1.Script{*scriptModel} + versionModel.Entitlement = versionEntitlementModel + versionModel.Licenses = []catalogmanagementv1.License{*licenseModel} + versionModel.ImageManifestURL = core.StringPtr("testString") + versionModel.Deprecated = core.BoolPtr(true) + versionModel.PackageVersion = core.StringPtr("testString") + versionModel.State = stateModel + versionModel.VersionLocator = core.StringPtr("testString") + versionModel.LongDescription = core.StringPtr("testString") + versionModel.LongDescriptionI18n = make(map[string]string) + versionModel.WhitelistedAccounts = []string{"testString"} + versionModel.ImagePullKeyName = core.StringPtr("testString") + versionModel.DeprecatePending = deprecatePendingModel + versionModel.SolutionInfo = solutionInfoModel + versionModel.IsConsumable = core.BoolPtr(true) + + // Construct an instance of the Deployment model + deploymentModel := new(catalogmanagementv1.Deployment) + deploymentModel.ID = core.StringPtr("testString") + deploymentModel.Label = core.StringPtr("testString") + deploymentModel.Name = core.StringPtr("testString") + deploymentModel.ShortDescription = core.StringPtr("testString") + deploymentModel.LongDescription = core.StringPtr("testString") + deploymentModel.Metadata = make(map[string]interface{}) + deploymentModel.Tags = []string{"testString"} + deploymentModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + deploymentModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + + // Construct an instance of the Plan model + planModel := new(catalogmanagementv1.Plan) + planModel.ID = core.StringPtr("testString") + planModel.Label = core.StringPtr("testString") + planModel.Name = core.StringPtr("testString") + planModel.ShortDescription = core.StringPtr("testString") + planModel.LongDescription = core.StringPtr("testString") + planModel.Metadata = make(map[string]interface{}) + planModel.Tags = []string{"testString"} + planModel.AdditionalFeatures = []catalogmanagementv1.Feature{*featureModel} + planModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + planModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + planModel.Deployments = []catalogmanagementv1.Deployment{*deploymentModel} + + // Construct an instance of the Kind model + kindModel := new(catalogmanagementv1.Kind) + kindModel.ID = core.StringPtr("testString") + kindModel.FormatKind = core.StringPtr("testString") + kindModel.InstallKind = core.StringPtr("testString") + kindModel.TargetKind = core.StringPtr("testString") + kindModel.Metadata = make(map[string]interface{}) + kindModel.Tags = []string{"testString"} + kindModel.AdditionalFeatures = []catalogmanagementv1.Feature{*featureModel} + kindModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + kindModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + kindModel.Versions = []catalogmanagementv1.Version{*versionModel} + kindModel.Plans = []catalogmanagementv1.Plan{*planModel} + + // Construct an instance of the ProviderInfo model + providerInfoModel := new(catalogmanagementv1.ProviderInfo) + providerInfoModel.ID = core.StringPtr("testString") + providerInfoModel.Name = core.StringPtr("testString") + + // Construct an instance of the RepoInfo model + repoInfoModel := new(catalogmanagementv1.RepoInfo) + repoInfoModel.Token = core.StringPtr("testString") + repoInfoModel.Type = core.StringPtr("testString") + + // Construct an instance of the ImagePullKey model + imagePullKeyModel := new(catalogmanagementv1.ImagePullKey) + imagePullKeyModel.Name = core.StringPtr("testString") + imagePullKeyModel.Value = core.StringPtr("testString") + imagePullKeyModel.Description = core.StringPtr("testString") + + // Construct an instance of the SupportWaitTime model + supportWaitTimeModel := new(catalogmanagementv1.SupportWaitTime) + supportWaitTimeModel.Value = core.Int64Ptr(int64(38)) + supportWaitTimeModel.Type = core.StringPtr("testString") + + // Construct an instance of the SupportTime model + supportTimeModel := new(catalogmanagementv1.SupportTime) + supportTimeModel.Day = core.Int64Ptr(int64(38)) + supportTimeModel.StartTime = core.StringPtr("testString") + supportTimeModel.EndTime = core.StringPtr("testString") + + // Construct an instance of the SupportAvailability model + supportAvailabilityModel := new(catalogmanagementv1.SupportAvailability) + supportAvailabilityModel.Times = []catalogmanagementv1.SupportTime{*supportTimeModel} + supportAvailabilityModel.Timezone = core.StringPtr("testString") + supportAvailabilityModel.AlwaysAvailable = core.BoolPtr(true) + + // Construct an instance of the SupportDetail model + supportDetailModel := new(catalogmanagementv1.SupportDetail) + supportDetailModel.Type = core.StringPtr("testString") + supportDetailModel.Contact = core.StringPtr("testString") + supportDetailModel.ResponseWaitTime = supportWaitTimeModel + supportDetailModel.Availability = supportAvailabilityModel + + // Construct an instance of the SupportEscalation model + supportEscalationModel := new(catalogmanagementv1.SupportEscalation) + supportEscalationModel.EscalationWaitTime = supportWaitTimeModel + supportEscalationModel.ResponseWaitTime = supportWaitTimeModel + supportEscalationModel.Contact = core.StringPtr("testString") + + // Construct an instance of the Support model + supportModel := new(catalogmanagementv1.Support) + supportModel.URL = core.StringPtr("testString") + supportModel.Process = core.StringPtr("testString") + supportModel.ProcessI18n = make(map[string]string) + supportModel.Locations = []string{"testString"} + supportModel.SupportDetails = []catalogmanagementv1.SupportDetail{*supportDetailModel} + supportModel.SupportEscalation = supportEscalationModel + supportModel.SupportType = core.StringPtr("testString") + + // Construct an instance of the LearnMoreLinks model + learnMoreLinksModel := new(catalogmanagementv1.LearnMoreLinks) + learnMoreLinksModel.FirstParty = core.StringPtr("testString") + learnMoreLinksModel.ThirdParty = core.StringPtr("testString") + + // Construct an instance of the Constraint model + constraintModel := new(catalogmanagementv1.Constraint) + constraintModel.Type = core.StringPtr("testString") + constraintModel.Rule = core.StringPtr("testString") + + // Construct an instance of the Badge model + badgeModel := new(catalogmanagementv1.Badge) + badgeModel.ID = core.StringPtr("testString") + badgeModel.Label = core.StringPtr("testString") + badgeModel.LabelI18n = make(map[string]string) + badgeModel.Description = core.StringPtr("testString") + badgeModel.DescriptionI18n = make(map[string]string) + badgeModel.Icon = core.StringPtr("testString") + badgeModel.Authority = core.StringPtr("testString") + badgeModel.Tag = core.StringPtr("testString") + badgeModel.LearnMoreLinks = learnMoreLinksModel + badgeModel.Constraints = []catalogmanagementv1.Constraint{*constraintModel} + + // Construct an instance of the ReplaceOfferingOptions model + replaceOfferingOptionsModel := new(catalogmanagementv1.ReplaceOfferingOptions) + replaceOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") + replaceOfferingOptionsModel.OfferingID = core.StringPtr("testString") + replaceOfferingOptionsModel.ID = core.StringPtr("testString") + replaceOfferingOptionsModel.Rev = core.StringPtr("testString") + replaceOfferingOptionsModel.URL = core.StringPtr("testString") + replaceOfferingOptionsModel.CRN = core.StringPtr("testString") + replaceOfferingOptionsModel.Label = core.StringPtr("testString") + replaceOfferingOptionsModel.LabelI18n = make(map[string]string) + replaceOfferingOptionsModel.Name = core.StringPtr("testString") + replaceOfferingOptionsModel.OfferingIconURL = core.StringPtr("testString") + replaceOfferingOptionsModel.OfferingDocsURL = core.StringPtr("testString") + replaceOfferingOptionsModel.OfferingSupportURL = core.StringPtr("testString") + replaceOfferingOptionsModel.Tags = []string{"testString"} + replaceOfferingOptionsModel.Keywords = []string{"testString"} + replaceOfferingOptionsModel.Rating = ratingModel + replaceOfferingOptionsModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + replaceOfferingOptionsModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + replaceOfferingOptionsModel.ShortDescription = core.StringPtr("testString") + replaceOfferingOptionsModel.ShortDescriptionI18n = make(map[string]string) + replaceOfferingOptionsModel.LongDescription = core.StringPtr("testString") + replaceOfferingOptionsModel.LongDescriptionI18n = make(map[string]string) + replaceOfferingOptionsModel.Features = []catalogmanagementv1.Feature{*featureModel} + replaceOfferingOptionsModel.Kinds = []catalogmanagementv1.Kind{*kindModel} + replaceOfferingOptionsModel.PcManaged = core.BoolPtr(true) + replaceOfferingOptionsModel.PublishApproved = core.BoolPtr(true) + replaceOfferingOptionsModel.ShareWithAll = core.BoolPtr(true) + replaceOfferingOptionsModel.ShareWithIBM = core.BoolPtr(true) + replaceOfferingOptionsModel.ShareEnabled = core.BoolPtr(true) + replaceOfferingOptionsModel.PermitRequestIBMPublicPublish = core.BoolPtr(true) + replaceOfferingOptionsModel.IBMPublishApproved = core.BoolPtr(true) + replaceOfferingOptionsModel.PublicPublishApproved = core.BoolPtr(true) + replaceOfferingOptionsModel.PublicOriginalCRN = core.StringPtr("testString") + replaceOfferingOptionsModel.PublishPublicCRN = core.StringPtr("testString") + replaceOfferingOptionsModel.PortalApprovalRecord = core.StringPtr("testString") + replaceOfferingOptionsModel.PortalUIURL = core.StringPtr("testString") + replaceOfferingOptionsModel.CatalogID = core.StringPtr("testString") + replaceOfferingOptionsModel.CatalogName = core.StringPtr("testString") + replaceOfferingOptionsModel.Metadata = make(map[string]interface{}) + replaceOfferingOptionsModel.Disclaimer = core.StringPtr("testString") + replaceOfferingOptionsModel.Hidden = core.BoolPtr(true) + replaceOfferingOptionsModel.Provider = core.StringPtr("testString") + replaceOfferingOptionsModel.ProviderInfo = providerInfoModel + replaceOfferingOptionsModel.RepoInfo = repoInfoModel + replaceOfferingOptionsModel.ImagePullKeys = []catalogmanagementv1.ImagePullKey{*imagePullKeyModel} + replaceOfferingOptionsModel.Support = supportModel + replaceOfferingOptionsModel.Media = []catalogmanagementv1.MediaItem{*mediaItemModel} + replaceOfferingOptionsModel.DeprecatePending = deprecatePendingModel + replaceOfferingOptionsModel.ProductKind = core.StringPtr("testString") + replaceOfferingOptionsModel.Badges = []catalogmanagementv1.Badge{*badgeModel} + replaceOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := catalogManagementService.ReplaceOfferingWithContext(ctx, replaceOfferingOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + catalogManagementService.DisableRetries() + result, response, operationErr := catalogManagementService.ReplaceOffering(replaceOfferingOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = catalogManagementService.ReplaceOfferingWithContext(ctx, replaceOfferingOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(replaceOfferingPath)) + Expect(req.Method).To(Equal("PUT")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "url": "URL", "crn": "CRN", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "name": "Name", "offering_icon_url": "OfferingIconURL", "offering_docs_url": "OfferingDocsURL", "offering_support_url": "OfferingSupportURL", "tags": ["Tags"], "keywords": ["Keywords"], "rating": {"one_star_count": 12, "two_star_count": 12, "three_star_count": 14, "four_star_count": 13}, "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "short_description": "ShortDescription", "short_description_i18n": {"mapKey": "Inner"}, "long_description": "LongDescription", "long_description_i18n": {"mapKey": "Inner"}, "features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "kinds": [{"id": "ID", "format_kind": "FormatKind", "install_kind": "InstallKind", "target_kind": "TargetKind", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "additional_features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "versions": [{"id": "ID", "_rev": "Rev", "crn": "CRN", "version": "Version", "flavor": {"name": "Name", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "index": 5}, "sha": "Sha", "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "offering_id": "OfferingID", "catalog_id": "CatalogID", "kind_id": "KindID", "tags": ["Tags"], "repo_url": "RepoURL", "source_url": "SourceURL", "tgz_url": "TgzURL", "configuration": [{"key": "Key", "type": "Type", "default_value": "anyValue", "display_name": "DisplayName", "value_constraint": "ValueConstraint", "description": "Description", "required": true, "options": ["anyValue"], "hidden": true, "custom_config": {"type": "Type", "grouping": "Grouping", "original_grouping": "OriginalGrouping", "grouping_index": 13, "config_constraints": {"anyKey": "anyValue"}, "associations": {"parameters": [{"name": "Name", "optionsRefresh": true}]}}, "type_metadata": "TypeMetadata"}], "outputs": [{"key": "Key", "description": "Description"}], "iam_permissions": [{"service_name": "ServiceName", "role_crns": ["RoleCrns"], "resources": [{"name": "Name", "description": "Description", "role_crns": ["RoleCrns"]}]}], "metadata": {"mapKey": "anyValue"}, "validation": {"validated": "2019-01-01T12:00:00.000Z", "requested": "2019-01-01T12:00:00.000Z", "state": "State", "last_operation": "LastOperation", "target": {"mapKey": "anyValue"}, "message": "Message"}, "required_resources": [{"type": "mem", "value": "anyValue"}], "single_instance": true, "install": {"instructions": "Instructions", "instructions_i18n": {"mapKey": "Inner"}, "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}, "pre_install": [{"instructions": "Instructions", "instructions_i18n": {"mapKey": "Inner"}, "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}], "entitlement": {"provider_name": "ProviderName", "provider_id": "ProviderID", "product_id": "ProductID", "part_numbers": ["PartNumbers"], "image_repo_name": "ImageRepoName"}, "licenses": [{"id": "ID", "name": "Name", "type": "Type", "url": "URL", "description": "Description"}], "image_manifest_url": "ImageManifestURL", "deprecated": true, "package_version": "PackageVersion", "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "version_locator": "VersionLocator", "long_description": "LongDescription", "long_description_i18n": {"mapKey": "Inner"}, "whitelisted_accounts": ["WhitelistedAccounts"], "image_pull_key_name": "ImagePullKeyName", "deprecate_pending": {"deprecate_date": "2019-01-01T12:00:00.000Z", "deprecate_state": "DeprecateState", "description": "Description"}, "solution_info": {"architecture_diagrams": [{"diagram": {"url": "URL", "api_url": "APIURL", "url_proxy": {"url": "URL", "sha": "Sha"}, "caption": "Caption", "caption_i18n": {"mapKey": "Inner"}, "type": "Type", "thumbnail_url": "ThumbnailURL"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "cost_estimate": {"version": "Version", "currency": "Currency", "projects": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "pastBreakdown": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "breakdown": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "diff": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "summary": {"totalDetectedResources": 22, "totalSupportedResources": 23, "totalUnsupportedResources": 25, "totalUsageBasedResources": 24, "totalNoPriceResources": 21, "unsupportedResourceCounts": {"mapKey": 5}, "noPriceResourceCounts": {"mapKey": 5}}}], "summary": {"totalDetectedResources": 22, "totalSupportedResources": 23, "totalUnsupportedResources": 25, "totalUsageBasedResources": 24, "totalNoPriceResources": 21, "unsupportedResourceCounts": {"mapKey": 5}, "noPriceResourceCounts": {"mapKey": 5}}, "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z"}, "dependencies": [{"catalog_id": "CatalogID", "id": "ID", "name": "Name", "version": "Version", "flavors": ["Flavors"]}]}, "is_consumable": true}], "plans": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "additional_features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "deployments": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z"}]}]}], "pc_managed": false, "publish_approved": false, "share_with_all": true, "share_with_ibm": true, "share_enabled": true, "permit_request_ibm_public_publish": false, "ibm_publish_approved": true, "public_publish_approved": false, "public_original_crn": "PublicOriginalCRN", "publish_public_crn": "PublishPublicCRN", "portal_approval_record": "PortalApprovalRecord", "portal_ui_url": "PortalUIURL", "catalog_id": "CatalogID", "catalog_name": "CatalogName", "metadata": {"mapKey": "anyValue"}, "disclaimer": "Disclaimer", "hidden": true, "provider": "Provider", "provider_info": {"id": "ID", "name": "Name"}, "repo_info": {"token": "Token", "type": "Type"}, "image_pull_keys": [{"name": "Name", "value": "Value", "description": "Description"}], "support": {"url": "URL", "process": "Process", "process_i18n": {"mapKey": "Inner"}, "locations": ["Locations"], "support_details": [{"type": "Type", "contact": "Contact", "response_wait_time": {"value": 5, "type": "Type"}, "availability": {"times": [{"day": 3, "start_time": "StartTime", "end_time": "EndTime"}], "timezone": "Timezone", "always_available": false}}], "support_escalation": {"escalation_wait_time": {"value": 5, "type": "Type"}, "response_wait_time": {"value": 5, "type": "Type"}, "contact": "Contact"}, "support_type": "SupportType"}, "media": [{"url": "URL", "api_url": "APIURL", "url_proxy": {"url": "URL", "sha": "Sha"}, "caption": "Caption", "caption_i18n": {"mapKey": "Inner"}, "type": "Type", "thumbnail_url": "ThumbnailURL"}], "deprecate_pending": {"deprecate_date": "2019-01-01T12:00:00.000Z", "deprecate_state": "DeprecateState", "description": "Description"}, "product_kind": "ProductKind", "badges": [{"id": "ID", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}, "icon": "Icon", "authority": "Authority", "tag": "Tag", "learn_more_links": {"first_party": "FirstParty", "third_party": "ThirdParty"}, "constraints": [{"type": "Type", "rule": "anyValue"}]}]}`) + })) + }) + It(`Invoke ReplaceOffering successfully`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := catalogManagementService.ReplaceOffering(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the Rating model + ratingModel := new(catalogmanagementv1.Rating) + ratingModel.OneStarCount = core.Int64Ptr(int64(38)) + ratingModel.TwoStarCount = core.Int64Ptr(int64(38)) + ratingModel.ThreeStarCount = core.Int64Ptr(int64(38)) + ratingModel.FourStarCount = core.Int64Ptr(int64(38)) + + // Construct an instance of the Feature model + featureModel := new(catalogmanagementv1.Feature) + featureModel.Title = core.StringPtr("testString") + featureModel.TitleI18n = make(map[string]string) + featureModel.Description = core.StringPtr("testString") + featureModel.DescriptionI18n = make(map[string]string) + + // Construct an instance of the Flavor model + flavorModel := new(catalogmanagementv1.Flavor) + flavorModel.Name = core.StringPtr("testString") + flavorModel.Label = core.StringPtr("testString") + flavorModel.LabelI18n = make(map[string]string) + flavorModel.Index = core.Int64Ptr(int64(38)) + + // Construct an instance of the RenderTypeAssociationsParametersItem model + renderTypeAssociationsParametersItemModel := new(catalogmanagementv1.RenderTypeAssociationsParametersItem) + renderTypeAssociationsParametersItemModel.Name = core.StringPtr("testString") + renderTypeAssociationsParametersItemModel.OptionsRefresh = core.BoolPtr(true) + + // Construct an instance of the RenderTypeAssociations model + renderTypeAssociationsModel := new(catalogmanagementv1.RenderTypeAssociations) + renderTypeAssociationsModel.Parameters = []catalogmanagementv1.RenderTypeAssociationsParametersItem{*renderTypeAssociationsParametersItemModel} + + // Construct an instance of the RenderType model + renderTypeModel := new(catalogmanagementv1.RenderType) + renderTypeModel.Type = core.StringPtr("testString") + renderTypeModel.Grouping = core.StringPtr("testString") + renderTypeModel.OriginalGrouping = core.StringPtr("testString") + renderTypeModel.GroupingIndex = core.Int64Ptr(int64(38)) + renderTypeModel.ConfigConstraints = map[string]interface{}{"anyKey": "anyValue"} + renderTypeModel.Associations = renderTypeAssociationsModel + + // Construct an instance of the Configuration model + configurationModel := new(catalogmanagementv1.Configuration) + configurationModel.Key = core.StringPtr("testString") + configurationModel.Type = core.StringPtr("testString") + configurationModel.DefaultValue = core.StringPtr("testString") + configurationModel.DisplayName = core.StringPtr("testString") + configurationModel.ValueConstraint = core.StringPtr("testString") + configurationModel.Description = core.StringPtr("testString") + configurationModel.Required = core.BoolPtr(true) + configurationModel.Options = []interface{}{"testString"} + configurationModel.Hidden = core.BoolPtr(true) + configurationModel.CustomConfig = renderTypeModel + configurationModel.TypeMetadata = core.StringPtr("testString") + + // Construct an instance of the Output model + outputModel := new(catalogmanagementv1.Output) + outputModel.Key = core.StringPtr("testString") + outputModel.Description = core.StringPtr("testString") + + // Construct an instance of the IamResource model + iamResourceModel := new(catalogmanagementv1.IamResource) + iamResourceModel.Name = core.StringPtr("testString") + iamResourceModel.Description = core.StringPtr("testString") + iamResourceModel.RoleCrns = []string{"testString"} + + // Construct an instance of the IamPermission model + iamPermissionModel := new(catalogmanagementv1.IamPermission) + iamPermissionModel.ServiceName = core.StringPtr("testString") + iamPermissionModel.RoleCrns = []string{"testString"} + iamPermissionModel.Resources = []catalogmanagementv1.IamResource{*iamResourceModel} + + // Construct an instance of the Validation model + validationModel := new(catalogmanagementv1.Validation) + validationModel.Validated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + validationModel.Requested = CreateMockDateTime("2019-01-01T12:00:00.000Z") + validationModel.State = core.StringPtr("testString") + validationModel.LastOperation = core.StringPtr("testString") + validationModel.Target = make(map[string]interface{}) + validationModel.Message = core.StringPtr("testString") + + // Construct an instance of the Resource model + resourceModel := new(catalogmanagementv1.Resource) + resourceModel.Type = core.StringPtr("mem") + resourceModel.Value = core.StringPtr("testString") + + // Construct an instance of the Script model + scriptModel := new(catalogmanagementv1.Script) + scriptModel.Instructions = core.StringPtr("testString") + scriptModel.InstructionsI18n = make(map[string]string) + scriptModel.Script = core.StringPtr("testString") + scriptModel.ScriptPermission = core.StringPtr("testString") + scriptModel.DeleteScript = core.StringPtr("testString") + scriptModel.Scope = core.StringPtr("testString") + + // Construct an instance of the VersionEntitlement model + versionEntitlementModel := new(catalogmanagementv1.VersionEntitlement) + versionEntitlementModel.ProviderName = core.StringPtr("testString") + versionEntitlementModel.ProviderID = core.StringPtr("testString") + versionEntitlementModel.ProductID = core.StringPtr("testString") + versionEntitlementModel.PartNumbers = []string{"testString"} + versionEntitlementModel.ImageRepoName = core.StringPtr("testString") + + // Construct an instance of the License model + licenseModel := new(catalogmanagementv1.License) + licenseModel.ID = core.StringPtr("testString") + licenseModel.Name = core.StringPtr("testString") + licenseModel.Type = core.StringPtr("testString") + licenseModel.URL = core.StringPtr("testString") + licenseModel.Description = core.StringPtr("testString") + + // Construct an instance of the State model + stateModel := new(catalogmanagementv1.State) + stateModel.Current = core.StringPtr("testString") + stateModel.CurrentEntered = CreateMockDateTime("2019-01-01T12:00:00.000Z") + stateModel.Pending = core.StringPtr("testString") + stateModel.PendingRequested = CreateMockDateTime("2019-01-01T12:00:00.000Z") + stateModel.Previous = core.StringPtr("testString") + + // Construct an instance of the DeprecatePending model + deprecatePendingModel := new(catalogmanagementv1.DeprecatePending) + deprecatePendingModel.DeprecateDate = CreateMockDateTime("2019-01-01T12:00:00.000Z") + deprecatePendingModel.DeprecateState = core.StringPtr("testString") + deprecatePendingModel.Description = core.StringPtr("testString") + + // Construct an instance of the URLProxy model + urlProxyModel := new(catalogmanagementv1.URLProxy) + urlProxyModel.URL = core.StringPtr("testString") + urlProxyModel.Sha = core.StringPtr("testString") + + // Construct an instance of the MediaItem model + mediaItemModel := new(catalogmanagementv1.MediaItem) + mediaItemModel.URL = core.StringPtr("testString") + mediaItemModel.APIURL = core.StringPtr("testString") + mediaItemModel.URLProxy = urlProxyModel + mediaItemModel.Caption = core.StringPtr("testString") + mediaItemModel.CaptionI18n = make(map[string]string) + mediaItemModel.Type = core.StringPtr("testString") + mediaItemModel.ThumbnailURL = core.StringPtr("testString") + + // Construct an instance of the ArchitectureDiagram model + architectureDiagramModel := new(catalogmanagementv1.ArchitectureDiagram) + architectureDiagramModel.Diagram = mediaItemModel + architectureDiagramModel.Description = core.StringPtr("testString") + architectureDiagramModel.DescriptionI18n = make(map[string]string) + + // Construct an instance of the CostComponent model + costComponentModel := new(catalogmanagementv1.CostComponent) + costComponentModel.Name = core.StringPtr("testString") + costComponentModel.Unit = core.StringPtr("testString") + costComponentModel.HourlyQuantity = core.StringPtr("testString") + costComponentModel.MonthlyQuantity = core.StringPtr("testString") + costComponentModel.Price = core.StringPtr("testString") + costComponentModel.HourlyCost = core.StringPtr("testString") + costComponentModel.MonthlyCost = core.StringPtr("testString") + + // Construct an instance of the CostResource model + costResourceModel := new(catalogmanagementv1.CostResource) + costResourceModel.Name = core.StringPtr("testString") + costResourceModel.Metadata = make(map[string]interface{}) + costResourceModel.HourlyCost = core.StringPtr("testString") + costResourceModel.MonthlyCost = core.StringPtr("testString") + costResourceModel.CostComponents = []catalogmanagementv1.CostComponent{*costComponentModel} + + // Construct an instance of the CostBreakdown model + costBreakdownModel := new(catalogmanagementv1.CostBreakdown) + costBreakdownModel.TotalHourlyCost = core.StringPtr("testString") + costBreakdownModel.TotalMonthlyCOst = core.StringPtr("testString") + costBreakdownModel.Resources = []catalogmanagementv1.CostResource{*costResourceModel} + + // Construct an instance of the CostSummary model + costSummaryModel := new(catalogmanagementv1.CostSummary) + costSummaryModel.TotalDetectedResources = core.Int64Ptr(int64(38)) + costSummaryModel.TotalSupportedResources = core.Int64Ptr(int64(38)) + costSummaryModel.TotalUnsupportedResources = core.Int64Ptr(int64(38)) + costSummaryModel.TotalUsageBasedResources = core.Int64Ptr(int64(38)) + costSummaryModel.TotalNoPriceResources = core.Int64Ptr(int64(38)) + costSummaryModel.UnsupportedResourceCounts = make(map[string]int64) + costSummaryModel.NoPriceResourceCounts = make(map[string]int64) + + // Construct an instance of the Project model + projectModel := new(catalogmanagementv1.Project) + projectModel.Name = core.StringPtr("testString") + projectModel.Metadata = make(map[string]interface{}) + projectModel.PastBreakdown = costBreakdownModel + projectModel.Breakdown = costBreakdownModel + projectModel.Diff = costBreakdownModel + projectModel.Summary = costSummaryModel + + // Construct an instance of the CostEstimate model + costEstimateModel := new(catalogmanagementv1.CostEstimate) + costEstimateModel.Version = core.StringPtr("testString") + costEstimateModel.Currency = core.StringPtr("testString") + costEstimateModel.Projects = []catalogmanagementv1.Project{*projectModel} + costEstimateModel.Summary = costSummaryModel + costEstimateModel.TotalHourlyCost = core.StringPtr("testString") + costEstimateModel.TotalMonthlyCost = core.StringPtr("testString") + costEstimateModel.PastTotalHourlyCost = core.StringPtr("testString") + costEstimateModel.PastTotalMonthlyCost = core.StringPtr("testString") + costEstimateModel.DiffTotalHourlyCost = core.StringPtr("testString") + costEstimateModel.DiffTotalMonthlyCost = core.StringPtr("testString") + costEstimateModel.TimeGenerated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + + // Construct an instance of the Dependency model + dependencyModel := new(catalogmanagementv1.Dependency) + dependencyModel.CatalogID = core.StringPtr("testString") + dependencyModel.ID = core.StringPtr("testString") + dependencyModel.Name = core.StringPtr("testString") + dependencyModel.Version = core.StringPtr("testString") + dependencyModel.Flavors = []string{"testString"} + + // Construct an instance of the SolutionInfo model + solutionInfoModel := new(catalogmanagementv1.SolutionInfo) + solutionInfoModel.ArchitectureDiagrams = []catalogmanagementv1.ArchitectureDiagram{*architectureDiagramModel} + solutionInfoModel.Features = []catalogmanagementv1.Feature{*featureModel} + solutionInfoModel.CostEstimate = costEstimateModel + solutionInfoModel.Dependencies = []catalogmanagementv1.Dependency{*dependencyModel} + + // Construct an instance of the Version model + versionModel := new(catalogmanagementv1.Version) + versionModel.ID = core.StringPtr("testString") + versionModel.Rev = core.StringPtr("testString") + versionModel.CRN = core.StringPtr("testString") + versionModel.Version = core.StringPtr("testString") + versionModel.Flavor = flavorModel + versionModel.Sha = core.StringPtr("testString") + versionModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + versionModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + versionModel.OfferingID = core.StringPtr("testString") + versionModel.CatalogID = core.StringPtr("testString") + versionModel.KindID = core.StringPtr("testString") + versionModel.Tags = []string{"testString"} + versionModel.RepoURL = core.StringPtr("testString") + versionModel.SourceURL = core.StringPtr("testString") + versionModel.TgzURL = core.StringPtr("testString") + versionModel.Configuration = []catalogmanagementv1.Configuration{*configurationModel} + versionModel.Outputs = []catalogmanagementv1.Output{*outputModel} + versionModel.IamPermissions = []catalogmanagementv1.IamPermission{*iamPermissionModel} + versionModel.Metadata = make(map[string]interface{}) + versionModel.Validation = validationModel + versionModel.RequiredResources = []catalogmanagementv1.Resource{*resourceModel} + versionModel.SingleInstance = core.BoolPtr(true) + versionModel.Install = scriptModel + versionModel.PreInstall = []catalogmanagementv1.Script{*scriptModel} + versionModel.Entitlement = versionEntitlementModel + versionModel.Licenses = []catalogmanagementv1.License{*licenseModel} + versionModel.ImageManifestURL = core.StringPtr("testString") + versionModel.Deprecated = core.BoolPtr(true) + versionModel.PackageVersion = core.StringPtr("testString") + versionModel.State = stateModel + versionModel.VersionLocator = core.StringPtr("testString") + versionModel.LongDescription = core.StringPtr("testString") + versionModel.LongDescriptionI18n = make(map[string]string) + versionModel.WhitelistedAccounts = []string{"testString"} + versionModel.ImagePullKeyName = core.StringPtr("testString") + versionModel.DeprecatePending = deprecatePendingModel + versionModel.SolutionInfo = solutionInfoModel + versionModel.IsConsumable = core.BoolPtr(true) + + // Construct an instance of the Deployment model + deploymentModel := new(catalogmanagementv1.Deployment) + deploymentModel.ID = core.StringPtr("testString") + deploymentModel.Label = core.StringPtr("testString") + deploymentModel.Name = core.StringPtr("testString") + deploymentModel.ShortDescription = core.StringPtr("testString") + deploymentModel.LongDescription = core.StringPtr("testString") + deploymentModel.Metadata = make(map[string]interface{}) + deploymentModel.Tags = []string{"testString"} + deploymentModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + deploymentModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + + // Construct an instance of the Plan model + planModel := new(catalogmanagementv1.Plan) + planModel.ID = core.StringPtr("testString") + planModel.Label = core.StringPtr("testString") + planModel.Name = core.StringPtr("testString") + planModel.ShortDescription = core.StringPtr("testString") + planModel.LongDescription = core.StringPtr("testString") + planModel.Metadata = make(map[string]interface{}) + planModel.Tags = []string{"testString"} + planModel.AdditionalFeatures = []catalogmanagementv1.Feature{*featureModel} + planModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + planModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + planModel.Deployments = []catalogmanagementv1.Deployment{*deploymentModel} + + // Construct an instance of the Kind model + kindModel := new(catalogmanagementv1.Kind) + kindModel.ID = core.StringPtr("testString") + kindModel.FormatKind = core.StringPtr("testString") + kindModel.InstallKind = core.StringPtr("testString") + kindModel.TargetKind = core.StringPtr("testString") + kindModel.Metadata = make(map[string]interface{}) + kindModel.Tags = []string{"testString"} + kindModel.AdditionalFeatures = []catalogmanagementv1.Feature{*featureModel} + kindModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + kindModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + kindModel.Versions = []catalogmanagementv1.Version{*versionModel} + kindModel.Plans = []catalogmanagementv1.Plan{*planModel} + + // Construct an instance of the ProviderInfo model + providerInfoModel := new(catalogmanagementv1.ProviderInfo) + providerInfoModel.ID = core.StringPtr("testString") + providerInfoModel.Name = core.StringPtr("testString") + + // Construct an instance of the RepoInfo model + repoInfoModel := new(catalogmanagementv1.RepoInfo) + repoInfoModel.Token = core.StringPtr("testString") + repoInfoModel.Type = core.StringPtr("testString") + + // Construct an instance of the ImagePullKey model + imagePullKeyModel := new(catalogmanagementv1.ImagePullKey) + imagePullKeyModel.Name = core.StringPtr("testString") + imagePullKeyModel.Value = core.StringPtr("testString") + imagePullKeyModel.Description = core.StringPtr("testString") + + // Construct an instance of the SupportWaitTime model + supportWaitTimeModel := new(catalogmanagementv1.SupportWaitTime) + supportWaitTimeModel.Value = core.Int64Ptr(int64(38)) + supportWaitTimeModel.Type = core.StringPtr("testString") + + // Construct an instance of the SupportTime model + supportTimeModel := new(catalogmanagementv1.SupportTime) + supportTimeModel.Day = core.Int64Ptr(int64(38)) + supportTimeModel.StartTime = core.StringPtr("testString") + supportTimeModel.EndTime = core.StringPtr("testString") + + // Construct an instance of the SupportAvailability model + supportAvailabilityModel := new(catalogmanagementv1.SupportAvailability) + supportAvailabilityModel.Times = []catalogmanagementv1.SupportTime{*supportTimeModel} + supportAvailabilityModel.Timezone = core.StringPtr("testString") + supportAvailabilityModel.AlwaysAvailable = core.BoolPtr(true) + + // Construct an instance of the SupportDetail model + supportDetailModel := new(catalogmanagementv1.SupportDetail) + supportDetailModel.Type = core.StringPtr("testString") + supportDetailModel.Contact = core.StringPtr("testString") + supportDetailModel.ResponseWaitTime = supportWaitTimeModel + supportDetailModel.Availability = supportAvailabilityModel + + // Construct an instance of the SupportEscalation model + supportEscalationModel := new(catalogmanagementv1.SupportEscalation) + supportEscalationModel.EscalationWaitTime = supportWaitTimeModel + supportEscalationModel.ResponseWaitTime = supportWaitTimeModel + supportEscalationModel.Contact = core.StringPtr("testString") + + // Construct an instance of the Support model + supportModel := new(catalogmanagementv1.Support) + supportModel.URL = core.StringPtr("testString") + supportModel.Process = core.StringPtr("testString") + supportModel.ProcessI18n = make(map[string]string) + supportModel.Locations = []string{"testString"} + supportModel.SupportDetails = []catalogmanagementv1.SupportDetail{*supportDetailModel} + supportModel.SupportEscalation = supportEscalationModel + supportModel.SupportType = core.StringPtr("testString") + + // Construct an instance of the LearnMoreLinks model + learnMoreLinksModel := new(catalogmanagementv1.LearnMoreLinks) + learnMoreLinksModel.FirstParty = core.StringPtr("testString") + learnMoreLinksModel.ThirdParty = core.StringPtr("testString") + + // Construct an instance of the Constraint model + constraintModel := new(catalogmanagementv1.Constraint) + constraintModel.Type = core.StringPtr("testString") + constraintModel.Rule = core.StringPtr("testString") + + // Construct an instance of the Badge model + badgeModel := new(catalogmanagementv1.Badge) + badgeModel.ID = core.StringPtr("testString") + badgeModel.Label = core.StringPtr("testString") + badgeModel.LabelI18n = make(map[string]string) + badgeModel.Description = core.StringPtr("testString") + badgeModel.DescriptionI18n = make(map[string]string) + badgeModel.Icon = core.StringPtr("testString") + badgeModel.Authority = core.StringPtr("testString") + badgeModel.Tag = core.StringPtr("testString") + badgeModel.LearnMoreLinks = learnMoreLinksModel + badgeModel.Constraints = []catalogmanagementv1.Constraint{*constraintModel} + + // Construct an instance of the ReplaceOfferingOptions model + replaceOfferingOptionsModel := new(catalogmanagementv1.ReplaceOfferingOptions) + replaceOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") + replaceOfferingOptionsModel.OfferingID = core.StringPtr("testString") + replaceOfferingOptionsModel.ID = core.StringPtr("testString") + replaceOfferingOptionsModel.Rev = core.StringPtr("testString") + replaceOfferingOptionsModel.URL = core.StringPtr("testString") + replaceOfferingOptionsModel.CRN = core.StringPtr("testString") + replaceOfferingOptionsModel.Label = core.StringPtr("testString") + replaceOfferingOptionsModel.LabelI18n = make(map[string]string) + replaceOfferingOptionsModel.Name = core.StringPtr("testString") + replaceOfferingOptionsModel.OfferingIconURL = core.StringPtr("testString") + replaceOfferingOptionsModel.OfferingDocsURL = core.StringPtr("testString") + replaceOfferingOptionsModel.OfferingSupportURL = core.StringPtr("testString") + replaceOfferingOptionsModel.Tags = []string{"testString"} + replaceOfferingOptionsModel.Keywords = []string{"testString"} + replaceOfferingOptionsModel.Rating = ratingModel + replaceOfferingOptionsModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + replaceOfferingOptionsModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + replaceOfferingOptionsModel.ShortDescription = core.StringPtr("testString") + replaceOfferingOptionsModel.ShortDescriptionI18n = make(map[string]string) + replaceOfferingOptionsModel.LongDescription = core.StringPtr("testString") + replaceOfferingOptionsModel.LongDescriptionI18n = make(map[string]string) + replaceOfferingOptionsModel.Features = []catalogmanagementv1.Feature{*featureModel} + replaceOfferingOptionsModel.Kinds = []catalogmanagementv1.Kind{*kindModel} + replaceOfferingOptionsModel.PcManaged = core.BoolPtr(true) + replaceOfferingOptionsModel.PublishApproved = core.BoolPtr(true) + replaceOfferingOptionsModel.ShareWithAll = core.BoolPtr(true) + replaceOfferingOptionsModel.ShareWithIBM = core.BoolPtr(true) + replaceOfferingOptionsModel.ShareEnabled = core.BoolPtr(true) + replaceOfferingOptionsModel.PermitRequestIBMPublicPublish = core.BoolPtr(true) + replaceOfferingOptionsModel.IBMPublishApproved = core.BoolPtr(true) + replaceOfferingOptionsModel.PublicPublishApproved = core.BoolPtr(true) + replaceOfferingOptionsModel.PublicOriginalCRN = core.StringPtr("testString") + replaceOfferingOptionsModel.PublishPublicCRN = core.StringPtr("testString") + replaceOfferingOptionsModel.PortalApprovalRecord = core.StringPtr("testString") + replaceOfferingOptionsModel.PortalUIURL = core.StringPtr("testString") + replaceOfferingOptionsModel.CatalogID = core.StringPtr("testString") + replaceOfferingOptionsModel.CatalogName = core.StringPtr("testString") + replaceOfferingOptionsModel.Metadata = make(map[string]interface{}) + replaceOfferingOptionsModel.Disclaimer = core.StringPtr("testString") + replaceOfferingOptionsModel.Hidden = core.BoolPtr(true) + replaceOfferingOptionsModel.Provider = core.StringPtr("testString") + replaceOfferingOptionsModel.ProviderInfo = providerInfoModel + replaceOfferingOptionsModel.RepoInfo = repoInfoModel + replaceOfferingOptionsModel.ImagePullKeys = []catalogmanagementv1.ImagePullKey{*imagePullKeyModel} + replaceOfferingOptionsModel.Support = supportModel + replaceOfferingOptionsModel.Media = []catalogmanagementv1.MediaItem{*mediaItemModel} + replaceOfferingOptionsModel.DeprecatePending = deprecatePendingModel + replaceOfferingOptionsModel.ProductKind = core.StringPtr("testString") + replaceOfferingOptionsModel.Badges = []catalogmanagementv1.Badge{*badgeModel} + replaceOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = catalogManagementService.ReplaceOffering(replaceOfferingOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ReplaceOffering with error: Operation validation and request error`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Construct an instance of the Rating model + ratingModel := new(catalogmanagementv1.Rating) + ratingModel.OneStarCount = core.Int64Ptr(int64(38)) + ratingModel.TwoStarCount = core.Int64Ptr(int64(38)) + ratingModel.ThreeStarCount = core.Int64Ptr(int64(38)) + ratingModel.FourStarCount = core.Int64Ptr(int64(38)) + + // Construct an instance of the Feature model + featureModel := new(catalogmanagementv1.Feature) + featureModel.Title = core.StringPtr("testString") + featureModel.TitleI18n = make(map[string]string) + featureModel.Description = core.StringPtr("testString") + featureModel.DescriptionI18n = make(map[string]string) + + // Construct an instance of the Flavor model + flavorModel := new(catalogmanagementv1.Flavor) + flavorModel.Name = core.StringPtr("testString") + flavorModel.Label = core.StringPtr("testString") + flavorModel.LabelI18n = make(map[string]string) + flavorModel.Index = core.Int64Ptr(int64(38)) + + // Construct an instance of the RenderTypeAssociationsParametersItem model + renderTypeAssociationsParametersItemModel := new(catalogmanagementv1.RenderTypeAssociationsParametersItem) + renderTypeAssociationsParametersItemModel.Name = core.StringPtr("testString") + renderTypeAssociationsParametersItemModel.OptionsRefresh = core.BoolPtr(true) + + // Construct an instance of the RenderTypeAssociations model + renderTypeAssociationsModel := new(catalogmanagementv1.RenderTypeAssociations) + renderTypeAssociationsModel.Parameters = []catalogmanagementv1.RenderTypeAssociationsParametersItem{*renderTypeAssociationsParametersItemModel} + + // Construct an instance of the RenderType model + renderTypeModel := new(catalogmanagementv1.RenderType) + renderTypeModel.Type = core.StringPtr("testString") + renderTypeModel.Grouping = core.StringPtr("testString") + renderTypeModel.OriginalGrouping = core.StringPtr("testString") + renderTypeModel.GroupingIndex = core.Int64Ptr(int64(38)) + renderTypeModel.ConfigConstraints = map[string]interface{}{"anyKey": "anyValue"} + renderTypeModel.Associations = renderTypeAssociationsModel + + // Construct an instance of the Configuration model + configurationModel := new(catalogmanagementv1.Configuration) + configurationModel.Key = core.StringPtr("testString") + configurationModel.Type = core.StringPtr("testString") + configurationModel.DefaultValue = core.StringPtr("testString") + configurationModel.DisplayName = core.StringPtr("testString") + configurationModel.ValueConstraint = core.StringPtr("testString") + configurationModel.Description = core.StringPtr("testString") + configurationModel.Required = core.BoolPtr(true) + configurationModel.Options = []interface{}{"testString"} + configurationModel.Hidden = core.BoolPtr(true) + configurationModel.CustomConfig = renderTypeModel + configurationModel.TypeMetadata = core.StringPtr("testString") + + // Construct an instance of the Output model + outputModel := new(catalogmanagementv1.Output) + outputModel.Key = core.StringPtr("testString") + outputModel.Description = core.StringPtr("testString") + + // Construct an instance of the IamResource model + iamResourceModel := new(catalogmanagementv1.IamResource) + iamResourceModel.Name = core.StringPtr("testString") + iamResourceModel.Description = core.StringPtr("testString") + iamResourceModel.RoleCrns = []string{"testString"} + + // Construct an instance of the IamPermission model + iamPermissionModel := new(catalogmanagementv1.IamPermission) + iamPermissionModel.ServiceName = core.StringPtr("testString") + iamPermissionModel.RoleCrns = []string{"testString"} + iamPermissionModel.Resources = []catalogmanagementv1.IamResource{*iamResourceModel} + + // Construct an instance of the Validation model + validationModel := new(catalogmanagementv1.Validation) + validationModel.Validated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + validationModel.Requested = CreateMockDateTime("2019-01-01T12:00:00.000Z") + validationModel.State = core.StringPtr("testString") + validationModel.LastOperation = core.StringPtr("testString") + validationModel.Target = make(map[string]interface{}) + validationModel.Message = core.StringPtr("testString") + + // Construct an instance of the Resource model + resourceModel := new(catalogmanagementv1.Resource) + resourceModel.Type = core.StringPtr("mem") + resourceModel.Value = core.StringPtr("testString") + + // Construct an instance of the Script model + scriptModel := new(catalogmanagementv1.Script) + scriptModel.Instructions = core.StringPtr("testString") + scriptModel.InstructionsI18n = make(map[string]string) + scriptModel.Script = core.StringPtr("testString") + scriptModel.ScriptPermission = core.StringPtr("testString") + scriptModel.DeleteScript = core.StringPtr("testString") + scriptModel.Scope = core.StringPtr("testString") + + // Construct an instance of the VersionEntitlement model + versionEntitlementModel := new(catalogmanagementv1.VersionEntitlement) + versionEntitlementModel.ProviderName = core.StringPtr("testString") + versionEntitlementModel.ProviderID = core.StringPtr("testString") + versionEntitlementModel.ProductID = core.StringPtr("testString") + versionEntitlementModel.PartNumbers = []string{"testString"} + versionEntitlementModel.ImageRepoName = core.StringPtr("testString") + + // Construct an instance of the License model + licenseModel := new(catalogmanagementv1.License) + licenseModel.ID = core.StringPtr("testString") + licenseModel.Name = core.StringPtr("testString") + licenseModel.Type = core.StringPtr("testString") + licenseModel.URL = core.StringPtr("testString") + licenseModel.Description = core.StringPtr("testString") + + // Construct an instance of the State model + stateModel := new(catalogmanagementv1.State) + stateModel.Current = core.StringPtr("testString") + stateModel.CurrentEntered = CreateMockDateTime("2019-01-01T12:00:00.000Z") + stateModel.Pending = core.StringPtr("testString") + stateModel.PendingRequested = CreateMockDateTime("2019-01-01T12:00:00.000Z") + stateModel.Previous = core.StringPtr("testString") + + // Construct an instance of the DeprecatePending model + deprecatePendingModel := new(catalogmanagementv1.DeprecatePending) + deprecatePendingModel.DeprecateDate = CreateMockDateTime("2019-01-01T12:00:00.000Z") + deprecatePendingModel.DeprecateState = core.StringPtr("testString") + deprecatePendingModel.Description = core.StringPtr("testString") + + // Construct an instance of the URLProxy model + urlProxyModel := new(catalogmanagementv1.URLProxy) + urlProxyModel.URL = core.StringPtr("testString") + urlProxyModel.Sha = core.StringPtr("testString") + + // Construct an instance of the MediaItem model + mediaItemModel := new(catalogmanagementv1.MediaItem) + mediaItemModel.URL = core.StringPtr("testString") + mediaItemModel.APIURL = core.StringPtr("testString") + mediaItemModel.URLProxy = urlProxyModel + mediaItemModel.Caption = core.StringPtr("testString") + mediaItemModel.CaptionI18n = make(map[string]string) + mediaItemModel.Type = core.StringPtr("testString") + mediaItemModel.ThumbnailURL = core.StringPtr("testString") + + // Construct an instance of the ArchitectureDiagram model + architectureDiagramModel := new(catalogmanagementv1.ArchitectureDiagram) + architectureDiagramModel.Diagram = mediaItemModel + architectureDiagramModel.Description = core.StringPtr("testString") + architectureDiagramModel.DescriptionI18n = make(map[string]string) + + // Construct an instance of the CostComponent model + costComponentModel := new(catalogmanagementv1.CostComponent) + costComponentModel.Name = core.StringPtr("testString") + costComponentModel.Unit = core.StringPtr("testString") + costComponentModel.HourlyQuantity = core.StringPtr("testString") + costComponentModel.MonthlyQuantity = core.StringPtr("testString") + costComponentModel.Price = core.StringPtr("testString") + costComponentModel.HourlyCost = core.StringPtr("testString") + costComponentModel.MonthlyCost = core.StringPtr("testString") + + // Construct an instance of the CostResource model + costResourceModel := new(catalogmanagementv1.CostResource) + costResourceModel.Name = core.StringPtr("testString") + costResourceModel.Metadata = make(map[string]interface{}) + costResourceModel.HourlyCost = core.StringPtr("testString") + costResourceModel.MonthlyCost = core.StringPtr("testString") + costResourceModel.CostComponents = []catalogmanagementv1.CostComponent{*costComponentModel} + + // Construct an instance of the CostBreakdown model + costBreakdownModel := new(catalogmanagementv1.CostBreakdown) + costBreakdownModel.TotalHourlyCost = core.StringPtr("testString") + costBreakdownModel.TotalMonthlyCOst = core.StringPtr("testString") + costBreakdownModel.Resources = []catalogmanagementv1.CostResource{*costResourceModel} + + // Construct an instance of the CostSummary model + costSummaryModel := new(catalogmanagementv1.CostSummary) + costSummaryModel.TotalDetectedResources = core.Int64Ptr(int64(38)) + costSummaryModel.TotalSupportedResources = core.Int64Ptr(int64(38)) + costSummaryModel.TotalUnsupportedResources = core.Int64Ptr(int64(38)) + costSummaryModel.TotalUsageBasedResources = core.Int64Ptr(int64(38)) + costSummaryModel.TotalNoPriceResources = core.Int64Ptr(int64(38)) + costSummaryModel.UnsupportedResourceCounts = make(map[string]int64) + costSummaryModel.NoPriceResourceCounts = make(map[string]int64) + + // Construct an instance of the Project model + projectModel := new(catalogmanagementv1.Project) + projectModel.Name = core.StringPtr("testString") + projectModel.Metadata = make(map[string]interface{}) + projectModel.PastBreakdown = costBreakdownModel + projectModel.Breakdown = costBreakdownModel + projectModel.Diff = costBreakdownModel + projectModel.Summary = costSummaryModel + + // Construct an instance of the CostEstimate model + costEstimateModel := new(catalogmanagementv1.CostEstimate) + costEstimateModel.Version = core.StringPtr("testString") + costEstimateModel.Currency = core.StringPtr("testString") + costEstimateModel.Projects = []catalogmanagementv1.Project{*projectModel} + costEstimateModel.Summary = costSummaryModel + costEstimateModel.TotalHourlyCost = core.StringPtr("testString") + costEstimateModel.TotalMonthlyCost = core.StringPtr("testString") + costEstimateModel.PastTotalHourlyCost = core.StringPtr("testString") + costEstimateModel.PastTotalMonthlyCost = core.StringPtr("testString") + costEstimateModel.DiffTotalHourlyCost = core.StringPtr("testString") + costEstimateModel.DiffTotalMonthlyCost = core.StringPtr("testString") + costEstimateModel.TimeGenerated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + + // Construct an instance of the Dependency model + dependencyModel := new(catalogmanagementv1.Dependency) + dependencyModel.CatalogID = core.StringPtr("testString") + dependencyModel.ID = core.StringPtr("testString") + dependencyModel.Name = core.StringPtr("testString") + dependencyModel.Version = core.StringPtr("testString") + dependencyModel.Flavors = []string{"testString"} + + // Construct an instance of the SolutionInfo model + solutionInfoModel := new(catalogmanagementv1.SolutionInfo) + solutionInfoModel.ArchitectureDiagrams = []catalogmanagementv1.ArchitectureDiagram{*architectureDiagramModel} + solutionInfoModel.Features = []catalogmanagementv1.Feature{*featureModel} + solutionInfoModel.CostEstimate = costEstimateModel + solutionInfoModel.Dependencies = []catalogmanagementv1.Dependency{*dependencyModel} + + // Construct an instance of the Version model + versionModel := new(catalogmanagementv1.Version) + versionModel.ID = core.StringPtr("testString") + versionModel.Rev = core.StringPtr("testString") + versionModel.CRN = core.StringPtr("testString") + versionModel.Version = core.StringPtr("testString") + versionModel.Flavor = flavorModel + versionModel.Sha = core.StringPtr("testString") + versionModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + versionModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + versionModel.OfferingID = core.StringPtr("testString") + versionModel.CatalogID = core.StringPtr("testString") + versionModel.KindID = core.StringPtr("testString") + versionModel.Tags = []string{"testString"} + versionModel.RepoURL = core.StringPtr("testString") + versionModel.SourceURL = core.StringPtr("testString") + versionModel.TgzURL = core.StringPtr("testString") + versionModel.Configuration = []catalogmanagementv1.Configuration{*configurationModel} + versionModel.Outputs = []catalogmanagementv1.Output{*outputModel} + versionModel.IamPermissions = []catalogmanagementv1.IamPermission{*iamPermissionModel} + versionModel.Metadata = make(map[string]interface{}) + versionModel.Validation = validationModel + versionModel.RequiredResources = []catalogmanagementv1.Resource{*resourceModel} + versionModel.SingleInstance = core.BoolPtr(true) + versionModel.Install = scriptModel + versionModel.PreInstall = []catalogmanagementv1.Script{*scriptModel} + versionModel.Entitlement = versionEntitlementModel + versionModel.Licenses = []catalogmanagementv1.License{*licenseModel} + versionModel.ImageManifestURL = core.StringPtr("testString") + versionModel.Deprecated = core.BoolPtr(true) + versionModel.PackageVersion = core.StringPtr("testString") + versionModel.State = stateModel + versionModel.VersionLocator = core.StringPtr("testString") + versionModel.LongDescription = core.StringPtr("testString") + versionModel.LongDescriptionI18n = make(map[string]string) + versionModel.WhitelistedAccounts = []string{"testString"} + versionModel.ImagePullKeyName = core.StringPtr("testString") + versionModel.DeprecatePending = deprecatePendingModel + versionModel.SolutionInfo = solutionInfoModel + versionModel.IsConsumable = core.BoolPtr(true) + + // Construct an instance of the Deployment model + deploymentModel := new(catalogmanagementv1.Deployment) + deploymentModel.ID = core.StringPtr("testString") + deploymentModel.Label = core.StringPtr("testString") + deploymentModel.Name = core.StringPtr("testString") + deploymentModel.ShortDescription = core.StringPtr("testString") + deploymentModel.LongDescription = core.StringPtr("testString") + deploymentModel.Metadata = make(map[string]interface{}) + deploymentModel.Tags = []string{"testString"} + deploymentModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + deploymentModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + + // Construct an instance of the Plan model + planModel := new(catalogmanagementv1.Plan) + planModel.ID = core.StringPtr("testString") + planModel.Label = core.StringPtr("testString") + planModel.Name = core.StringPtr("testString") + planModel.ShortDescription = core.StringPtr("testString") + planModel.LongDescription = core.StringPtr("testString") + planModel.Metadata = make(map[string]interface{}) + planModel.Tags = []string{"testString"} + planModel.AdditionalFeatures = []catalogmanagementv1.Feature{*featureModel} + planModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + planModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + planModel.Deployments = []catalogmanagementv1.Deployment{*deploymentModel} + + // Construct an instance of the Kind model + kindModel := new(catalogmanagementv1.Kind) + kindModel.ID = core.StringPtr("testString") + kindModel.FormatKind = core.StringPtr("testString") + kindModel.InstallKind = core.StringPtr("testString") + kindModel.TargetKind = core.StringPtr("testString") + kindModel.Metadata = make(map[string]interface{}) + kindModel.Tags = []string{"testString"} + kindModel.AdditionalFeatures = []catalogmanagementv1.Feature{*featureModel} + kindModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + kindModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + kindModel.Versions = []catalogmanagementv1.Version{*versionModel} + kindModel.Plans = []catalogmanagementv1.Plan{*planModel} + + // Construct an instance of the ProviderInfo model + providerInfoModel := new(catalogmanagementv1.ProviderInfo) + providerInfoModel.ID = core.StringPtr("testString") + providerInfoModel.Name = core.StringPtr("testString") + + // Construct an instance of the RepoInfo model + repoInfoModel := new(catalogmanagementv1.RepoInfo) + repoInfoModel.Token = core.StringPtr("testString") + repoInfoModel.Type = core.StringPtr("testString") + + // Construct an instance of the ImagePullKey model + imagePullKeyModel := new(catalogmanagementv1.ImagePullKey) + imagePullKeyModel.Name = core.StringPtr("testString") + imagePullKeyModel.Value = core.StringPtr("testString") + imagePullKeyModel.Description = core.StringPtr("testString") + + // Construct an instance of the SupportWaitTime model + supportWaitTimeModel := new(catalogmanagementv1.SupportWaitTime) + supportWaitTimeModel.Value = core.Int64Ptr(int64(38)) + supportWaitTimeModel.Type = core.StringPtr("testString") + + // Construct an instance of the SupportTime model + supportTimeModel := new(catalogmanagementv1.SupportTime) + supportTimeModel.Day = core.Int64Ptr(int64(38)) + supportTimeModel.StartTime = core.StringPtr("testString") + supportTimeModel.EndTime = core.StringPtr("testString") + + // Construct an instance of the SupportAvailability model + supportAvailabilityModel := new(catalogmanagementv1.SupportAvailability) + supportAvailabilityModel.Times = []catalogmanagementv1.SupportTime{*supportTimeModel} + supportAvailabilityModel.Timezone = core.StringPtr("testString") + supportAvailabilityModel.AlwaysAvailable = core.BoolPtr(true) + + // Construct an instance of the SupportDetail model + supportDetailModel := new(catalogmanagementv1.SupportDetail) + supportDetailModel.Type = core.StringPtr("testString") + supportDetailModel.Contact = core.StringPtr("testString") + supportDetailModel.ResponseWaitTime = supportWaitTimeModel + supportDetailModel.Availability = supportAvailabilityModel + + // Construct an instance of the SupportEscalation model + supportEscalationModel := new(catalogmanagementv1.SupportEscalation) + supportEscalationModel.EscalationWaitTime = supportWaitTimeModel + supportEscalationModel.ResponseWaitTime = supportWaitTimeModel + supportEscalationModel.Contact = core.StringPtr("testString") + + // Construct an instance of the Support model + supportModel := new(catalogmanagementv1.Support) + supportModel.URL = core.StringPtr("testString") + supportModel.Process = core.StringPtr("testString") + supportModel.ProcessI18n = make(map[string]string) + supportModel.Locations = []string{"testString"} + supportModel.SupportDetails = []catalogmanagementv1.SupportDetail{*supportDetailModel} + supportModel.SupportEscalation = supportEscalationModel + supportModel.SupportType = core.StringPtr("testString") + + // Construct an instance of the LearnMoreLinks model + learnMoreLinksModel := new(catalogmanagementv1.LearnMoreLinks) + learnMoreLinksModel.FirstParty = core.StringPtr("testString") + learnMoreLinksModel.ThirdParty = core.StringPtr("testString") + + // Construct an instance of the Constraint model + constraintModel := new(catalogmanagementv1.Constraint) + constraintModel.Type = core.StringPtr("testString") + constraintModel.Rule = core.StringPtr("testString") + + // Construct an instance of the Badge model + badgeModel := new(catalogmanagementv1.Badge) + badgeModel.ID = core.StringPtr("testString") + badgeModel.Label = core.StringPtr("testString") + badgeModel.LabelI18n = make(map[string]string) + badgeModel.Description = core.StringPtr("testString") + badgeModel.DescriptionI18n = make(map[string]string) + badgeModel.Icon = core.StringPtr("testString") + badgeModel.Authority = core.StringPtr("testString") + badgeModel.Tag = core.StringPtr("testString") + badgeModel.LearnMoreLinks = learnMoreLinksModel + badgeModel.Constraints = []catalogmanagementv1.Constraint{*constraintModel} + + // Construct an instance of the ReplaceOfferingOptions model + replaceOfferingOptionsModel := new(catalogmanagementv1.ReplaceOfferingOptions) + replaceOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") + replaceOfferingOptionsModel.OfferingID = core.StringPtr("testString") + replaceOfferingOptionsModel.ID = core.StringPtr("testString") + replaceOfferingOptionsModel.Rev = core.StringPtr("testString") + replaceOfferingOptionsModel.URL = core.StringPtr("testString") + replaceOfferingOptionsModel.CRN = core.StringPtr("testString") + replaceOfferingOptionsModel.Label = core.StringPtr("testString") + replaceOfferingOptionsModel.LabelI18n = make(map[string]string) + replaceOfferingOptionsModel.Name = core.StringPtr("testString") + replaceOfferingOptionsModel.OfferingIconURL = core.StringPtr("testString") + replaceOfferingOptionsModel.OfferingDocsURL = core.StringPtr("testString") + replaceOfferingOptionsModel.OfferingSupportURL = core.StringPtr("testString") + replaceOfferingOptionsModel.Tags = []string{"testString"} + replaceOfferingOptionsModel.Keywords = []string{"testString"} + replaceOfferingOptionsModel.Rating = ratingModel + replaceOfferingOptionsModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + replaceOfferingOptionsModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + replaceOfferingOptionsModel.ShortDescription = core.StringPtr("testString") + replaceOfferingOptionsModel.ShortDescriptionI18n = make(map[string]string) + replaceOfferingOptionsModel.LongDescription = core.StringPtr("testString") + replaceOfferingOptionsModel.LongDescriptionI18n = make(map[string]string) + replaceOfferingOptionsModel.Features = []catalogmanagementv1.Feature{*featureModel} + replaceOfferingOptionsModel.Kinds = []catalogmanagementv1.Kind{*kindModel} + replaceOfferingOptionsModel.PcManaged = core.BoolPtr(true) + replaceOfferingOptionsModel.PublishApproved = core.BoolPtr(true) + replaceOfferingOptionsModel.ShareWithAll = core.BoolPtr(true) + replaceOfferingOptionsModel.ShareWithIBM = core.BoolPtr(true) + replaceOfferingOptionsModel.ShareEnabled = core.BoolPtr(true) + replaceOfferingOptionsModel.PermitRequestIBMPublicPublish = core.BoolPtr(true) + replaceOfferingOptionsModel.IBMPublishApproved = core.BoolPtr(true) + replaceOfferingOptionsModel.PublicPublishApproved = core.BoolPtr(true) + replaceOfferingOptionsModel.PublicOriginalCRN = core.StringPtr("testString") + replaceOfferingOptionsModel.PublishPublicCRN = core.StringPtr("testString") + replaceOfferingOptionsModel.PortalApprovalRecord = core.StringPtr("testString") + replaceOfferingOptionsModel.PortalUIURL = core.StringPtr("testString") + replaceOfferingOptionsModel.CatalogID = core.StringPtr("testString") + replaceOfferingOptionsModel.CatalogName = core.StringPtr("testString") + replaceOfferingOptionsModel.Metadata = make(map[string]interface{}) + replaceOfferingOptionsModel.Disclaimer = core.StringPtr("testString") + replaceOfferingOptionsModel.Hidden = core.BoolPtr(true) + replaceOfferingOptionsModel.Provider = core.StringPtr("testString") + replaceOfferingOptionsModel.ProviderInfo = providerInfoModel + replaceOfferingOptionsModel.RepoInfo = repoInfoModel + replaceOfferingOptionsModel.ImagePullKeys = []catalogmanagementv1.ImagePullKey{*imagePullKeyModel} + replaceOfferingOptionsModel.Support = supportModel + replaceOfferingOptionsModel.Media = []catalogmanagementv1.MediaItem{*mediaItemModel} + replaceOfferingOptionsModel.DeprecatePending = deprecatePendingModel + replaceOfferingOptionsModel.ProductKind = core.StringPtr("testString") + replaceOfferingOptionsModel.Badges = []catalogmanagementv1.Badge{*badgeModel} + replaceOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := catalogManagementService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := catalogManagementService.ReplaceOffering(replaceOfferingOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the ReplaceOfferingOptions model with no property values + replaceOfferingOptionsModelNew := new(catalogmanagementv1.ReplaceOfferingOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = catalogManagementService.ReplaceOffering(replaceOfferingOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke ReplaceOffering successfully`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Construct an instance of the Rating model + ratingModel := new(catalogmanagementv1.Rating) + ratingModel.OneStarCount = core.Int64Ptr(int64(38)) + ratingModel.TwoStarCount = core.Int64Ptr(int64(38)) + ratingModel.ThreeStarCount = core.Int64Ptr(int64(38)) + ratingModel.FourStarCount = core.Int64Ptr(int64(38)) + + // Construct an instance of the Feature model + featureModel := new(catalogmanagementv1.Feature) + featureModel.Title = core.StringPtr("testString") + featureModel.TitleI18n = make(map[string]string) + featureModel.Description = core.StringPtr("testString") + featureModel.DescriptionI18n = make(map[string]string) + + // Construct an instance of the Flavor model + flavorModel := new(catalogmanagementv1.Flavor) + flavorModel.Name = core.StringPtr("testString") + flavorModel.Label = core.StringPtr("testString") + flavorModel.LabelI18n = make(map[string]string) + flavorModel.Index = core.Int64Ptr(int64(38)) + + // Construct an instance of the RenderTypeAssociationsParametersItem model + renderTypeAssociationsParametersItemModel := new(catalogmanagementv1.RenderTypeAssociationsParametersItem) + renderTypeAssociationsParametersItemModel.Name = core.StringPtr("testString") + renderTypeAssociationsParametersItemModel.OptionsRefresh = core.BoolPtr(true) + + // Construct an instance of the RenderTypeAssociations model + renderTypeAssociationsModel := new(catalogmanagementv1.RenderTypeAssociations) + renderTypeAssociationsModel.Parameters = []catalogmanagementv1.RenderTypeAssociationsParametersItem{*renderTypeAssociationsParametersItemModel} + + // Construct an instance of the RenderType model + renderTypeModel := new(catalogmanagementv1.RenderType) + renderTypeModel.Type = core.StringPtr("testString") + renderTypeModel.Grouping = core.StringPtr("testString") + renderTypeModel.OriginalGrouping = core.StringPtr("testString") + renderTypeModel.GroupingIndex = core.Int64Ptr(int64(38)) + renderTypeModel.ConfigConstraints = map[string]interface{}{"anyKey": "anyValue"} + renderTypeModel.Associations = renderTypeAssociationsModel + + // Construct an instance of the Configuration model + configurationModel := new(catalogmanagementv1.Configuration) + configurationModel.Key = core.StringPtr("testString") + configurationModel.Type = core.StringPtr("testString") + configurationModel.DefaultValue = core.StringPtr("testString") + configurationModel.DisplayName = core.StringPtr("testString") + configurationModel.ValueConstraint = core.StringPtr("testString") + configurationModel.Description = core.StringPtr("testString") configurationModel.Required = core.BoolPtr(true) configurationModel.Options = []interface{}{"testString"} configurationModel.Hidden = core.BoolPtr(true) + configurationModel.CustomConfig = renderTypeModel + configurationModel.TypeMetadata = core.StringPtr("testString") + + // Construct an instance of the Output model + outputModel := new(catalogmanagementv1.Output) + outputModel.Key = core.StringPtr("testString") + outputModel.Description = core.StringPtr("testString") + + // Construct an instance of the IamResource model + iamResourceModel := new(catalogmanagementv1.IamResource) + iamResourceModel.Name = core.StringPtr("testString") + iamResourceModel.Description = core.StringPtr("testString") + iamResourceModel.RoleCrns = []string{"testString"} + + // Construct an instance of the IamPermission model + iamPermissionModel := new(catalogmanagementv1.IamPermission) + iamPermissionModel.ServiceName = core.StringPtr("testString") + iamPermissionModel.RoleCrns = []string{"testString"} + iamPermissionModel.Resources = []catalogmanagementv1.IamResource{*iamResourceModel} // Construct an instance of the Validation model validationModel := new(catalogmanagementv1.Validation) @@ -3829,6 +10767,7 @@ var _ = Describe(`CatalogManagementV1`, func() { validationModel.State = core.StringPtr("testString") validationModel.LastOperation = core.StringPtr("testString") validationModel.Target = make(map[string]interface{}) + validationModel.Message = core.StringPtr("testString") // Construct an instance of the Resource model resourceModel := new(catalogmanagementv1.Resource) @@ -3838,6 +10777,7 @@ var _ = Describe(`CatalogManagementV1`, func() { // Construct an instance of the Script model scriptModel := new(catalogmanagementv1.Script) scriptModel.Instructions = core.StringPtr("testString") + scriptModel.InstructionsI18n = make(map[string]string) scriptModel.Script = core.StringPtr("testString") scriptModel.ScriptPermission = core.StringPtr("testString") scriptModel.DeleteScript = core.StringPtr("testString") @@ -3867,12 +10807,112 @@ var _ = Describe(`CatalogManagementV1`, func() { stateModel.PendingRequested = CreateMockDateTime("2019-01-01T12:00:00.000Z") stateModel.Previous = core.StringPtr("testString") + // Construct an instance of the DeprecatePending model + deprecatePendingModel := new(catalogmanagementv1.DeprecatePending) + deprecatePendingModel.DeprecateDate = CreateMockDateTime("2019-01-01T12:00:00.000Z") + deprecatePendingModel.DeprecateState = core.StringPtr("testString") + deprecatePendingModel.Description = core.StringPtr("testString") + + // Construct an instance of the URLProxy model + urlProxyModel := new(catalogmanagementv1.URLProxy) + urlProxyModel.URL = core.StringPtr("testString") + urlProxyModel.Sha = core.StringPtr("testString") + + // Construct an instance of the MediaItem model + mediaItemModel := new(catalogmanagementv1.MediaItem) + mediaItemModel.URL = core.StringPtr("testString") + mediaItemModel.APIURL = core.StringPtr("testString") + mediaItemModel.URLProxy = urlProxyModel + mediaItemModel.Caption = core.StringPtr("testString") + mediaItemModel.CaptionI18n = make(map[string]string) + mediaItemModel.Type = core.StringPtr("testString") + mediaItemModel.ThumbnailURL = core.StringPtr("testString") + + // Construct an instance of the ArchitectureDiagram model + architectureDiagramModel := new(catalogmanagementv1.ArchitectureDiagram) + architectureDiagramModel.Diagram = mediaItemModel + architectureDiagramModel.Description = core.StringPtr("testString") + architectureDiagramModel.DescriptionI18n = make(map[string]string) + + // Construct an instance of the CostComponent model + costComponentModel := new(catalogmanagementv1.CostComponent) + costComponentModel.Name = core.StringPtr("testString") + costComponentModel.Unit = core.StringPtr("testString") + costComponentModel.HourlyQuantity = core.StringPtr("testString") + costComponentModel.MonthlyQuantity = core.StringPtr("testString") + costComponentModel.Price = core.StringPtr("testString") + costComponentModel.HourlyCost = core.StringPtr("testString") + costComponentModel.MonthlyCost = core.StringPtr("testString") + + // Construct an instance of the CostResource model + costResourceModel := new(catalogmanagementv1.CostResource) + costResourceModel.Name = core.StringPtr("testString") + costResourceModel.Metadata = make(map[string]interface{}) + costResourceModel.HourlyCost = core.StringPtr("testString") + costResourceModel.MonthlyCost = core.StringPtr("testString") + costResourceModel.CostComponents = []catalogmanagementv1.CostComponent{*costComponentModel} + + // Construct an instance of the CostBreakdown model + costBreakdownModel := new(catalogmanagementv1.CostBreakdown) + costBreakdownModel.TotalHourlyCost = core.StringPtr("testString") + costBreakdownModel.TotalMonthlyCOst = core.StringPtr("testString") + costBreakdownModel.Resources = []catalogmanagementv1.CostResource{*costResourceModel} + + // Construct an instance of the CostSummary model + costSummaryModel := new(catalogmanagementv1.CostSummary) + costSummaryModel.TotalDetectedResources = core.Int64Ptr(int64(38)) + costSummaryModel.TotalSupportedResources = core.Int64Ptr(int64(38)) + costSummaryModel.TotalUnsupportedResources = core.Int64Ptr(int64(38)) + costSummaryModel.TotalUsageBasedResources = core.Int64Ptr(int64(38)) + costSummaryModel.TotalNoPriceResources = core.Int64Ptr(int64(38)) + costSummaryModel.UnsupportedResourceCounts = make(map[string]int64) + costSummaryModel.NoPriceResourceCounts = make(map[string]int64) + + // Construct an instance of the Project model + projectModel := new(catalogmanagementv1.Project) + projectModel.Name = core.StringPtr("testString") + projectModel.Metadata = make(map[string]interface{}) + projectModel.PastBreakdown = costBreakdownModel + projectModel.Breakdown = costBreakdownModel + projectModel.Diff = costBreakdownModel + projectModel.Summary = costSummaryModel + + // Construct an instance of the CostEstimate model + costEstimateModel := new(catalogmanagementv1.CostEstimate) + costEstimateModel.Version = core.StringPtr("testString") + costEstimateModel.Currency = core.StringPtr("testString") + costEstimateModel.Projects = []catalogmanagementv1.Project{*projectModel} + costEstimateModel.Summary = costSummaryModel + costEstimateModel.TotalHourlyCost = core.StringPtr("testString") + costEstimateModel.TotalMonthlyCost = core.StringPtr("testString") + costEstimateModel.PastTotalHourlyCost = core.StringPtr("testString") + costEstimateModel.PastTotalMonthlyCost = core.StringPtr("testString") + costEstimateModel.DiffTotalHourlyCost = core.StringPtr("testString") + costEstimateModel.DiffTotalMonthlyCost = core.StringPtr("testString") + costEstimateModel.TimeGenerated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + + // Construct an instance of the Dependency model + dependencyModel := new(catalogmanagementv1.Dependency) + dependencyModel.CatalogID = core.StringPtr("testString") + dependencyModel.ID = core.StringPtr("testString") + dependencyModel.Name = core.StringPtr("testString") + dependencyModel.Version = core.StringPtr("testString") + dependencyModel.Flavors = []string{"testString"} + + // Construct an instance of the SolutionInfo model + solutionInfoModel := new(catalogmanagementv1.SolutionInfo) + solutionInfoModel.ArchitectureDiagrams = []catalogmanagementv1.ArchitectureDiagram{*architectureDiagramModel} + solutionInfoModel.Features = []catalogmanagementv1.Feature{*featureModel} + solutionInfoModel.CostEstimate = costEstimateModel + solutionInfoModel.Dependencies = []catalogmanagementv1.Dependency{*dependencyModel} + // Construct an instance of the Version model versionModel := new(catalogmanagementv1.Version) versionModel.ID = core.StringPtr("testString") versionModel.Rev = core.StringPtr("testString") versionModel.CRN = core.StringPtr("testString") versionModel.Version = core.StringPtr("testString") + versionModel.Flavor = flavorModel versionModel.Sha = core.StringPtr("testString") versionModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") versionModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") @@ -3884,6 +10924,8 @@ var _ = Describe(`CatalogManagementV1`, func() { versionModel.SourceURL = core.StringPtr("testString") versionModel.TgzURL = core.StringPtr("testString") versionModel.Configuration = []catalogmanagementv1.Configuration{*configurationModel} + versionModel.Outputs = []catalogmanagementv1.Output{*outputModel} + versionModel.IamPermissions = []catalogmanagementv1.IamPermission{*iamPermissionModel} versionModel.Metadata = make(map[string]interface{}) versionModel.Validation = validationModel versionModel.RequiredResources = []catalogmanagementv1.Resource{*resourceModel} @@ -3897,9 +10939,13 @@ var _ = Describe(`CatalogManagementV1`, func() { versionModel.PackageVersion = core.StringPtr("testString") versionModel.State = stateModel versionModel.VersionLocator = core.StringPtr("testString") - versionModel.ConsoleURL = core.StringPtr("testString") versionModel.LongDescription = core.StringPtr("testString") + versionModel.LongDescriptionI18n = make(map[string]string) versionModel.WhitelistedAccounts = []string{"testString"} + versionModel.ImagePullKeyName = core.StringPtr("testString") + versionModel.DeprecatePending = deprecatePendingModel + versionModel.SolutionInfo = solutionInfoModel + versionModel.IsConsumable = core.BoolPtr(true) // Construct an instance of the Deployment model deploymentModel := new(catalogmanagementv1.Deployment) @@ -3931,9 +10977,9 @@ var _ = Describe(`CatalogManagementV1`, func() { kindModel := new(catalogmanagementv1.Kind) kindModel.ID = core.StringPtr("testString") kindModel.FormatKind = core.StringPtr("testString") + kindModel.InstallKind = core.StringPtr("testString") kindModel.TargetKind = core.StringPtr("testString") kindModel.Metadata = make(map[string]interface{}) - kindModel.InstallDescription = core.StringPtr("testString") kindModel.Tags = []string{"testString"} kindModel.AdditionalFeatures = []catalogmanagementv1.Feature{*featureModel} kindModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") @@ -3951,67 +10997,319 @@ var _ = Describe(`CatalogManagementV1`, func() { repoInfoModel.Token = core.StringPtr("testString") repoInfoModel.Type = core.StringPtr("testString") + // Construct an instance of the ImagePullKey model + imagePullKeyModel := new(catalogmanagementv1.ImagePullKey) + imagePullKeyModel.Name = core.StringPtr("testString") + imagePullKeyModel.Value = core.StringPtr("testString") + imagePullKeyModel.Description = core.StringPtr("testString") + + // Construct an instance of the SupportWaitTime model + supportWaitTimeModel := new(catalogmanagementv1.SupportWaitTime) + supportWaitTimeModel.Value = core.Int64Ptr(int64(38)) + supportWaitTimeModel.Type = core.StringPtr("testString") + + // Construct an instance of the SupportTime model + supportTimeModel := new(catalogmanagementv1.SupportTime) + supportTimeModel.Day = core.Int64Ptr(int64(38)) + supportTimeModel.StartTime = core.StringPtr("testString") + supportTimeModel.EndTime = core.StringPtr("testString") + + // Construct an instance of the SupportAvailability model + supportAvailabilityModel := new(catalogmanagementv1.SupportAvailability) + supportAvailabilityModel.Times = []catalogmanagementv1.SupportTime{*supportTimeModel} + supportAvailabilityModel.Timezone = core.StringPtr("testString") + supportAvailabilityModel.AlwaysAvailable = core.BoolPtr(true) + + // Construct an instance of the SupportDetail model + supportDetailModel := new(catalogmanagementv1.SupportDetail) + supportDetailModel.Type = core.StringPtr("testString") + supportDetailModel.Contact = core.StringPtr("testString") + supportDetailModel.ResponseWaitTime = supportWaitTimeModel + supportDetailModel.Availability = supportAvailabilityModel + + // Construct an instance of the SupportEscalation model + supportEscalationModel := new(catalogmanagementv1.SupportEscalation) + supportEscalationModel.EscalationWaitTime = supportWaitTimeModel + supportEscalationModel.ResponseWaitTime = supportWaitTimeModel + supportEscalationModel.Contact = core.StringPtr("testString") + // Construct an instance of the Support model supportModel := new(catalogmanagementv1.Support) supportModel.URL = core.StringPtr("testString") supportModel.Process = core.StringPtr("testString") + supportModel.ProcessI18n = make(map[string]string) supportModel.Locations = []string{"testString"} + supportModel.SupportDetails = []catalogmanagementv1.SupportDetail{*supportDetailModel} + supportModel.SupportEscalation = supportEscalationModel + supportModel.SupportType = core.StringPtr("testString") + + // Construct an instance of the LearnMoreLinks model + learnMoreLinksModel := new(catalogmanagementv1.LearnMoreLinks) + learnMoreLinksModel.FirstParty = core.StringPtr("testString") + learnMoreLinksModel.ThirdParty = core.StringPtr("testString") + + // Construct an instance of the Constraint model + constraintModel := new(catalogmanagementv1.Constraint) + constraintModel.Type = core.StringPtr("testString") + constraintModel.Rule = core.StringPtr("testString") + + // Construct an instance of the Badge model + badgeModel := new(catalogmanagementv1.Badge) + badgeModel.ID = core.StringPtr("testString") + badgeModel.Label = core.StringPtr("testString") + badgeModel.LabelI18n = make(map[string]string) + badgeModel.Description = core.StringPtr("testString") + badgeModel.DescriptionI18n = make(map[string]string) + badgeModel.Icon = core.StringPtr("testString") + badgeModel.Authority = core.StringPtr("testString") + badgeModel.Tag = core.StringPtr("testString") + badgeModel.LearnMoreLinks = learnMoreLinksModel + badgeModel.Constraints = []catalogmanagementv1.Constraint{*constraintModel} - // Construct an instance of the MediaItem model - mediaItemModel := new(catalogmanagementv1.MediaItem) - mediaItemModel.URL = core.StringPtr("testString") - mediaItemModel.Caption = core.StringPtr("testString") - mediaItemModel.Type = core.StringPtr("testString") - mediaItemModel.ThumbnailURL = core.StringPtr("testString") + // Construct an instance of the ReplaceOfferingOptions model + replaceOfferingOptionsModel := new(catalogmanagementv1.ReplaceOfferingOptions) + replaceOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") + replaceOfferingOptionsModel.OfferingID = core.StringPtr("testString") + replaceOfferingOptionsModel.ID = core.StringPtr("testString") + replaceOfferingOptionsModel.Rev = core.StringPtr("testString") + replaceOfferingOptionsModel.URL = core.StringPtr("testString") + replaceOfferingOptionsModel.CRN = core.StringPtr("testString") + replaceOfferingOptionsModel.Label = core.StringPtr("testString") + replaceOfferingOptionsModel.LabelI18n = make(map[string]string) + replaceOfferingOptionsModel.Name = core.StringPtr("testString") + replaceOfferingOptionsModel.OfferingIconURL = core.StringPtr("testString") + replaceOfferingOptionsModel.OfferingDocsURL = core.StringPtr("testString") + replaceOfferingOptionsModel.OfferingSupportURL = core.StringPtr("testString") + replaceOfferingOptionsModel.Tags = []string{"testString"} + replaceOfferingOptionsModel.Keywords = []string{"testString"} + replaceOfferingOptionsModel.Rating = ratingModel + replaceOfferingOptionsModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + replaceOfferingOptionsModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + replaceOfferingOptionsModel.ShortDescription = core.StringPtr("testString") + replaceOfferingOptionsModel.ShortDescriptionI18n = make(map[string]string) + replaceOfferingOptionsModel.LongDescription = core.StringPtr("testString") + replaceOfferingOptionsModel.LongDescriptionI18n = make(map[string]string) + replaceOfferingOptionsModel.Features = []catalogmanagementv1.Feature{*featureModel} + replaceOfferingOptionsModel.Kinds = []catalogmanagementv1.Kind{*kindModel} + replaceOfferingOptionsModel.PcManaged = core.BoolPtr(true) + replaceOfferingOptionsModel.PublishApproved = core.BoolPtr(true) + replaceOfferingOptionsModel.ShareWithAll = core.BoolPtr(true) + replaceOfferingOptionsModel.ShareWithIBM = core.BoolPtr(true) + replaceOfferingOptionsModel.ShareEnabled = core.BoolPtr(true) + replaceOfferingOptionsModel.PermitRequestIBMPublicPublish = core.BoolPtr(true) + replaceOfferingOptionsModel.IBMPublishApproved = core.BoolPtr(true) + replaceOfferingOptionsModel.PublicPublishApproved = core.BoolPtr(true) + replaceOfferingOptionsModel.PublicOriginalCRN = core.StringPtr("testString") + replaceOfferingOptionsModel.PublishPublicCRN = core.StringPtr("testString") + replaceOfferingOptionsModel.PortalApprovalRecord = core.StringPtr("testString") + replaceOfferingOptionsModel.PortalUIURL = core.StringPtr("testString") + replaceOfferingOptionsModel.CatalogID = core.StringPtr("testString") + replaceOfferingOptionsModel.CatalogName = core.StringPtr("testString") + replaceOfferingOptionsModel.Metadata = make(map[string]interface{}) + replaceOfferingOptionsModel.Disclaimer = core.StringPtr("testString") + replaceOfferingOptionsModel.Hidden = core.BoolPtr(true) + replaceOfferingOptionsModel.Provider = core.StringPtr("testString") + replaceOfferingOptionsModel.ProviderInfo = providerInfoModel + replaceOfferingOptionsModel.RepoInfo = repoInfoModel + replaceOfferingOptionsModel.ImagePullKeys = []catalogmanagementv1.ImagePullKey{*imagePullKeyModel} + replaceOfferingOptionsModel.Support = supportModel + replaceOfferingOptionsModel.Media = []catalogmanagementv1.MediaItem{*mediaItemModel} + replaceOfferingOptionsModel.DeprecatePending = deprecatePendingModel + replaceOfferingOptionsModel.ProductKind = core.StringPtr("testString") + replaceOfferingOptionsModel.Badges = []catalogmanagementv1.Badge{*badgeModel} + replaceOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Construct an instance of the CreateOfferingOptions model - createOfferingOptionsModel := new(catalogmanagementv1.CreateOfferingOptions) - createOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") - createOfferingOptionsModel.ID = core.StringPtr("testString") - createOfferingOptionsModel.Rev = core.StringPtr("testString") - createOfferingOptionsModel.URL = core.StringPtr("testString") - createOfferingOptionsModel.CRN = core.StringPtr("testString") - createOfferingOptionsModel.Label = core.StringPtr("testString") - createOfferingOptionsModel.Name = core.StringPtr("testString") - createOfferingOptionsModel.OfferingIconURL = core.StringPtr("testString") - createOfferingOptionsModel.OfferingDocsURL = core.StringPtr("testString") - createOfferingOptionsModel.OfferingSupportURL = core.StringPtr("testString") - createOfferingOptionsModel.Tags = []string{"testString"} - createOfferingOptionsModel.Keywords = []string{"testString"} - createOfferingOptionsModel.Rating = ratingModel - createOfferingOptionsModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") - createOfferingOptionsModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - createOfferingOptionsModel.ShortDescription = core.StringPtr("testString") - createOfferingOptionsModel.LongDescription = core.StringPtr("testString") - createOfferingOptionsModel.Features = []catalogmanagementv1.Feature{*featureModel} - createOfferingOptionsModel.Kinds = []catalogmanagementv1.Kind{*kindModel} - createOfferingOptionsModel.PermitRequestIBMPublicPublish = core.BoolPtr(true) - createOfferingOptionsModel.IBMPublishApproved = core.BoolPtr(true) - createOfferingOptionsModel.PublicPublishApproved = core.BoolPtr(true) - createOfferingOptionsModel.PublicOriginalCRN = core.StringPtr("testString") - createOfferingOptionsModel.PublishPublicCRN = core.StringPtr("testString") - createOfferingOptionsModel.PortalApprovalRecord = core.StringPtr("testString") - createOfferingOptionsModel.PortalUIURL = core.StringPtr("testString") - createOfferingOptionsModel.CatalogID = core.StringPtr("testString") - createOfferingOptionsModel.CatalogName = core.StringPtr("testString") - createOfferingOptionsModel.Metadata = make(map[string]interface{}) - createOfferingOptionsModel.Disclaimer = core.StringPtr("testString") - createOfferingOptionsModel.Hidden = core.BoolPtr(true) - createOfferingOptionsModel.Provider = core.StringPtr("testString") - createOfferingOptionsModel.ProviderInfo = providerInfoModel - createOfferingOptionsModel.RepoInfo = repoInfoModel - createOfferingOptionsModel.Support = supportModel - createOfferingOptionsModel.Media = []catalogmanagementv1.MediaItem{*mediaItemModel} - createOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation + result, response, operationErr := catalogManagementService.ReplaceOffering(replaceOfferingOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) - // Invoke operation with valid options model (positive test) - result, response, operationErr = catalogManagementService.CreateOffering(createOfferingOptionsModel) + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateOffering(updateOfferingOptions *UpdateOfferingOptions) - Operation response error`, func() { + updateOfferingPath := "/catalogs/testString/offerings/testString" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(updateOfferingPath)) + Expect(req.Method).To(Equal("PATCH")) + Expect(req.Header["If-Match"]).ToNot(BeNil()) + Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke UpdateOffering with error: Operation response processing error`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Construct an instance of the JSONPatchOperation model + jsonPatchOperationModel := new(catalogmanagementv1.JSONPatchOperation) + jsonPatchOperationModel.Op = core.StringPtr("add") + jsonPatchOperationModel.Path = core.StringPtr("testString") + jsonPatchOperationModel.Value = core.StringPtr("testString") + jsonPatchOperationModel.From = core.StringPtr("testString") + + // Construct an instance of the UpdateOfferingOptions model + updateOfferingOptionsModel := new(catalogmanagementv1.UpdateOfferingOptions) + updateOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") + updateOfferingOptionsModel.OfferingID = core.StringPtr("testString") + updateOfferingOptionsModel.IfMatch = core.StringPtr("testString") + updateOfferingOptionsModel.Updates = []catalogmanagementv1.JSONPatchOperation{*jsonPatchOperationModel} + updateOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := catalogManagementService.UpdateOffering(updateOfferingOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + catalogManagementService.EnableRetries(0, 0) + result, response, operationErr = catalogManagementService.UpdateOffering(updateOfferingOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateOffering(updateOfferingOptions *UpdateOfferingOptions)`, func() { + updateOfferingPath := "/catalogs/testString/offerings/testString" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(updateOfferingPath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + Expect(req.Header["If-Match"]).ToNot(BeNil()) + Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "url": "URL", "crn": "CRN", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "name": "Name", "offering_icon_url": "OfferingIconURL", "offering_docs_url": "OfferingDocsURL", "offering_support_url": "OfferingSupportURL", "tags": ["Tags"], "keywords": ["Keywords"], "rating": {"one_star_count": 12, "two_star_count": 12, "three_star_count": 14, "four_star_count": 13}, "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "short_description": "ShortDescription", "short_description_i18n": {"mapKey": "Inner"}, "long_description": "LongDescription", "long_description_i18n": {"mapKey": "Inner"}, "features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "kinds": [{"id": "ID", "format_kind": "FormatKind", "install_kind": "InstallKind", "target_kind": "TargetKind", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "additional_features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "versions": [{"id": "ID", "_rev": "Rev", "crn": "CRN", "version": "Version", "flavor": {"name": "Name", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "index": 5}, "sha": "Sha", "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "offering_id": "OfferingID", "catalog_id": "CatalogID", "kind_id": "KindID", "tags": ["Tags"], "repo_url": "RepoURL", "source_url": "SourceURL", "tgz_url": "TgzURL", "configuration": [{"key": "Key", "type": "Type", "default_value": "anyValue", "display_name": "DisplayName", "value_constraint": "ValueConstraint", "description": "Description", "required": true, "options": ["anyValue"], "hidden": true, "custom_config": {"type": "Type", "grouping": "Grouping", "original_grouping": "OriginalGrouping", "grouping_index": 13, "config_constraints": {"anyKey": "anyValue"}, "associations": {"parameters": [{"name": "Name", "optionsRefresh": true}]}}, "type_metadata": "TypeMetadata"}], "outputs": [{"key": "Key", "description": "Description"}], "iam_permissions": [{"service_name": "ServiceName", "role_crns": ["RoleCrns"], "resources": [{"name": "Name", "description": "Description", "role_crns": ["RoleCrns"]}]}], "metadata": {"mapKey": "anyValue"}, "validation": {"validated": "2019-01-01T12:00:00.000Z", "requested": "2019-01-01T12:00:00.000Z", "state": "State", "last_operation": "LastOperation", "target": {"mapKey": "anyValue"}, "message": "Message"}, "required_resources": [{"type": "mem", "value": "anyValue"}], "single_instance": true, "install": {"instructions": "Instructions", "instructions_i18n": {"mapKey": "Inner"}, "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}, "pre_install": [{"instructions": "Instructions", "instructions_i18n": {"mapKey": "Inner"}, "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}], "entitlement": {"provider_name": "ProviderName", "provider_id": "ProviderID", "product_id": "ProductID", "part_numbers": ["PartNumbers"], "image_repo_name": "ImageRepoName"}, "licenses": [{"id": "ID", "name": "Name", "type": "Type", "url": "URL", "description": "Description"}], "image_manifest_url": "ImageManifestURL", "deprecated": true, "package_version": "PackageVersion", "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "version_locator": "VersionLocator", "long_description": "LongDescription", "long_description_i18n": {"mapKey": "Inner"}, "whitelisted_accounts": ["WhitelistedAccounts"], "image_pull_key_name": "ImagePullKeyName", "deprecate_pending": {"deprecate_date": "2019-01-01T12:00:00.000Z", "deprecate_state": "DeprecateState", "description": "Description"}, "solution_info": {"architecture_diagrams": [{"diagram": {"url": "URL", "api_url": "APIURL", "url_proxy": {"url": "URL", "sha": "Sha"}, "caption": "Caption", "caption_i18n": {"mapKey": "Inner"}, "type": "Type", "thumbnail_url": "ThumbnailURL"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "cost_estimate": {"version": "Version", "currency": "Currency", "projects": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "pastBreakdown": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "breakdown": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "diff": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "summary": {"totalDetectedResources": 22, "totalSupportedResources": 23, "totalUnsupportedResources": 25, "totalUsageBasedResources": 24, "totalNoPriceResources": 21, "unsupportedResourceCounts": {"mapKey": 5}, "noPriceResourceCounts": {"mapKey": 5}}}], "summary": {"totalDetectedResources": 22, "totalSupportedResources": 23, "totalUnsupportedResources": 25, "totalUsageBasedResources": 24, "totalNoPriceResources": 21, "unsupportedResourceCounts": {"mapKey": 5}, "noPriceResourceCounts": {"mapKey": 5}}, "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z"}, "dependencies": [{"catalog_id": "CatalogID", "id": "ID", "name": "Name", "version": "Version", "flavors": ["Flavors"]}]}, "is_consumable": true}], "plans": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "additional_features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "deployments": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z"}]}]}], "pc_managed": false, "publish_approved": false, "share_with_all": true, "share_with_ibm": true, "share_enabled": true, "permit_request_ibm_public_publish": false, "ibm_publish_approved": true, "public_publish_approved": false, "public_original_crn": "PublicOriginalCRN", "publish_public_crn": "PublishPublicCRN", "portal_approval_record": "PortalApprovalRecord", "portal_ui_url": "PortalUIURL", "catalog_id": "CatalogID", "catalog_name": "CatalogName", "metadata": {"mapKey": "anyValue"}, "disclaimer": "Disclaimer", "hidden": true, "provider": "Provider", "provider_info": {"id": "ID", "name": "Name"}, "repo_info": {"token": "Token", "type": "Type"}, "image_pull_keys": [{"name": "Name", "value": "Value", "description": "Description"}], "support": {"url": "URL", "process": "Process", "process_i18n": {"mapKey": "Inner"}, "locations": ["Locations"], "support_details": [{"type": "Type", "contact": "Contact", "response_wait_time": {"value": 5, "type": "Type"}, "availability": {"times": [{"day": 3, "start_time": "StartTime", "end_time": "EndTime"}], "timezone": "Timezone", "always_available": false}}], "support_escalation": {"escalation_wait_time": {"value": 5, "type": "Type"}, "response_wait_time": {"value": 5, "type": "Type"}, "contact": "Contact"}, "support_type": "SupportType"}, "media": [{"url": "URL", "api_url": "APIURL", "url_proxy": {"url": "URL", "sha": "Sha"}, "caption": "Caption", "caption_i18n": {"mapKey": "Inner"}, "type": "Type", "thumbnail_url": "ThumbnailURL"}], "deprecate_pending": {"deprecate_date": "2019-01-01T12:00:00.000Z", "deprecate_state": "DeprecateState", "description": "Description"}, "product_kind": "ProductKind", "badges": [{"id": "ID", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}, "icon": "Icon", "authority": "Authority", "tag": "Tag", "learn_more_links": {"first_party": "FirstParty", "third_party": "ThirdParty"}, "constraints": [{"type": "Type", "rule": "anyValue"}]}]}`) + })) + }) + It(`Invoke UpdateOffering successfully with retries`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + catalogManagementService.EnableRetries(0, 0) + + // Construct an instance of the JSONPatchOperation model + jsonPatchOperationModel := new(catalogmanagementv1.JSONPatchOperation) + jsonPatchOperationModel.Op = core.StringPtr("add") + jsonPatchOperationModel.Path = core.StringPtr("testString") + jsonPatchOperationModel.Value = core.StringPtr("testString") + jsonPatchOperationModel.From = core.StringPtr("testString") + + // Construct an instance of the UpdateOfferingOptions model + updateOfferingOptionsModel := new(catalogmanagementv1.UpdateOfferingOptions) + updateOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") + updateOfferingOptionsModel.OfferingID = core.StringPtr("testString") + updateOfferingOptionsModel.IfMatch = core.StringPtr("testString") + updateOfferingOptionsModel.Updates = []catalogmanagementv1.JSONPatchOperation{*jsonPatchOperationModel} + updateOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := catalogManagementService.UpdateOfferingWithContext(ctx, updateOfferingOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + catalogManagementService.DisableRetries() + result, response, operationErr := catalogManagementService.UpdateOffering(updateOfferingOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = catalogManagementService.UpdateOfferingWithContext(ctx, updateOfferingOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) - It(`Invoke CreateOffering with error: Operation validation and request error`, func() { + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(updateOfferingPath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + Expect(req.Header["If-Match"]).ToNot(BeNil()) + Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "url": "URL", "crn": "CRN", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "name": "Name", "offering_icon_url": "OfferingIconURL", "offering_docs_url": "OfferingDocsURL", "offering_support_url": "OfferingSupportURL", "tags": ["Tags"], "keywords": ["Keywords"], "rating": {"one_star_count": 12, "two_star_count": 12, "three_star_count": 14, "four_star_count": 13}, "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "short_description": "ShortDescription", "short_description_i18n": {"mapKey": "Inner"}, "long_description": "LongDescription", "long_description_i18n": {"mapKey": "Inner"}, "features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "kinds": [{"id": "ID", "format_kind": "FormatKind", "install_kind": "InstallKind", "target_kind": "TargetKind", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "additional_features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "versions": [{"id": "ID", "_rev": "Rev", "crn": "CRN", "version": "Version", "flavor": {"name": "Name", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "index": 5}, "sha": "Sha", "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "offering_id": "OfferingID", "catalog_id": "CatalogID", "kind_id": "KindID", "tags": ["Tags"], "repo_url": "RepoURL", "source_url": "SourceURL", "tgz_url": "TgzURL", "configuration": [{"key": "Key", "type": "Type", "default_value": "anyValue", "display_name": "DisplayName", "value_constraint": "ValueConstraint", "description": "Description", "required": true, "options": ["anyValue"], "hidden": true, "custom_config": {"type": "Type", "grouping": "Grouping", "original_grouping": "OriginalGrouping", "grouping_index": 13, "config_constraints": {"anyKey": "anyValue"}, "associations": {"parameters": [{"name": "Name", "optionsRefresh": true}]}}, "type_metadata": "TypeMetadata"}], "outputs": [{"key": "Key", "description": "Description"}], "iam_permissions": [{"service_name": "ServiceName", "role_crns": ["RoleCrns"], "resources": [{"name": "Name", "description": "Description", "role_crns": ["RoleCrns"]}]}], "metadata": {"mapKey": "anyValue"}, "validation": {"validated": "2019-01-01T12:00:00.000Z", "requested": "2019-01-01T12:00:00.000Z", "state": "State", "last_operation": "LastOperation", "target": {"mapKey": "anyValue"}, "message": "Message"}, "required_resources": [{"type": "mem", "value": "anyValue"}], "single_instance": true, "install": {"instructions": "Instructions", "instructions_i18n": {"mapKey": "Inner"}, "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}, "pre_install": [{"instructions": "Instructions", "instructions_i18n": {"mapKey": "Inner"}, "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}], "entitlement": {"provider_name": "ProviderName", "provider_id": "ProviderID", "product_id": "ProductID", "part_numbers": ["PartNumbers"], "image_repo_name": "ImageRepoName"}, "licenses": [{"id": "ID", "name": "Name", "type": "Type", "url": "URL", "description": "Description"}], "image_manifest_url": "ImageManifestURL", "deprecated": true, "package_version": "PackageVersion", "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "version_locator": "VersionLocator", "long_description": "LongDescription", "long_description_i18n": {"mapKey": "Inner"}, "whitelisted_accounts": ["WhitelistedAccounts"], "image_pull_key_name": "ImagePullKeyName", "deprecate_pending": {"deprecate_date": "2019-01-01T12:00:00.000Z", "deprecate_state": "DeprecateState", "description": "Description"}, "solution_info": {"architecture_diagrams": [{"diagram": {"url": "URL", "api_url": "APIURL", "url_proxy": {"url": "URL", "sha": "Sha"}, "caption": "Caption", "caption_i18n": {"mapKey": "Inner"}, "type": "Type", "thumbnail_url": "ThumbnailURL"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "cost_estimate": {"version": "Version", "currency": "Currency", "projects": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "pastBreakdown": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "breakdown": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "diff": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "summary": {"totalDetectedResources": 22, "totalSupportedResources": 23, "totalUnsupportedResources": 25, "totalUsageBasedResources": 24, "totalNoPriceResources": 21, "unsupportedResourceCounts": {"mapKey": 5}, "noPriceResourceCounts": {"mapKey": 5}}}], "summary": {"totalDetectedResources": 22, "totalSupportedResources": 23, "totalUnsupportedResources": 25, "totalUsageBasedResources": 24, "totalNoPriceResources": 21, "unsupportedResourceCounts": {"mapKey": 5}, "noPriceResourceCounts": {"mapKey": 5}}, "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z"}, "dependencies": [{"catalog_id": "CatalogID", "id": "ID", "name": "Name", "version": "Version", "flavors": ["Flavors"]}]}, "is_consumable": true}], "plans": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "additional_features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "deployments": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z"}]}]}], "pc_managed": false, "publish_approved": false, "share_with_all": true, "share_with_ibm": true, "share_enabled": true, "permit_request_ibm_public_publish": false, "ibm_publish_approved": true, "public_publish_approved": false, "public_original_crn": "PublicOriginalCRN", "publish_public_crn": "PublishPublicCRN", "portal_approval_record": "PortalApprovalRecord", "portal_ui_url": "PortalUIURL", "catalog_id": "CatalogID", "catalog_name": "CatalogName", "metadata": {"mapKey": "anyValue"}, "disclaimer": "Disclaimer", "hidden": true, "provider": "Provider", "provider_info": {"id": "ID", "name": "Name"}, "repo_info": {"token": "Token", "type": "Type"}, "image_pull_keys": [{"name": "Name", "value": "Value", "description": "Description"}], "support": {"url": "URL", "process": "Process", "process_i18n": {"mapKey": "Inner"}, "locations": ["Locations"], "support_details": [{"type": "Type", "contact": "Contact", "response_wait_time": {"value": 5, "type": "Type"}, "availability": {"times": [{"day": 3, "start_time": "StartTime", "end_time": "EndTime"}], "timezone": "Timezone", "always_available": false}}], "support_escalation": {"escalation_wait_time": {"value": 5, "type": "Type"}, "response_wait_time": {"value": 5, "type": "Type"}, "contact": "Contact"}, "support_type": "SupportType"}, "media": [{"url": "URL", "api_url": "APIURL", "url_proxy": {"url": "URL", "sha": "Sha"}, "caption": "Caption", "caption_i18n": {"mapKey": "Inner"}, "type": "Type", "thumbnail_url": "ThumbnailURL"}], "deprecate_pending": {"deprecate_date": "2019-01-01T12:00:00.000Z", "deprecate_state": "DeprecateState", "description": "Description"}, "product_kind": "ProductKind", "badges": [{"id": "ID", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}, "icon": "Icon", "authority": "Authority", "tag": "Tag", "learn_more_links": {"first_party": "FirstParty", "third_party": "ThirdParty"}, "constraints": [{"type": "Type", "rule": "anyValue"}]}]}`) + })) + }) + It(`Invoke UpdateOffering successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -4019,222 +11317,68 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the Rating model - ratingModel := new(catalogmanagementv1.Rating) - ratingModel.OneStarCount = core.Int64Ptr(int64(38)) - ratingModel.TwoStarCount = core.Int64Ptr(int64(38)) - ratingModel.ThreeStarCount = core.Int64Ptr(int64(38)) - ratingModel.FourStarCount = core.Int64Ptr(int64(38)) - - // Construct an instance of the Feature model - featureModel := new(catalogmanagementv1.Feature) - featureModel.Title = core.StringPtr("testString") - featureModel.Description = core.StringPtr("testString") - - // Construct an instance of the Configuration model - configurationModel := new(catalogmanagementv1.Configuration) - configurationModel.Key = core.StringPtr("testString") - configurationModel.Type = core.StringPtr("testString") - configurationModel.DefaultValue = core.StringPtr("testString") - configurationModel.ValueConstraint = core.StringPtr("testString") - configurationModel.Description = core.StringPtr("testString") - configurationModel.Required = core.BoolPtr(true) - configurationModel.Options = []interface{}{"testString"} - configurationModel.Hidden = core.BoolPtr(true) - - // Construct an instance of the Validation model - validationModel := new(catalogmanagementv1.Validation) - validationModel.Validated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - validationModel.Requested = CreateMockDateTime("2019-01-01T12:00:00.000Z") - validationModel.State = core.StringPtr("testString") - validationModel.LastOperation = core.StringPtr("testString") - validationModel.Target = make(map[string]interface{}) - - // Construct an instance of the Resource model - resourceModel := new(catalogmanagementv1.Resource) - resourceModel.Type = core.StringPtr("mem") - resourceModel.Value = core.StringPtr("testString") - - // Construct an instance of the Script model - scriptModel := new(catalogmanagementv1.Script) - scriptModel.Instructions = core.StringPtr("testString") - scriptModel.Script = core.StringPtr("testString") - scriptModel.ScriptPermission = core.StringPtr("testString") - scriptModel.DeleteScript = core.StringPtr("testString") - scriptModel.Scope = core.StringPtr("testString") - - // Construct an instance of the VersionEntitlement model - versionEntitlementModel := new(catalogmanagementv1.VersionEntitlement) - versionEntitlementModel.ProviderName = core.StringPtr("testString") - versionEntitlementModel.ProviderID = core.StringPtr("testString") - versionEntitlementModel.ProductID = core.StringPtr("testString") - versionEntitlementModel.PartNumbers = []string{"testString"} - versionEntitlementModel.ImageRepoName = core.StringPtr("testString") - - // Construct an instance of the License model - licenseModel := new(catalogmanagementv1.License) - licenseModel.ID = core.StringPtr("testString") - licenseModel.Name = core.StringPtr("testString") - licenseModel.Type = core.StringPtr("testString") - licenseModel.URL = core.StringPtr("testString") - licenseModel.Description = core.StringPtr("testString") - - // Construct an instance of the State model - stateModel := new(catalogmanagementv1.State) - stateModel.Current = core.StringPtr("testString") - stateModel.CurrentEntered = CreateMockDateTime("2019-01-01T12:00:00.000Z") - stateModel.Pending = core.StringPtr("testString") - stateModel.PendingRequested = CreateMockDateTime("2019-01-01T12:00:00.000Z") - stateModel.Previous = core.StringPtr("testString") - - // Construct an instance of the Version model - versionModel := new(catalogmanagementv1.Version) - versionModel.ID = core.StringPtr("testString") - versionModel.Rev = core.StringPtr("testString") - versionModel.CRN = core.StringPtr("testString") - versionModel.Version = core.StringPtr("testString") - versionModel.Sha = core.StringPtr("testString") - versionModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") - versionModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - versionModel.OfferingID = core.StringPtr("testString") - versionModel.CatalogID = core.StringPtr("testString") - versionModel.KindID = core.StringPtr("testString") - versionModel.Tags = []string{"testString"} - versionModel.RepoURL = core.StringPtr("testString") - versionModel.SourceURL = core.StringPtr("testString") - versionModel.TgzURL = core.StringPtr("testString") - versionModel.Configuration = []catalogmanagementv1.Configuration{*configurationModel} - versionModel.Metadata = make(map[string]interface{}) - versionModel.Validation = validationModel - versionModel.RequiredResources = []catalogmanagementv1.Resource{*resourceModel} - versionModel.SingleInstance = core.BoolPtr(true) - versionModel.Install = scriptModel - versionModel.PreInstall = []catalogmanagementv1.Script{*scriptModel} - versionModel.Entitlement = versionEntitlementModel - versionModel.Licenses = []catalogmanagementv1.License{*licenseModel} - versionModel.ImageManifestURL = core.StringPtr("testString") - versionModel.Deprecated = core.BoolPtr(true) - versionModel.PackageVersion = core.StringPtr("testString") - versionModel.State = stateModel - versionModel.VersionLocator = core.StringPtr("testString") - versionModel.ConsoleURL = core.StringPtr("testString") - versionModel.LongDescription = core.StringPtr("testString") - versionModel.WhitelistedAccounts = []string{"testString"} - - // Construct an instance of the Deployment model - deploymentModel := new(catalogmanagementv1.Deployment) - deploymentModel.ID = core.StringPtr("testString") - deploymentModel.Label = core.StringPtr("testString") - deploymentModel.Name = core.StringPtr("testString") - deploymentModel.ShortDescription = core.StringPtr("testString") - deploymentModel.LongDescription = core.StringPtr("testString") - deploymentModel.Metadata = make(map[string]interface{}) - deploymentModel.Tags = []string{"testString"} - deploymentModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") - deploymentModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - - // Construct an instance of the Plan model - planModel := new(catalogmanagementv1.Plan) - planModel.ID = core.StringPtr("testString") - planModel.Label = core.StringPtr("testString") - planModel.Name = core.StringPtr("testString") - planModel.ShortDescription = core.StringPtr("testString") - planModel.LongDescription = core.StringPtr("testString") - planModel.Metadata = make(map[string]interface{}) - planModel.Tags = []string{"testString"} - planModel.AdditionalFeatures = []catalogmanagementv1.Feature{*featureModel} - planModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") - planModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - planModel.Deployments = []catalogmanagementv1.Deployment{*deploymentModel} - - // Construct an instance of the Kind model - kindModel := new(catalogmanagementv1.Kind) - kindModel.ID = core.StringPtr("testString") - kindModel.FormatKind = core.StringPtr("testString") - kindModel.TargetKind = core.StringPtr("testString") - kindModel.Metadata = make(map[string]interface{}) - kindModel.InstallDescription = core.StringPtr("testString") - kindModel.Tags = []string{"testString"} - kindModel.AdditionalFeatures = []catalogmanagementv1.Feature{*featureModel} - kindModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") - kindModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - kindModel.Versions = []catalogmanagementv1.Version{*versionModel} - kindModel.Plans = []catalogmanagementv1.Plan{*planModel} - - // Construct an instance of the ProviderInfo model - providerInfoModel := new(catalogmanagementv1.ProviderInfo) - providerInfoModel.ID = core.StringPtr("testString") - providerInfoModel.Name = core.StringPtr("testString") - - // Construct an instance of the RepoInfo model - repoInfoModel := new(catalogmanagementv1.RepoInfo) - repoInfoModel.Token = core.StringPtr("testString") - repoInfoModel.Type = core.StringPtr("testString") - - // Construct an instance of the Support model - supportModel := new(catalogmanagementv1.Support) - supportModel.URL = core.StringPtr("testString") - supportModel.Process = core.StringPtr("testString") - supportModel.Locations = []string{"testString"} + // Invoke operation with nil options model (negative test) + result, response, operationErr := catalogManagementService.UpdateOffering(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) - // Construct an instance of the MediaItem model - mediaItemModel := new(catalogmanagementv1.MediaItem) - mediaItemModel.URL = core.StringPtr("testString") - mediaItemModel.Caption = core.StringPtr("testString") - mediaItemModel.Type = core.StringPtr("testString") - mediaItemModel.ThumbnailURL = core.StringPtr("testString") + // Construct an instance of the JSONPatchOperation model + jsonPatchOperationModel := new(catalogmanagementv1.JSONPatchOperation) + jsonPatchOperationModel.Op = core.StringPtr("add") + jsonPatchOperationModel.Path = core.StringPtr("testString") + jsonPatchOperationModel.Value = core.StringPtr("testString") + jsonPatchOperationModel.From = core.StringPtr("testString") - // Construct an instance of the CreateOfferingOptions model - createOfferingOptionsModel := new(catalogmanagementv1.CreateOfferingOptions) - createOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") - createOfferingOptionsModel.ID = core.StringPtr("testString") - createOfferingOptionsModel.Rev = core.StringPtr("testString") - createOfferingOptionsModel.URL = core.StringPtr("testString") - createOfferingOptionsModel.CRN = core.StringPtr("testString") - createOfferingOptionsModel.Label = core.StringPtr("testString") - createOfferingOptionsModel.Name = core.StringPtr("testString") - createOfferingOptionsModel.OfferingIconURL = core.StringPtr("testString") - createOfferingOptionsModel.OfferingDocsURL = core.StringPtr("testString") - createOfferingOptionsModel.OfferingSupportURL = core.StringPtr("testString") - createOfferingOptionsModel.Tags = []string{"testString"} - createOfferingOptionsModel.Keywords = []string{"testString"} - createOfferingOptionsModel.Rating = ratingModel - createOfferingOptionsModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") - createOfferingOptionsModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - createOfferingOptionsModel.ShortDescription = core.StringPtr("testString") - createOfferingOptionsModel.LongDescription = core.StringPtr("testString") - createOfferingOptionsModel.Features = []catalogmanagementv1.Feature{*featureModel} - createOfferingOptionsModel.Kinds = []catalogmanagementv1.Kind{*kindModel} - createOfferingOptionsModel.PermitRequestIBMPublicPublish = core.BoolPtr(true) - createOfferingOptionsModel.IBMPublishApproved = core.BoolPtr(true) - createOfferingOptionsModel.PublicPublishApproved = core.BoolPtr(true) - createOfferingOptionsModel.PublicOriginalCRN = core.StringPtr("testString") - createOfferingOptionsModel.PublishPublicCRN = core.StringPtr("testString") - createOfferingOptionsModel.PortalApprovalRecord = core.StringPtr("testString") - createOfferingOptionsModel.PortalUIURL = core.StringPtr("testString") - createOfferingOptionsModel.CatalogID = core.StringPtr("testString") - createOfferingOptionsModel.CatalogName = core.StringPtr("testString") - createOfferingOptionsModel.Metadata = make(map[string]interface{}) - createOfferingOptionsModel.Disclaimer = core.StringPtr("testString") - createOfferingOptionsModel.Hidden = core.BoolPtr(true) - createOfferingOptionsModel.Provider = core.StringPtr("testString") - createOfferingOptionsModel.ProviderInfo = providerInfoModel - createOfferingOptionsModel.RepoInfo = repoInfoModel - createOfferingOptionsModel.Support = supportModel - createOfferingOptionsModel.Media = []catalogmanagementv1.MediaItem{*mediaItemModel} - createOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateOfferingOptions model + updateOfferingOptionsModel := new(catalogmanagementv1.UpdateOfferingOptions) + updateOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") + updateOfferingOptionsModel.OfferingID = core.StringPtr("testString") + updateOfferingOptionsModel.IfMatch = core.StringPtr("testString") + updateOfferingOptionsModel.Updates = []catalogmanagementv1.JSONPatchOperation{*jsonPatchOperationModel} + updateOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = catalogManagementService.UpdateOffering(updateOfferingOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke UpdateOffering with error: Operation validation and request error`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Construct an instance of the JSONPatchOperation model + jsonPatchOperationModel := new(catalogmanagementv1.JSONPatchOperation) + jsonPatchOperationModel.Op = core.StringPtr("add") + jsonPatchOperationModel.Path = core.StringPtr("testString") + jsonPatchOperationModel.Value = core.StringPtr("testString") + jsonPatchOperationModel.From = core.StringPtr("testString") + + // Construct an instance of the UpdateOfferingOptions model + updateOfferingOptionsModel := new(catalogmanagementv1.UpdateOfferingOptions) + updateOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") + updateOfferingOptionsModel.OfferingID = core.StringPtr("testString") + updateOfferingOptionsModel.IfMatch = core.StringPtr("testString") + updateOfferingOptionsModel.Updates = []catalogmanagementv1.JSONPatchOperation{*jsonPatchOperationModel} + updateOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := catalogManagementService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := catalogManagementService.CreateOffering(createOfferingOptionsModel) + result, response, operationErr := catalogManagementService.UpdateOffering(updateOfferingOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the CreateOfferingOptions model with no property values - createOfferingOptionsModelNew := new(catalogmanagementv1.CreateOfferingOptions) + // Construct a second instance of the UpdateOfferingOptions model with no property values + updateOfferingOptionsModelNew := new(catalogmanagementv1.UpdateOfferingOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = catalogManagementService.CreateOffering(createOfferingOptionsModelNew) + result, response, operationErr = catalogManagementService.UpdateOffering(updateOfferingOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -4249,224 +11393,34 @@ var _ = Describe(`CatalogManagementV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(201) + res.WriteHeader(200) })) }) - It(`Invoke CreateOffering successfully`, func() { + It(`Invoke UpdateOffering successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(catalogManagementService).ToNot(BeNil()) - - // Construct an instance of the Rating model - ratingModel := new(catalogmanagementv1.Rating) - ratingModel.OneStarCount = core.Int64Ptr(int64(38)) - ratingModel.TwoStarCount = core.Int64Ptr(int64(38)) - ratingModel.ThreeStarCount = core.Int64Ptr(int64(38)) - ratingModel.FourStarCount = core.Int64Ptr(int64(38)) - - // Construct an instance of the Feature model - featureModel := new(catalogmanagementv1.Feature) - featureModel.Title = core.StringPtr("testString") - featureModel.Description = core.StringPtr("testString") - - // Construct an instance of the Configuration model - configurationModel := new(catalogmanagementv1.Configuration) - configurationModel.Key = core.StringPtr("testString") - configurationModel.Type = core.StringPtr("testString") - configurationModel.DefaultValue = core.StringPtr("testString") - configurationModel.ValueConstraint = core.StringPtr("testString") - configurationModel.Description = core.StringPtr("testString") - configurationModel.Required = core.BoolPtr(true) - configurationModel.Options = []interface{}{"testString"} - configurationModel.Hidden = core.BoolPtr(true) - - // Construct an instance of the Validation model - validationModel := new(catalogmanagementv1.Validation) - validationModel.Validated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - validationModel.Requested = CreateMockDateTime("2019-01-01T12:00:00.000Z") - validationModel.State = core.StringPtr("testString") - validationModel.LastOperation = core.StringPtr("testString") - validationModel.Target = make(map[string]interface{}) - - // Construct an instance of the Resource model - resourceModel := new(catalogmanagementv1.Resource) - resourceModel.Type = core.StringPtr("mem") - resourceModel.Value = core.StringPtr("testString") - - // Construct an instance of the Script model - scriptModel := new(catalogmanagementv1.Script) - scriptModel.Instructions = core.StringPtr("testString") - scriptModel.Script = core.StringPtr("testString") - scriptModel.ScriptPermission = core.StringPtr("testString") - scriptModel.DeleteScript = core.StringPtr("testString") - scriptModel.Scope = core.StringPtr("testString") - - // Construct an instance of the VersionEntitlement model - versionEntitlementModel := new(catalogmanagementv1.VersionEntitlement) - versionEntitlementModel.ProviderName = core.StringPtr("testString") - versionEntitlementModel.ProviderID = core.StringPtr("testString") - versionEntitlementModel.ProductID = core.StringPtr("testString") - versionEntitlementModel.PartNumbers = []string{"testString"} - versionEntitlementModel.ImageRepoName = core.StringPtr("testString") - - // Construct an instance of the License model - licenseModel := new(catalogmanagementv1.License) - licenseModel.ID = core.StringPtr("testString") - licenseModel.Name = core.StringPtr("testString") - licenseModel.Type = core.StringPtr("testString") - licenseModel.URL = core.StringPtr("testString") - licenseModel.Description = core.StringPtr("testString") - - // Construct an instance of the State model - stateModel := new(catalogmanagementv1.State) - stateModel.Current = core.StringPtr("testString") - stateModel.CurrentEntered = CreateMockDateTime("2019-01-01T12:00:00.000Z") - stateModel.Pending = core.StringPtr("testString") - stateModel.PendingRequested = CreateMockDateTime("2019-01-01T12:00:00.000Z") - stateModel.Previous = core.StringPtr("testString") - - // Construct an instance of the Version model - versionModel := new(catalogmanagementv1.Version) - versionModel.ID = core.StringPtr("testString") - versionModel.Rev = core.StringPtr("testString") - versionModel.CRN = core.StringPtr("testString") - versionModel.Version = core.StringPtr("testString") - versionModel.Sha = core.StringPtr("testString") - versionModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") - versionModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - versionModel.OfferingID = core.StringPtr("testString") - versionModel.CatalogID = core.StringPtr("testString") - versionModel.KindID = core.StringPtr("testString") - versionModel.Tags = []string{"testString"} - versionModel.RepoURL = core.StringPtr("testString") - versionModel.SourceURL = core.StringPtr("testString") - versionModel.TgzURL = core.StringPtr("testString") - versionModel.Configuration = []catalogmanagementv1.Configuration{*configurationModel} - versionModel.Metadata = make(map[string]interface{}) - versionModel.Validation = validationModel - versionModel.RequiredResources = []catalogmanagementv1.Resource{*resourceModel} - versionModel.SingleInstance = core.BoolPtr(true) - versionModel.Install = scriptModel - versionModel.PreInstall = []catalogmanagementv1.Script{*scriptModel} - versionModel.Entitlement = versionEntitlementModel - versionModel.Licenses = []catalogmanagementv1.License{*licenseModel} - versionModel.ImageManifestURL = core.StringPtr("testString") - versionModel.Deprecated = core.BoolPtr(true) - versionModel.PackageVersion = core.StringPtr("testString") - versionModel.State = stateModel - versionModel.VersionLocator = core.StringPtr("testString") - versionModel.ConsoleURL = core.StringPtr("testString") - versionModel.LongDescription = core.StringPtr("testString") - versionModel.WhitelistedAccounts = []string{"testString"} - - // Construct an instance of the Deployment model - deploymentModel := new(catalogmanagementv1.Deployment) - deploymentModel.ID = core.StringPtr("testString") - deploymentModel.Label = core.StringPtr("testString") - deploymentModel.Name = core.StringPtr("testString") - deploymentModel.ShortDescription = core.StringPtr("testString") - deploymentModel.LongDescription = core.StringPtr("testString") - deploymentModel.Metadata = make(map[string]interface{}) - deploymentModel.Tags = []string{"testString"} - deploymentModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") - deploymentModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - - // Construct an instance of the Plan model - planModel := new(catalogmanagementv1.Plan) - planModel.ID = core.StringPtr("testString") - planModel.Label = core.StringPtr("testString") - planModel.Name = core.StringPtr("testString") - planModel.ShortDescription = core.StringPtr("testString") - planModel.LongDescription = core.StringPtr("testString") - planModel.Metadata = make(map[string]interface{}) - planModel.Tags = []string{"testString"} - planModel.AdditionalFeatures = []catalogmanagementv1.Feature{*featureModel} - planModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") - planModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - planModel.Deployments = []catalogmanagementv1.Deployment{*deploymentModel} - - // Construct an instance of the Kind model - kindModel := new(catalogmanagementv1.Kind) - kindModel.ID = core.StringPtr("testString") - kindModel.FormatKind = core.StringPtr("testString") - kindModel.TargetKind = core.StringPtr("testString") - kindModel.Metadata = make(map[string]interface{}) - kindModel.InstallDescription = core.StringPtr("testString") - kindModel.Tags = []string{"testString"} - kindModel.AdditionalFeatures = []catalogmanagementv1.Feature{*featureModel} - kindModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") - kindModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - kindModel.Versions = []catalogmanagementv1.Version{*versionModel} - kindModel.Plans = []catalogmanagementv1.Plan{*planModel} - - // Construct an instance of the ProviderInfo model - providerInfoModel := new(catalogmanagementv1.ProviderInfo) - providerInfoModel.ID = core.StringPtr("testString") - providerInfoModel.Name = core.StringPtr("testString") - - // Construct an instance of the RepoInfo model - repoInfoModel := new(catalogmanagementv1.RepoInfo) - repoInfoModel.Token = core.StringPtr("testString") - repoInfoModel.Type = core.StringPtr("testString") - - // Construct an instance of the Support model - supportModel := new(catalogmanagementv1.Support) - supportModel.URL = core.StringPtr("testString") - supportModel.Process = core.StringPtr("testString") - supportModel.Locations = []string{"testString"} - - // Construct an instance of the MediaItem model - mediaItemModel := new(catalogmanagementv1.MediaItem) - mediaItemModel.URL = core.StringPtr("testString") - mediaItemModel.Caption = core.StringPtr("testString") - mediaItemModel.Type = core.StringPtr("testString") - mediaItemModel.ThumbnailURL = core.StringPtr("testString") - - // Construct an instance of the CreateOfferingOptions model - createOfferingOptionsModel := new(catalogmanagementv1.CreateOfferingOptions) - createOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") - createOfferingOptionsModel.ID = core.StringPtr("testString") - createOfferingOptionsModel.Rev = core.StringPtr("testString") - createOfferingOptionsModel.URL = core.StringPtr("testString") - createOfferingOptionsModel.CRN = core.StringPtr("testString") - createOfferingOptionsModel.Label = core.StringPtr("testString") - createOfferingOptionsModel.Name = core.StringPtr("testString") - createOfferingOptionsModel.OfferingIconURL = core.StringPtr("testString") - createOfferingOptionsModel.OfferingDocsURL = core.StringPtr("testString") - createOfferingOptionsModel.OfferingSupportURL = core.StringPtr("testString") - createOfferingOptionsModel.Tags = []string{"testString"} - createOfferingOptionsModel.Keywords = []string{"testString"} - createOfferingOptionsModel.Rating = ratingModel - createOfferingOptionsModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") - createOfferingOptionsModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - createOfferingOptionsModel.ShortDescription = core.StringPtr("testString") - createOfferingOptionsModel.LongDescription = core.StringPtr("testString") - createOfferingOptionsModel.Features = []catalogmanagementv1.Feature{*featureModel} - createOfferingOptionsModel.Kinds = []catalogmanagementv1.Kind{*kindModel} - createOfferingOptionsModel.PermitRequestIBMPublicPublish = core.BoolPtr(true) - createOfferingOptionsModel.IBMPublishApproved = core.BoolPtr(true) - createOfferingOptionsModel.PublicPublishApproved = core.BoolPtr(true) - createOfferingOptionsModel.PublicOriginalCRN = core.StringPtr("testString") - createOfferingOptionsModel.PublishPublicCRN = core.StringPtr("testString") - createOfferingOptionsModel.PortalApprovalRecord = core.StringPtr("testString") - createOfferingOptionsModel.PortalUIURL = core.StringPtr("testString") - createOfferingOptionsModel.CatalogID = core.StringPtr("testString") - createOfferingOptionsModel.CatalogName = core.StringPtr("testString") - createOfferingOptionsModel.Metadata = make(map[string]interface{}) - createOfferingOptionsModel.Disclaimer = core.StringPtr("testString") - createOfferingOptionsModel.Hidden = core.BoolPtr(true) - createOfferingOptionsModel.Provider = core.StringPtr("testString") - createOfferingOptionsModel.ProviderInfo = providerInfoModel - createOfferingOptionsModel.RepoInfo = repoInfoModel - createOfferingOptionsModel.Support = supportModel - createOfferingOptionsModel.Media = []catalogmanagementv1.MediaItem{*mediaItemModel} - createOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Construct an instance of the JSONPatchOperation model + jsonPatchOperationModel := new(catalogmanagementv1.JSONPatchOperation) + jsonPatchOperationModel.Op = core.StringPtr("add") + jsonPatchOperationModel.Path = core.StringPtr("testString") + jsonPatchOperationModel.Value = core.StringPtr("testString") + jsonPatchOperationModel.From = core.StringPtr("testString") + + // Construct an instance of the UpdateOfferingOptions model + updateOfferingOptionsModel := new(catalogmanagementv1.UpdateOfferingOptions) + updateOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") + updateOfferingOptionsModel.OfferingID = core.StringPtr("testString") + updateOfferingOptionsModel.IfMatch = core.StringPtr("testString") + updateOfferingOptionsModel.Updates = []catalogmanagementv1.JSONPatchOperation{*jsonPatchOperationModel} + updateOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := catalogManagementService.CreateOffering(createOfferingOptionsModel) + result, response, operationErr := catalogManagementService.UpdateOffering(updateOfferingOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -4478,27 +11432,95 @@ var _ = Describe(`CatalogManagementV1`, func() { }) }) }) - Describe(`ImportOfferingVersion(importOfferingVersionOptions *ImportOfferingVersionOptions) - Operation response error`, func() { - importOfferingVersionPath := "/catalogs/testString/offerings/testString/version" + Describe(`DeleteOffering(deleteOfferingOptions *DeleteOfferingOptions)`, func() { + deleteOfferingPath := "/catalogs/testString/offerings/testString" + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(deleteOfferingPath)) + Expect(req.Method).To(Equal("DELETE")) + + res.WriteHeader(200) + })) + }) + It(`Invoke DeleteOffering successfully`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + response, operationErr := catalogManagementService.DeleteOffering(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteOfferingOptions model + deleteOfferingOptionsModel := new(catalogmanagementv1.DeleteOfferingOptions) + deleteOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") + deleteOfferingOptionsModel.OfferingID = core.StringPtr("testString") + deleteOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = catalogManagementService.DeleteOffering(deleteOfferingOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteOffering with error: Operation validation and request error`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Construct an instance of the DeleteOfferingOptions model + deleteOfferingOptionsModel := new(catalogmanagementv1.DeleteOfferingOptions) + deleteOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") + deleteOfferingOptionsModel.OfferingID = core.StringPtr("testString") + deleteOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := catalogManagementService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := catalogManagementService.DeleteOffering(deleteOfferingOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteOfferingOptions model with no property values + deleteOfferingOptionsModelNew := new(catalogmanagementv1.DeleteOfferingOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = catalogManagementService.DeleteOffering(deleteOfferingOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListOfferingAudits(listOfferingAuditsOptions *ListOfferingAuditsOptions) - Operation response error`, func() { + listOfferingAuditsPath := "/catalogs/testString/offerings/testString/audits" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(importOfferingVersionPath)) - Expect(req.Method).To(Equal("POST")) - Expect(req.URL.Query()["zipurl"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["targetVersion"]).To(Equal([]string{"testString"})) - // TODO: Add check for includeConfig query parameter - // TODO: Add check for isVSI query parameter - Expect(req.URL.Query()["repoType"]).To(Equal([]string{"testString"})) + Expect(req.URL.EscapedPath()).To(Equal(listOfferingAuditsPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + // TODO: Add check for lookupnames query parameter res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, `} this is not valid json {`) + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ImportOfferingVersion with error: Operation response processing error`, func() { + It(`Invoke ListOfferingAudits with error: Operation response processing error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -4506,28 +11528,23 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the ImportOfferingVersionOptions model - importOfferingVersionOptionsModel := new(catalogmanagementv1.ImportOfferingVersionOptions) - importOfferingVersionOptionsModel.CatalogIdentifier = core.StringPtr("testString") - importOfferingVersionOptionsModel.OfferingID = core.StringPtr("testString") - importOfferingVersionOptionsModel.Tags = []string{"testString"} - importOfferingVersionOptionsModel.TargetKinds = []string{"testString"} - importOfferingVersionOptionsModel.Content = CreateMockByteArray("This is a mock byte array value.") - importOfferingVersionOptionsModel.Zipurl = core.StringPtr("testString") - importOfferingVersionOptionsModel.TargetVersion = core.StringPtr("testString") - importOfferingVersionOptionsModel.IncludeConfig = core.BoolPtr(true) - importOfferingVersionOptionsModel.IsVsi = core.BoolPtr(true) - importOfferingVersionOptionsModel.RepoType = core.StringPtr("testString") - importOfferingVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListOfferingAuditsOptions model + listOfferingAuditsOptionsModel := new(catalogmanagementv1.ListOfferingAuditsOptions) + listOfferingAuditsOptionsModel.CatalogIdentifier = core.StringPtr("testString") + listOfferingAuditsOptionsModel.OfferingID = core.StringPtr("testString") + listOfferingAuditsOptionsModel.Start = core.StringPtr("testString") + listOfferingAuditsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listOfferingAuditsOptionsModel.Lookupnames = core.BoolPtr(true) + listOfferingAuditsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := catalogManagementService.ImportOfferingVersion(importOfferingVersionOptionsModel) + result, response, operationErr := catalogManagementService.ListOfferingAudits(listOfferingAuditsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again catalogManagementService.EnableRetries(0, 0) - result, response, operationErr = catalogManagementService.ImportOfferingVersion(importOfferingVersionOptionsModel) + result, response, operationErr = catalogManagementService.ListOfferingAudits(listOfferingAuditsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -4537,48 +11554,30 @@ var _ = Describe(`CatalogManagementV1`, func() { }) }) }) - Describe(`ImportOfferingVersion(importOfferingVersionOptions *ImportOfferingVersionOptions)`, func() { - importOfferingVersionPath := "/catalogs/testString/offerings/testString/version" + Describe(`ListOfferingAudits(listOfferingAuditsOptions *ListOfferingAuditsOptions)`, func() { + listOfferingAuditsPath := "/catalogs/testString/offerings/testString/audits" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(importOfferingVersionPath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(listOfferingAuditsPath)) + Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["zipurl"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["targetVersion"]).To(Equal([]string{"testString"})) - // TODO: Add check for includeConfig query parameter - // TODO: Add check for isVSI query parameter - Expect(req.URL.Query()["repoType"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + // TODO: Add check for lookupnames query parameter // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "url": "URL", "crn": "CRN", "label": "Label", "name": "Name", "offering_icon_url": "OfferingIconURL", "offering_docs_url": "OfferingDocsURL", "offering_support_url": "OfferingSupportURL", "tags": ["Tags"], "keywords": ["Keywords"], "rating": {"one_star_count": 12, "two_star_count": 12, "three_star_count": 14, "four_star_count": 13}, "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "short_description": "ShortDescription", "long_description": "LongDescription", "features": [{"title": "Title", "description": "Description"}], "kinds": [{"id": "ID", "format_kind": "FormatKind", "target_kind": "TargetKind", "metadata": {"mapKey": "anyValue"}, "install_description": "InstallDescription", "tags": ["Tags"], "additional_features": [{"title": "Title", "description": "Description"}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "versions": [{"id": "ID", "_rev": "Rev", "crn": "CRN", "version": "Version", "sha": "Sha", "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "offering_id": "OfferingID", "catalog_id": "CatalogID", "kind_id": "KindID", "tags": ["Tags"], "repo_url": "RepoURL", "source_url": "SourceURL", "tgz_url": "TgzURL", "configuration": [{"key": "Key", "type": "Type", "default_value": "anyValue", "value_constraint": "ValueConstraint", "description": "Description", "required": true, "options": ["anyValue"], "hidden": true}], "metadata": {"mapKey": "anyValue"}, "validation": {"validated": "2019-01-01T12:00:00.000Z", "requested": "2019-01-01T12:00:00.000Z", "state": "State", "last_operation": "LastOperation", "target": {"mapKey": "anyValue"}}, "required_resources": [{"type": "mem", "value": "anyValue"}], "single_instance": true, "install": {"instructions": "Instructions", "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}, "pre_install": [{"instructions": "Instructions", "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}], "entitlement": {"provider_name": "ProviderName", "provider_id": "ProviderID", "product_id": "ProductID", "part_numbers": ["PartNumbers"], "image_repo_name": "ImageRepoName"}, "licenses": [{"id": "ID", "name": "Name", "type": "Type", "url": "URL", "description": "Description"}], "image_manifest_url": "ImageManifestURL", "deprecated": true, "package_version": "PackageVersion", "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "version_locator": "VersionLocator", "console_url": "ConsoleURL", "long_description": "LongDescription", "whitelisted_accounts": ["WhitelistedAccounts"]}], "plans": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "additional_features": [{"title": "Title", "description": "Description"}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "deployments": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z"}]}]}], "permit_request_ibm_public_publish": false, "ibm_publish_approved": true, "public_publish_approved": false, "public_original_crn": "PublicOriginalCRN", "publish_public_crn": "PublishPublicCRN", "portal_approval_record": "PortalApprovalRecord", "portal_ui_url": "PortalUIURL", "catalog_id": "CatalogID", "catalog_name": "CatalogName", "metadata": {"mapKey": "anyValue"}, "disclaimer": "Disclaimer", "hidden": true, "provider": "Provider", "provider_info": {"id": "ID", "name": "Name"}, "repo_info": {"token": "Token", "type": "Type"}, "support": {"url": "URL", "process": "Process", "locations": ["Locations"]}, "media": [{"url": "URL", "caption": "Caption", "type": "Type", "thumbnail_url": "ThumbnailURL"}]}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"start": "Start", "limit": 5, "total_count": 10, "resource_count": 13, "first": {"href": "Href", "start": "Start"}, "next": {"href": "Href", "start": "Start"}, "prev": {"href": "Href", "start": "Start"}, "last": {"href": "Href", "start": "Start"}, "audits": [{"id": "ID", "_rev": "Rev", "created": "2019-01-01T12:00:00.000Z", "change_type": "ChangeType", "target_type": "TargetType", "target_id": "TargetID", "who_email": "WhoEmail", "who_delegate_email": "WhoDelegateEmail", "message": "Message"}]}`) })) }) - It(`Invoke ImportOfferingVersion successfully with retries`, func() { + It(`Invoke ListOfferingAudits successfully with retries`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -4587,30 +11586,25 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) catalogManagementService.EnableRetries(0, 0) - // Construct an instance of the ImportOfferingVersionOptions model - importOfferingVersionOptionsModel := new(catalogmanagementv1.ImportOfferingVersionOptions) - importOfferingVersionOptionsModel.CatalogIdentifier = core.StringPtr("testString") - importOfferingVersionOptionsModel.OfferingID = core.StringPtr("testString") - importOfferingVersionOptionsModel.Tags = []string{"testString"} - importOfferingVersionOptionsModel.TargetKinds = []string{"testString"} - importOfferingVersionOptionsModel.Content = CreateMockByteArray("This is a mock byte array value.") - importOfferingVersionOptionsModel.Zipurl = core.StringPtr("testString") - importOfferingVersionOptionsModel.TargetVersion = core.StringPtr("testString") - importOfferingVersionOptionsModel.IncludeConfig = core.BoolPtr(true) - importOfferingVersionOptionsModel.IsVsi = core.BoolPtr(true) - importOfferingVersionOptionsModel.RepoType = core.StringPtr("testString") - importOfferingVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListOfferingAuditsOptions model + listOfferingAuditsOptionsModel := new(catalogmanagementv1.ListOfferingAuditsOptions) + listOfferingAuditsOptionsModel.CatalogIdentifier = core.StringPtr("testString") + listOfferingAuditsOptionsModel.OfferingID = core.StringPtr("testString") + listOfferingAuditsOptionsModel.Start = core.StringPtr("testString") + listOfferingAuditsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listOfferingAuditsOptionsModel.Lookupnames = core.BoolPtr(true) + listOfferingAuditsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := catalogManagementService.ImportOfferingVersionWithContext(ctx, importOfferingVersionOptionsModel) + _, _, operationErr := catalogManagementService.ListOfferingAuditsWithContext(ctx, listOfferingAuditsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again catalogManagementService.DisableRetries() - result, response, operationErr := catalogManagementService.ImportOfferingVersion(importOfferingVersionOptionsModel) + result, response, operationErr := catalogManagementService.ListOfferingAudits(listOfferingAuditsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -4618,7 +11612,7 @@ var _ = Describe(`CatalogManagementV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = catalogManagementService.ImportOfferingVersionWithContext(ctx, importOfferingVersionOptionsModel) + _, _, operationErr = catalogManagementService.ListOfferingAuditsWithContext(ctx, listOfferingAuditsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -4632,37 +11626,19 @@ var _ = Describe(`CatalogManagementV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(importOfferingVersionPath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(listOfferingAuditsPath)) + Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["zipurl"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["targetVersion"]).To(Equal([]string{"testString"})) - // TODO: Add check for includeConfig query parameter - // TODO: Add check for isVSI query parameter - Expect(req.URL.Query()["repoType"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + // TODO: Add check for lookupnames query parameter // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "url": "URL", "crn": "CRN", "label": "Label", "name": "Name", "offering_icon_url": "OfferingIconURL", "offering_docs_url": "OfferingDocsURL", "offering_support_url": "OfferingSupportURL", "tags": ["Tags"], "keywords": ["Keywords"], "rating": {"one_star_count": 12, "two_star_count": 12, "three_star_count": 14, "four_star_count": 13}, "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "short_description": "ShortDescription", "long_description": "LongDescription", "features": [{"title": "Title", "description": "Description"}], "kinds": [{"id": "ID", "format_kind": "FormatKind", "target_kind": "TargetKind", "metadata": {"mapKey": "anyValue"}, "install_description": "InstallDescription", "tags": ["Tags"], "additional_features": [{"title": "Title", "description": "Description"}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "versions": [{"id": "ID", "_rev": "Rev", "crn": "CRN", "version": "Version", "sha": "Sha", "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "offering_id": "OfferingID", "catalog_id": "CatalogID", "kind_id": "KindID", "tags": ["Tags"], "repo_url": "RepoURL", "source_url": "SourceURL", "tgz_url": "TgzURL", "configuration": [{"key": "Key", "type": "Type", "default_value": "anyValue", "value_constraint": "ValueConstraint", "description": "Description", "required": true, "options": ["anyValue"], "hidden": true}], "metadata": {"mapKey": "anyValue"}, "validation": {"validated": "2019-01-01T12:00:00.000Z", "requested": "2019-01-01T12:00:00.000Z", "state": "State", "last_operation": "LastOperation", "target": {"mapKey": "anyValue"}}, "required_resources": [{"type": "mem", "value": "anyValue"}], "single_instance": true, "install": {"instructions": "Instructions", "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}, "pre_install": [{"instructions": "Instructions", "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}], "entitlement": {"provider_name": "ProviderName", "provider_id": "ProviderID", "product_id": "ProductID", "part_numbers": ["PartNumbers"], "image_repo_name": "ImageRepoName"}, "licenses": [{"id": "ID", "name": "Name", "type": "Type", "url": "URL", "description": "Description"}], "image_manifest_url": "ImageManifestURL", "deprecated": true, "package_version": "PackageVersion", "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "version_locator": "VersionLocator", "console_url": "ConsoleURL", "long_description": "LongDescription", "whitelisted_accounts": ["WhitelistedAccounts"]}], "plans": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "additional_features": [{"title": "Title", "description": "Description"}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "deployments": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z"}]}]}], "permit_request_ibm_public_publish": false, "ibm_publish_approved": true, "public_publish_approved": false, "public_original_crn": "PublicOriginalCRN", "publish_public_crn": "PublishPublicCRN", "portal_approval_record": "PortalApprovalRecord", "portal_ui_url": "PortalUIURL", "catalog_id": "CatalogID", "catalog_name": "CatalogName", "metadata": {"mapKey": "anyValue"}, "disclaimer": "Disclaimer", "hidden": true, "provider": "Provider", "provider_info": {"id": "ID", "name": "Name"}, "repo_info": {"token": "Token", "type": "Type"}, "support": {"url": "URL", "process": "Process", "locations": ["Locations"]}, "media": [{"url": "URL", "caption": "Caption", "type": "Type", "thumbnail_url": "ThumbnailURL"}]}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"start": "Start", "limit": 5, "total_count": 10, "resource_count": 13, "first": {"href": "Href", "start": "Start"}, "next": {"href": "Href", "start": "Start"}, "prev": {"href": "Href", "start": "Start"}, "last": {"href": "Href", "start": "Start"}, "audits": [{"id": "ID", "_rev": "Rev", "created": "2019-01-01T12:00:00.000Z", "change_type": "ChangeType", "target_type": "TargetType", "target_id": "TargetID", "who_email": "WhoEmail", "who_delegate_email": "WhoDelegateEmail", "message": "Message"}]}`) })) }) - It(`Invoke ImportOfferingVersion successfully`, func() { + It(`Invoke ListOfferingAudits successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -4671,33 +11647,28 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := catalogManagementService.ImportOfferingVersion(nil) + result, response, operationErr := catalogManagementService.ListOfferingAudits(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ImportOfferingVersionOptions model - importOfferingVersionOptionsModel := new(catalogmanagementv1.ImportOfferingVersionOptions) - importOfferingVersionOptionsModel.CatalogIdentifier = core.StringPtr("testString") - importOfferingVersionOptionsModel.OfferingID = core.StringPtr("testString") - importOfferingVersionOptionsModel.Tags = []string{"testString"} - importOfferingVersionOptionsModel.TargetKinds = []string{"testString"} - importOfferingVersionOptionsModel.Content = CreateMockByteArray("This is a mock byte array value.") - importOfferingVersionOptionsModel.Zipurl = core.StringPtr("testString") - importOfferingVersionOptionsModel.TargetVersion = core.StringPtr("testString") - importOfferingVersionOptionsModel.IncludeConfig = core.BoolPtr(true) - importOfferingVersionOptionsModel.IsVsi = core.BoolPtr(true) - importOfferingVersionOptionsModel.RepoType = core.StringPtr("testString") - importOfferingVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListOfferingAuditsOptions model + listOfferingAuditsOptionsModel := new(catalogmanagementv1.ListOfferingAuditsOptions) + listOfferingAuditsOptionsModel.CatalogIdentifier = core.StringPtr("testString") + listOfferingAuditsOptionsModel.OfferingID = core.StringPtr("testString") + listOfferingAuditsOptionsModel.Start = core.StringPtr("testString") + listOfferingAuditsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listOfferingAuditsOptionsModel.Lookupnames = core.BoolPtr(true) + listOfferingAuditsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = catalogManagementService.ImportOfferingVersion(importOfferingVersionOptionsModel) + result, response, operationErr = catalogManagementService.ListOfferingAudits(listOfferingAuditsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ImportOfferingVersion with error: Operation validation and request error`, func() { + It(`Invoke ListOfferingAudits with error: Operation validation and request error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -4705,31 +11676,26 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the ImportOfferingVersionOptions model - importOfferingVersionOptionsModel := new(catalogmanagementv1.ImportOfferingVersionOptions) - importOfferingVersionOptionsModel.CatalogIdentifier = core.StringPtr("testString") - importOfferingVersionOptionsModel.OfferingID = core.StringPtr("testString") - importOfferingVersionOptionsModel.Tags = []string{"testString"} - importOfferingVersionOptionsModel.TargetKinds = []string{"testString"} - importOfferingVersionOptionsModel.Content = CreateMockByteArray("This is a mock byte array value.") - importOfferingVersionOptionsModel.Zipurl = core.StringPtr("testString") - importOfferingVersionOptionsModel.TargetVersion = core.StringPtr("testString") - importOfferingVersionOptionsModel.IncludeConfig = core.BoolPtr(true) - importOfferingVersionOptionsModel.IsVsi = core.BoolPtr(true) - importOfferingVersionOptionsModel.RepoType = core.StringPtr("testString") - importOfferingVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListOfferingAuditsOptions model + listOfferingAuditsOptionsModel := new(catalogmanagementv1.ListOfferingAuditsOptions) + listOfferingAuditsOptionsModel.CatalogIdentifier = core.StringPtr("testString") + listOfferingAuditsOptionsModel.OfferingID = core.StringPtr("testString") + listOfferingAuditsOptionsModel.Start = core.StringPtr("testString") + listOfferingAuditsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listOfferingAuditsOptionsModel.Lookupnames = core.BoolPtr(true) + listOfferingAuditsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := catalogManagementService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := catalogManagementService.ImportOfferingVersion(importOfferingVersionOptionsModel) + result, response, operationErr := catalogManagementService.ListOfferingAudits(listOfferingAuditsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the ImportOfferingVersionOptions model with no property values - importOfferingVersionOptionsModelNew := new(catalogmanagementv1.ImportOfferingVersionOptions) + // Construct a second instance of the ListOfferingAuditsOptions model with no property values + listOfferingAuditsOptionsModelNew := new(catalogmanagementv1.ListOfferingAuditsOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = catalogManagementService.ImportOfferingVersion(importOfferingVersionOptionsModelNew) + result, response, operationErr = catalogManagementService.ListOfferingAudits(listOfferingAuditsOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -4744,10 +11710,81 @@ var _ = Describe(`CatalogManagementV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(201) + res.WriteHeader(200) + })) + }) + It(`Invoke ListOfferingAudits successfully`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Construct an instance of the ListOfferingAuditsOptions model + listOfferingAuditsOptionsModel := new(catalogmanagementv1.ListOfferingAuditsOptions) + listOfferingAuditsOptionsModel.CatalogIdentifier = core.StringPtr("testString") + listOfferingAuditsOptionsModel.OfferingID = core.StringPtr("testString") + listOfferingAuditsOptionsModel.Start = core.StringPtr("testString") + listOfferingAuditsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listOfferingAuditsOptionsModel.Lookupnames = core.BoolPtr(true) + listOfferingAuditsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := catalogManagementService.ListOfferingAudits(listOfferingAuditsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Test pagination helper method on response`, func() { + It(`Invoke GetNextStart successfully`, func() { + responseObject := new(catalogmanagementv1.AuditLogs) + nextObject := new(catalogmanagementv1.PaginationTokenLink) + nextObject.Start = core.StringPtr("abc-123") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(Equal(core.StringPtr("abc-123"))) + }) + It(`Invoke GetNextStart without a "Next" property in the response`, func() { + responseObject := new(catalogmanagementv1.AuditLogs) + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + Context(`Using mock server endpoint - paginated response`, func() { + BeforeEach(func() { + var requestNumber int = 0 + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listOfferingAuditsPath)) + Expect(req.Method).To(Equal("GET")) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + requestNumber++ + if requestNumber == 1 { + fmt.Fprintf(res, "%s", `{"next":{"start":"1"},"total_count":2,"limit":1,"audits":[{"id":"ID","_rev":"Rev","created":"2019-01-01T12:00:00.000Z","change_type":"ChangeType","target_type":"TargetType","target_id":"TargetID","who_email":"WhoEmail","who_delegate_email":"WhoDelegateEmail","message":"Message"}]}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"audits":[{"id":"ID","_rev":"Rev","created":"2019-01-01T12:00:00.000Z","change_type":"ChangeType","target_type":"TargetType","target_id":"TargetID","who_email":"WhoEmail","who_delegate_email":"WhoDelegateEmail","message":"Message"}]}`) + } else { + res.WriteHeader(400) + } })) }) - It(`Invoke ImportOfferingVersion successfully`, func() { + It(`Use OfferingAuditsPager.GetNext successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -4755,57 +11792,69 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the ImportOfferingVersionOptions model - importOfferingVersionOptionsModel := new(catalogmanagementv1.ImportOfferingVersionOptions) - importOfferingVersionOptionsModel.CatalogIdentifier = core.StringPtr("testString") - importOfferingVersionOptionsModel.OfferingID = core.StringPtr("testString") - importOfferingVersionOptionsModel.Tags = []string{"testString"} - importOfferingVersionOptionsModel.TargetKinds = []string{"testString"} - importOfferingVersionOptionsModel.Content = CreateMockByteArray("This is a mock byte array value.") - importOfferingVersionOptionsModel.Zipurl = core.StringPtr("testString") - importOfferingVersionOptionsModel.TargetVersion = core.StringPtr("testString") - importOfferingVersionOptionsModel.IncludeConfig = core.BoolPtr(true) - importOfferingVersionOptionsModel.IsVsi = core.BoolPtr(true) - importOfferingVersionOptionsModel.RepoType = core.StringPtr("testString") - importOfferingVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := catalogManagementService.ImportOfferingVersion(importOfferingVersionOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) + listOfferingAuditsOptionsModel := &catalogmanagementv1.ListOfferingAuditsOptions{ + CatalogIdentifier: core.StringPtr("testString"), + OfferingID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + Lookupnames: core.BoolPtr(true), + } - // Verify a nil result - Expect(result).To(BeNil()) + pager, err := catalogManagementService.NewOfferingAuditsPager(listOfferingAuditsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []catalogmanagementv1.AuditLogDigest + for pager.HasNext() { + nextPage, err := pager.GetNext() + Expect(err).To(BeNil()) + Expect(nextPage).ToNot(BeNil()) + allResults = append(allResults, nextPage...) + } + Expect(len(allResults)).To(Equal(2)) }) - AfterEach(func() { - testServer.Close() + It(`Use OfferingAuditsPager.GetAll successfully`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + listOfferingAuditsOptionsModel := &catalogmanagementv1.ListOfferingAuditsOptions{ + CatalogIdentifier: core.StringPtr("testString"), + OfferingID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + Lookupnames: core.BoolPtr(true), + } + + pager, err := catalogManagementService.NewOfferingAuditsPager(listOfferingAuditsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + allResults, err := pager.GetAll() + Expect(err).To(BeNil()) + Expect(allResults).ToNot(BeNil()) + Expect(len(allResults)).To(Equal(2)) }) }) }) - Describe(`ImportOffering(importOfferingOptions *ImportOfferingOptions) - Operation response error`, func() { - importOfferingPath := "/catalogs/testString/import/offerings" + Describe(`GetOfferingAudit(getOfferingAuditOptions *GetOfferingAuditOptions) - Operation response error`, func() { + getOfferingAuditPath := "/catalogs/testString/offerings/testString/audits/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(importOfferingPath)) - Expect(req.Method).To(Equal("POST")) - Expect(req.Header["X-Auth-Token"]).ToNot(BeNil()) - Expect(req.Header["X-Auth-Token"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["zipurl"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["offeringID"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["targetVersion"]).To(Equal([]string{"testString"})) - // TODO: Add check for includeConfig query parameter - // TODO: Add check for isVSI query parameter - Expect(req.URL.Query()["repoType"]).To(Equal([]string{"testString"})) + Expect(req.URL.EscapedPath()).To(Equal(getOfferingAuditPath)) + Expect(req.Method).To(Equal("GET")) + // TODO: Add check for lookupnames query parameter res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, `} this is not valid json {`) + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ImportOffering with error: Operation response processing error`, func() { + It(`Invoke GetOfferingAudit with error: Operation response processing error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -4813,29 +11862,22 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the ImportOfferingOptions model - importOfferingOptionsModel := new(catalogmanagementv1.ImportOfferingOptions) - importOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") - importOfferingOptionsModel.Tags = []string{"testString"} - importOfferingOptionsModel.TargetKinds = []string{"testString"} - importOfferingOptionsModel.Content = CreateMockByteArray("This is a mock byte array value.") - importOfferingOptionsModel.Zipurl = core.StringPtr("testString") - importOfferingOptionsModel.OfferingID = core.StringPtr("testString") - importOfferingOptionsModel.TargetVersion = core.StringPtr("testString") - importOfferingOptionsModel.IncludeConfig = core.BoolPtr(true) - importOfferingOptionsModel.IsVsi = core.BoolPtr(true) - importOfferingOptionsModel.RepoType = core.StringPtr("testString") - importOfferingOptionsModel.XAuthToken = core.StringPtr("testString") - importOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetOfferingAuditOptions model + getOfferingAuditOptionsModel := new(catalogmanagementv1.GetOfferingAuditOptions) + getOfferingAuditOptionsModel.CatalogIdentifier = core.StringPtr("testString") + getOfferingAuditOptionsModel.OfferingID = core.StringPtr("testString") + getOfferingAuditOptionsModel.AuditlogIdentifier = core.StringPtr("testString") + getOfferingAuditOptionsModel.Lookupnames = core.BoolPtr(true) + getOfferingAuditOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := catalogManagementService.ImportOffering(importOfferingOptionsModel) + result, response, operationErr := catalogManagementService.GetOfferingAudit(getOfferingAuditOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again catalogManagementService.EnableRetries(0, 0) - result, response, operationErr = catalogManagementService.ImportOffering(importOfferingOptionsModel) + result, response, operationErr = catalogManagementService.GetOfferingAudit(getOfferingAuditOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -4845,51 +11887,28 @@ var _ = Describe(`CatalogManagementV1`, func() { }) }) }) - Describe(`ImportOffering(importOfferingOptions *ImportOfferingOptions)`, func() { - importOfferingPath := "/catalogs/testString/import/offerings" + Describe(`GetOfferingAudit(getOfferingAuditOptions *GetOfferingAuditOptions)`, func() { + getOfferingAuditPath := "/catalogs/testString/offerings/testString/audits/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(importOfferingPath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(getOfferingAuditPath)) + Expect(req.Method).To(Equal("GET")) - Expect(req.Header["X-Auth-Token"]).ToNot(BeNil()) - Expect(req.Header["X-Auth-Token"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["zipurl"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["offeringID"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["targetVersion"]).To(Equal([]string{"testString"})) - // TODO: Add check for includeConfig query parameter - // TODO: Add check for isVSI query parameter - Expect(req.URL.Query()["repoType"]).To(Equal([]string{"testString"})) + // TODO: Add check for lookupnames query parameter // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "url": "URL", "crn": "CRN", "label": "Label", "name": "Name", "offering_icon_url": "OfferingIconURL", "offering_docs_url": "OfferingDocsURL", "offering_support_url": "OfferingSupportURL", "tags": ["Tags"], "keywords": ["Keywords"], "rating": {"one_star_count": 12, "two_star_count": 12, "three_star_count": 14, "four_star_count": 13}, "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "short_description": "ShortDescription", "long_description": "LongDescription", "features": [{"title": "Title", "description": "Description"}], "kinds": [{"id": "ID", "format_kind": "FormatKind", "target_kind": "TargetKind", "metadata": {"mapKey": "anyValue"}, "install_description": "InstallDescription", "tags": ["Tags"], "additional_features": [{"title": "Title", "description": "Description"}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "versions": [{"id": "ID", "_rev": "Rev", "crn": "CRN", "version": "Version", "sha": "Sha", "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "offering_id": "OfferingID", "catalog_id": "CatalogID", "kind_id": "KindID", "tags": ["Tags"], "repo_url": "RepoURL", "source_url": "SourceURL", "tgz_url": "TgzURL", "configuration": [{"key": "Key", "type": "Type", "default_value": "anyValue", "value_constraint": "ValueConstraint", "description": "Description", "required": true, "options": ["anyValue"], "hidden": true}], "metadata": {"mapKey": "anyValue"}, "validation": {"validated": "2019-01-01T12:00:00.000Z", "requested": "2019-01-01T12:00:00.000Z", "state": "State", "last_operation": "LastOperation", "target": {"mapKey": "anyValue"}}, "required_resources": [{"type": "mem", "value": "anyValue"}], "single_instance": true, "install": {"instructions": "Instructions", "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}, "pre_install": [{"instructions": "Instructions", "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}], "entitlement": {"provider_name": "ProviderName", "provider_id": "ProviderID", "product_id": "ProductID", "part_numbers": ["PartNumbers"], "image_repo_name": "ImageRepoName"}, "licenses": [{"id": "ID", "name": "Name", "type": "Type", "url": "URL", "description": "Description"}], "image_manifest_url": "ImageManifestURL", "deprecated": true, "package_version": "PackageVersion", "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "version_locator": "VersionLocator", "console_url": "ConsoleURL", "long_description": "LongDescription", "whitelisted_accounts": ["WhitelistedAccounts"]}], "plans": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "additional_features": [{"title": "Title", "description": "Description"}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "deployments": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z"}]}]}], "permit_request_ibm_public_publish": false, "ibm_publish_approved": true, "public_publish_approved": false, "public_original_crn": "PublicOriginalCRN", "publish_public_crn": "PublishPublicCRN", "portal_approval_record": "PortalApprovalRecord", "portal_ui_url": "PortalUIURL", "catalog_id": "CatalogID", "catalog_name": "CatalogName", "metadata": {"mapKey": "anyValue"}, "disclaimer": "Disclaimer", "hidden": true, "provider": "Provider", "provider_info": {"id": "ID", "name": "Name"}, "repo_info": {"token": "Token", "type": "Type"}, "support": {"url": "URL", "process": "Process", "locations": ["Locations"]}, "media": [{"url": "URL", "caption": "Caption", "type": "Type", "thumbnail_url": "ThumbnailURL"}]}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "created": "2019-01-01T12:00:00.000Z", "change_type": "ChangeType", "target_type": "TargetType", "target_id": "TargetID", "who_email": "WhoEmail", "who_delegate_email": "WhoDelegateEmail", "message": "Message", "gid": "Gid", "who_id": "WhoID", "who_name": "WhoName", "who_delegate_id": "WhoDelegateID", "who_delegate_name": "WhoDelegateName", "data": "anyValue"}`) })) }) - It(`Invoke ImportOffering successfully with retries`, func() { + It(`Invoke GetOfferingAudit successfully with retries`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -4898,31 +11917,24 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) catalogManagementService.EnableRetries(0, 0) - // Construct an instance of the ImportOfferingOptions model - importOfferingOptionsModel := new(catalogmanagementv1.ImportOfferingOptions) - importOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") - importOfferingOptionsModel.Tags = []string{"testString"} - importOfferingOptionsModel.TargetKinds = []string{"testString"} - importOfferingOptionsModel.Content = CreateMockByteArray("This is a mock byte array value.") - importOfferingOptionsModel.Zipurl = core.StringPtr("testString") - importOfferingOptionsModel.OfferingID = core.StringPtr("testString") - importOfferingOptionsModel.TargetVersion = core.StringPtr("testString") - importOfferingOptionsModel.IncludeConfig = core.BoolPtr(true) - importOfferingOptionsModel.IsVsi = core.BoolPtr(true) - importOfferingOptionsModel.RepoType = core.StringPtr("testString") - importOfferingOptionsModel.XAuthToken = core.StringPtr("testString") - importOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetOfferingAuditOptions model + getOfferingAuditOptionsModel := new(catalogmanagementv1.GetOfferingAuditOptions) + getOfferingAuditOptionsModel.CatalogIdentifier = core.StringPtr("testString") + getOfferingAuditOptionsModel.OfferingID = core.StringPtr("testString") + getOfferingAuditOptionsModel.AuditlogIdentifier = core.StringPtr("testString") + getOfferingAuditOptionsModel.Lookupnames = core.BoolPtr(true) + getOfferingAuditOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := catalogManagementService.ImportOfferingWithContext(ctx, importOfferingOptionsModel) + _, _, operationErr := catalogManagementService.GetOfferingAuditWithContext(ctx, getOfferingAuditOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again catalogManagementService.DisableRetries() - result, response, operationErr := catalogManagementService.ImportOffering(importOfferingOptionsModel) + result, response, operationErr := catalogManagementService.GetOfferingAudit(getOfferingAuditOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -4930,7 +11942,7 @@ var _ = Describe(`CatalogManagementV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = catalogManagementService.ImportOfferingWithContext(ctx, importOfferingOptionsModel) + _, _, operationErr = catalogManagementService.GetOfferingAuditWithContext(ctx, getOfferingAuditOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -4944,40 +11956,17 @@ var _ = Describe(`CatalogManagementV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(importOfferingPath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(getOfferingAuditPath)) + Expect(req.Method).To(Equal("GET")) - Expect(req.Header["X-Auth-Token"]).ToNot(BeNil()) - Expect(req.Header["X-Auth-Token"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["zipurl"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["offeringID"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["targetVersion"]).To(Equal([]string{"testString"})) - // TODO: Add check for includeConfig query parameter - // TODO: Add check for isVSI query parameter - Expect(req.URL.Query()["repoType"]).To(Equal([]string{"testString"})) + // TODO: Add check for lookupnames query parameter // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "url": "URL", "crn": "CRN", "label": "Label", "name": "Name", "offering_icon_url": "OfferingIconURL", "offering_docs_url": "OfferingDocsURL", "offering_support_url": "OfferingSupportURL", "tags": ["Tags"], "keywords": ["Keywords"], "rating": {"one_star_count": 12, "two_star_count": 12, "three_star_count": 14, "four_star_count": 13}, "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "short_description": "ShortDescription", "long_description": "LongDescription", "features": [{"title": "Title", "description": "Description"}], "kinds": [{"id": "ID", "format_kind": "FormatKind", "target_kind": "TargetKind", "metadata": {"mapKey": "anyValue"}, "install_description": "InstallDescription", "tags": ["Tags"], "additional_features": [{"title": "Title", "description": "Description"}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "versions": [{"id": "ID", "_rev": "Rev", "crn": "CRN", "version": "Version", "sha": "Sha", "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "offering_id": "OfferingID", "catalog_id": "CatalogID", "kind_id": "KindID", "tags": ["Tags"], "repo_url": "RepoURL", "source_url": "SourceURL", "tgz_url": "TgzURL", "configuration": [{"key": "Key", "type": "Type", "default_value": "anyValue", "value_constraint": "ValueConstraint", "description": "Description", "required": true, "options": ["anyValue"], "hidden": true}], "metadata": {"mapKey": "anyValue"}, "validation": {"validated": "2019-01-01T12:00:00.000Z", "requested": "2019-01-01T12:00:00.000Z", "state": "State", "last_operation": "LastOperation", "target": {"mapKey": "anyValue"}}, "required_resources": [{"type": "mem", "value": "anyValue"}], "single_instance": true, "install": {"instructions": "Instructions", "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}, "pre_install": [{"instructions": "Instructions", "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}], "entitlement": {"provider_name": "ProviderName", "provider_id": "ProviderID", "product_id": "ProductID", "part_numbers": ["PartNumbers"], "image_repo_name": "ImageRepoName"}, "licenses": [{"id": "ID", "name": "Name", "type": "Type", "url": "URL", "description": "Description"}], "image_manifest_url": "ImageManifestURL", "deprecated": true, "package_version": "PackageVersion", "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "version_locator": "VersionLocator", "console_url": "ConsoleURL", "long_description": "LongDescription", "whitelisted_accounts": ["WhitelistedAccounts"]}], "plans": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "additional_features": [{"title": "Title", "description": "Description"}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "deployments": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z"}]}]}], "permit_request_ibm_public_publish": false, "ibm_publish_approved": true, "public_publish_approved": false, "public_original_crn": "PublicOriginalCRN", "publish_public_crn": "PublishPublicCRN", "portal_approval_record": "PortalApprovalRecord", "portal_ui_url": "PortalUIURL", "catalog_id": "CatalogID", "catalog_name": "CatalogName", "metadata": {"mapKey": "anyValue"}, "disclaimer": "Disclaimer", "hidden": true, "provider": "Provider", "provider_info": {"id": "ID", "name": "Name"}, "repo_info": {"token": "Token", "type": "Type"}, "support": {"url": "URL", "process": "Process", "locations": ["Locations"]}, "media": [{"url": "URL", "caption": "Caption", "type": "Type", "thumbnail_url": "ThumbnailURL"}]}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "created": "2019-01-01T12:00:00.000Z", "change_type": "ChangeType", "target_type": "TargetType", "target_id": "TargetID", "who_email": "WhoEmail", "who_delegate_email": "WhoDelegateEmail", "message": "Message", "gid": "Gid", "who_id": "WhoID", "who_name": "WhoName", "who_delegate_id": "WhoDelegateID", "who_delegate_name": "WhoDelegateName", "data": "anyValue"}`) })) }) - It(`Invoke ImportOffering successfully`, func() { + It(`Invoke GetOfferingAudit successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -4986,34 +11975,27 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := catalogManagementService.ImportOffering(nil) + result, response, operationErr := catalogManagementService.GetOfferingAudit(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ImportOfferingOptions model - importOfferingOptionsModel := new(catalogmanagementv1.ImportOfferingOptions) - importOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") - importOfferingOptionsModel.Tags = []string{"testString"} - importOfferingOptionsModel.TargetKinds = []string{"testString"} - importOfferingOptionsModel.Content = CreateMockByteArray("This is a mock byte array value.") - importOfferingOptionsModel.Zipurl = core.StringPtr("testString") - importOfferingOptionsModel.OfferingID = core.StringPtr("testString") - importOfferingOptionsModel.TargetVersion = core.StringPtr("testString") - importOfferingOptionsModel.IncludeConfig = core.BoolPtr(true) - importOfferingOptionsModel.IsVsi = core.BoolPtr(true) - importOfferingOptionsModel.RepoType = core.StringPtr("testString") - importOfferingOptionsModel.XAuthToken = core.StringPtr("testString") - importOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetOfferingAuditOptions model + getOfferingAuditOptionsModel := new(catalogmanagementv1.GetOfferingAuditOptions) + getOfferingAuditOptionsModel.CatalogIdentifier = core.StringPtr("testString") + getOfferingAuditOptionsModel.OfferingID = core.StringPtr("testString") + getOfferingAuditOptionsModel.AuditlogIdentifier = core.StringPtr("testString") + getOfferingAuditOptionsModel.Lookupnames = core.BoolPtr(true) + getOfferingAuditOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = catalogManagementService.ImportOffering(importOfferingOptionsModel) + result, response, operationErr = catalogManagementService.GetOfferingAudit(getOfferingAuditOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ImportOffering with error: Operation validation and request error`, func() { + It(`Invoke GetOfferingAudit with error: Operation validation and request error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -5021,32 +12003,25 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the ImportOfferingOptions model - importOfferingOptionsModel := new(catalogmanagementv1.ImportOfferingOptions) - importOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") - importOfferingOptionsModel.Tags = []string{"testString"} - importOfferingOptionsModel.TargetKinds = []string{"testString"} - importOfferingOptionsModel.Content = CreateMockByteArray("This is a mock byte array value.") - importOfferingOptionsModel.Zipurl = core.StringPtr("testString") - importOfferingOptionsModel.OfferingID = core.StringPtr("testString") - importOfferingOptionsModel.TargetVersion = core.StringPtr("testString") - importOfferingOptionsModel.IncludeConfig = core.BoolPtr(true) - importOfferingOptionsModel.IsVsi = core.BoolPtr(true) - importOfferingOptionsModel.RepoType = core.StringPtr("testString") - importOfferingOptionsModel.XAuthToken = core.StringPtr("testString") - importOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetOfferingAuditOptions model + getOfferingAuditOptionsModel := new(catalogmanagementv1.GetOfferingAuditOptions) + getOfferingAuditOptionsModel.CatalogIdentifier = core.StringPtr("testString") + getOfferingAuditOptionsModel.OfferingID = core.StringPtr("testString") + getOfferingAuditOptionsModel.AuditlogIdentifier = core.StringPtr("testString") + getOfferingAuditOptionsModel.Lookupnames = core.BoolPtr(true) + getOfferingAuditOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := catalogManagementService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := catalogManagementService.ImportOffering(importOfferingOptionsModel) + result, response, operationErr := catalogManagementService.GetOfferingAudit(getOfferingAuditOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the ImportOfferingOptions model with no property values - importOfferingOptionsModelNew := new(catalogmanagementv1.ImportOfferingOptions) + // Construct a second instance of the GetOfferingAuditOptions model with no property values + getOfferingAuditOptionsModelNew := new(catalogmanagementv1.GetOfferingAuditOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = catalogManagementService.ImportOffering(importOfferingOptionsModelNew) + result, response, operationErr = catalogManagementService.GetOfferingAudit(getOfferingAuditOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -5061,10 +12036,10 @@ var _ = Describe(`CatalogManagementV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(201) + res.WriteHeader(200) })) }) - It(`Invoke ImportOffering successfully`, func() { + It(`Invoke GetOfferingAudit successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -5072,23 +12047,16 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the ImportOfferingOptions model - importOfferingOptionsModel := new(catalogmanagementv1.ImportOfferingOptions) - importOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") - importOfferingOptionsModel.Tags = []string{"testString"} - importOfferingOptionsModel.TargetKinds = []string{"testString"} - importOfferingOptionsModel.Content = CreateMockByteArray("This is a mock byte array value.") - importOfferingOptionsModel.Zipurl = core.StringPtr("testString") - importOfferingOptionsModel.OfferingID = core.StringPtr("testString") - importOfferingOptionsModel.TargetVersion = core.StringPtr("testString") - importOfferingOptionsModel.IncludeConfig = core.BoolPtr(true) - importOfferingOptionsModel.IsVsi = core.BoolPtr(true) - importOfferingOptionsModel.RepoType = core.StringPtr("testString") - importOfferingOptionsModel.XAuthToken = core.StringPtr("testString") - importOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetOfferingAuditOptions model + getOfferingAuditOptionsModel := new(catalogmanagementv1.GetOfferingAuditOptions) + getOfferingAuditOptionsModel.CatalogIdentifier = core.StringPtr("testString") + getOfferingAuditOptionsModel.OfferingID = core.StringPtr("testString") + getOfferingAuditOptionsModel.AuditlogIdentifier = core.StringPtr("testString") + getOfferingAuditOptionsModel.Lookupnames = core.BoolPtr(true) + getOfferingAuditOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := catalogManagementService.ImportOffering(importOfferingOptionsModel) + result, response, operationErr := catalogManagementService.GetOfferingAudit(getOfferingAuditOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -5100,25 +12068,26 @@ var _ = Describe(`CatalogManagementV1`, func() { }) }) }) - Describe(`ReloadOffering(reloadOfferingOptions *ReloadOfferingOptions) - Operation response error`, func() { - reloadOfferingPath := "/catalogs/testString/offerings/testString/reload" + Describe(`SetOfferingPublish(setOfferingPublishOptions *SetOfferingPublishOptions) - Operation response error`, func() { + setOfferingPublishPath := "/catalogs/testString/offerings/testString/publish/pc_managed/true" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(reloadOfferingPath)) - Expect(req.Method).To(Equal("PUT")) - Expect(req.URL.Query()["targetVersion"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["zipurl"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["repoType"]).To(Equal([]string{"testString"})) + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(setOfferingPublishPath)) + Expect(req.Method).To(Equal("POST")) + Expect(req.Header["X-Approver-Token"]).ToNot(BeNil()) + Expect(req.Header["X-Approver-Token"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["portal_record"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["portal_url"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, `} this is not valid json {`) + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ReloadOffering with error: Operation response processing error`, func() { + It(`Invoke SetOfferingPublish with error: Operation response processing error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -5126,26 +12095,25 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the ReloadOfferingOptions model - reloadOfferingOptionsModel := new(catalogmanagementv1.ReloadOfferingOptions) - reloadOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") - reloadOfferingOptionsModel.OfferingID = core.StringPtr("testString") - reloadOfferingOptionsModel.TargetVersion = core.StringPtr("testString") - reloadOfferingOptionsModel.Tags = []string{"testString"} - reloadOfferingOptionsModel.TargetKinds = []string{"testString"} - reloadOfferingOptionsModel.Content = CreateMockByteArray("This is a mock byte array value.") - reloadOfferingOptionsModel.Zipurl = core.StringPtr("testString") - reloadOfferingOptionsModel.RepoType = core.StringPtr("testString") - reloadOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SetOfferingPublishOptions model + setOfferingPublishOptionsModel := new(catalogmanagementv1.SetOfferingPublishOptions) + setOfferingPublishOptionsModel.CatalogIdentifier = core.StringPtr("testString") + setOfferingPublishOptionsModel.OfferingID = core.StringPtr("testString") + setOfferingPublishOptionsModel.ApprovalType = core.StringPtr("pc_managed") + setOfferingPublishOptionsModel.Approved = core.StringPtr("true") + setOfferingPublishOptionsModel.PortalRecord = core.StringPtr("testString") + setOfferingPublishOptionsModel.PortalURL = core.StringPtr("testString") + setOfferingPublishOptionsModel.XApproverToken = core.StringPtr("testString") + setOfferingPublishOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := catalogManagementService.ReloadOffering(reloadOfferingOptionsModel) + result, response, operationErr := catalogManagementService.SetOfferingPublish(setOfferingPublishOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again catalogManagementService.EnableRetries(0, 0) - result, response, operationErr = catalogManagementService.ReloadOffering(reloadOfferingOptionsModel) + result, response, operationErr = catalogManagementService.SetOfferingPublish(setOfferingPublishOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -5155,46 +12123,31 @@ var _ = Describe(`CatalogManagementV1`, func() { }) }) }) - Describe(`ReloadOffering(reloadOfferingOptions *ReloadOfferingOptions)`, func() { - reloadOfferingPath := "/catalogs/testString/offerings/testString/reload" + Describe(`SetOfferingPublish(setOfferingPublishOptions *SetOfferingPublishOptions)`, func() { + setOfferingPublishPath := "/catalogs/testString/offerings/testString/publish/pc_managed/true" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(reloadOfferingPath)) - Expect(req.Method).To(Equal("PUT")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(setOfferingPublishPath)) + Expect(req.Method).To(Equal("POST")) - Expect(req.URL.Query()["targetVersion"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["zipurl"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["repoType"]).To(Equal([]string{"testString"})) + Expect(req.Header["X-Approver-Token"]).ToNot(BeNil()) + Expect(req.Header["X-Approver-Token"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["portal_record"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["portal_url"]).To(Equal([]string{"testString"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "url": "URL", "crn": "CRN", "label": "Label", "name": "Name", "offering_icon_url": "OfferingIconURL", "offering_docs_url": "OfferingDocsURL", "offering_support_url": "OfferingSupportURL", "tags": ["Tags"], "keywords": ["Keywords"], "rating": {"one_star_count": 12, "two_star_count": 12, "three_star_count": 14, "four_star_count": 13}, "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "short_description": "ShortDescription", "long_description": "LongDescription", "features": [{"title": "Title", "description": "Description"}], "kinds": [{"id": "ID", "format_kind": "FormatKind", "target_kind": "TargetKind", "metadata": {"mapKey": "anyValue"}, "install_description": "InstallDescription", "tags": ["Tags"], "additional_features": [{"title": "Title", "description": "Description"}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "versions": [{"id": "ID", "_rev": "Rev", "crn": "CRN", "version": "Version", "sha": "Sha", "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "offering_id": "OfferingID", "catalog_id": "CatalogID", "kind_id": "KindID", "tags": ["Tags"], "repo_url": "RepoURL", "source_url": "SourceURL", "tgz_url": "TgzURL", "configuration": [{"key": "Key", "type": "Type", "default_value": "anyValue", "value_constraint": "ValueConstraint", "description": "Description", "required": true, "options": ["anyValue"], "hidden": true}], "metadata": {"mapKey": "anyValue"}, "validation": {"validated": "2019-01-01T12:00:00.000Z", "requested": "2019-01-01T12:00:00.000Z", "state": "State", "last_operation": "LastOperation", "target": {"mapKey": "anyValue"}}, "required_resources": [{"type": "mem", "value": "anyValue"}], "single_instance": true, "install": {"instructions": "Instructions", "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}, "pre_install": [{"instructions": "Instructions", "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}], "entitlement": {"provider_name": "ProviderName", "provider_id": "ProviderID", "product_id": "ProductID", "part_numbers": ["PartNumbers"], "image_repo_name": "ImageRepoName"}, "licenses": [{"id": "ID", "name": "Name", "type": "Type", "url": "URL", "description": "Description"}], "image_manifest_url": "ImageManifestURL", "deprecated": true, "package_version": "PackageVersion", "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "version_locator": "VersionLocator", "console_url": "ConsoleURL", "long_description": "LongDescription", "whitelisted_accounts": ["WhitelistedAccounts"]}], "plans": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "additional_features": [{"title": "Title", "description": "Description"}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "deployments": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z"}]}]}], "permit_request_ibm_public_publish": false, "ibm_publish_approved": true, "public_publish_approved": false, "public_original_crn": "PublicOriginalCRN", "publish_public_crn": "PublishPublicCRN", "portal_approval_record": "PortalApprovalRecord", "portal_ui_url": "PortalUIURL", "catalog_id": "CatalogID", "catalog_name": "CatalogName", "metadata": {"mapKey": "anyValue"}, "disclaimer": "Disclaimer", "hidden": true, "provider": "Provider", "provider_info": {"id": "ID", "name": "Name"}, "repo_info": {"token": "Token", "type": "Type"}, "support": {"url": "URL", "process": "Process", "locations": ["Locations"]}, "media": [{"url": "URL", "caption": "Caption", "type": "Type", "thumbnail_url": "ThumbnailURL"}]}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"shared": true, "ibm": false, "public": true, "allow_request": true, "approved": true, "portal_record": "PortalRecord", "portal_url": "PortalURL", "changed": false}`) })) }) - It(`Invoke ReloadOffering successfully with retries`, func() { + It(`Invoke SetOfferingPublish successfully with retries`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -5203,28 +12156,27 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) catalogManagementService.EnableRetries(0, 0) - // Construct an instance of the ReloadOfferingOptions model - reloadOfferingOptionsModel := new(catalogmanagementv1.ReloadOfferingOptions) - reloadOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") - reloadOfferingOptionsModel.OfferingID = core.StringPtr("testString") - reloadOfferingOptionsModel.TargetVersion = core.StringPtr("testString") - reloadOfferingOptionsModel.Tags = []string{"testString"} - reloadOfferingOptionsModel.TargetKinds = []string{"testString"} - reloadOfferingOptionsModel.Content = CreateMockByteArray("This is a mock byte array value.") - reloadOfferingOptionsModel.Zipurl = core.StringPtr("testString") - reloadOfferingOptionsModel.RepoType = core.StringPtr("testString") - reloadOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SetOfferingPublishOptions model + setOfferingPublishOptionsModel := new(catalogmanagementv1.SetOfferingPublishOptions) + setOfferingPublishOptionsModel.CatalogIdentifier = core.StringPtr("testString") + setOfferingPublishOptionsModel.OfferingID = core.StringPtr("testString") + setOfferingPublishOptionsModel.ApprovalType = core.StringPtr("pc_managed") + setOfferingPublishOptionsModel.Approved = core.StringPtr("true") + setOfferingPublishOptionsModel.PortalRecord = core.StringPtr("testString") + setOfferingPublishOptionsModel.PortalURL = core.StringPtr("testString") + setOfferingPublishOptionsModel.XApproverToken = core.StringPtr("testString") + setOfferingPublishOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := catalogManagementService.ReloadOfferingWithContext(ctx, reloadOfferingOptionsModel) + _, _, operationErr := catalogManagementService.SetOfferingPublishWithContext(ctx, setOfferingPublishOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again catalogManagementService.DisableRetries() - result, response, operationErr := catalogManagementService.ReloadOffering(reloadOfferingOptionsModel) + result, response, operationErr := catalogManagementService.SetOfferingPublish(setOfferingPublishOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -5232,7 +12184,7 @@ var _ = Describe(`CatalogManagementV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = catalogManagementService.ReloadOfferingWithContext(ctx, reloadOfferingOptionsModel) + _, _, operationErr = catalogManagementService.SetOfferingPublishWithContext(ctx, setOfferingPublishOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -5246,35 +12198,20 @@ var _ = Describe(`CatalogManagementV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(reloadOfferingPath)) - Expect(req.Method).To(Equal("PUT")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(setOfferingPublishPath)) + Expect(req.Method).To(Equal("POST")) - Expect(req.URL.Query()["targetVersion"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["zipurl"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["repoType"]).To(Equal([]string{"testString"})) + Expect(req.Header["X-Approver-Token"]).ToNot(BeNil()) + Expect(req.Header["X-Approver-Token"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["portal_record"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["portal_url"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "url": "URL", "crn": "CRN", "label": "Label", "name": "Name", "offering_icon_url": "OfferingIconURL", "offering_docs_url": "OfferingDocsURL", "offering_support_url": "OfferingSupportURL", "tags": ["Tags"], "keywords": ["Keywords"], "rating": {"one_star_count": 12, "two_star_count": 12, "three_star_count": 14, "four_star_count": 13}, "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "short_description": "ShortDescription", "long_description": "LongDescription", "features": [{"title": "Title", "description": "Description"}], "kinds": [{"id": "ID", "format_kind": "FormatKind", "target_kind": "TargetKind", "metadata": {"mapKey": "anyValue"}, "install_description": "InstallDescription", "tags": ["Tags"], "additional_features": [{"title": "Title", "description": "Description"}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "versions": [{"id": "ID", "_rev": "Rev", "crn": "CRN", "version": "Version", "sha": "Sha", "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "offering_id": "OfferingID", "catalog_id": "CatalogID", "kind_id": "KindID", "tags": ["Tags"], "repo_url": "RepoURL", "source_url": "SourceURL", "tgz_url": "TgzURL", "configuration": [{"key": "Key", "type": "Type", "default_value": "anyValue", "value_constraint": "ValueConstraint", "description": "Description", "required": true, "options": ["anyValue"], "hidden": true}], "metadata": {"mapKey": "anyValue"}, "validation": {"validated": "2019-01-01T12:00:00.000Z", "requested": "2019-01-01T12:00:00.000Z", "state": "State", "last_operation": "LastOperation", "target": {"mapKey": "anyValue"}}, "required_resources": [{"type": "mem", "value": "anyValue"}], "single_instance": true, "install": {"instructions": "Instructions", "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}, "pre_install": [{"instructions": "Instructions", "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}], "entitlement": {"provider_name": "ProviderName", "provider_id": "ProviderID", "product_id": "ProductID", "part_numbers": ["PartNumbers"], "image_repo_name": "ImageRepoName"}, "licenses": [{"id": "ID", "name": "Name", "type": "Type", "url": "URL", "description": "Description"}], "image_manifest_url": "ImageManifestURL", "deprecated": true, "package_version": "PackageVersion", "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "version_locator": "VersionLocator", "console_url": "ConsoleURL", "long_description": "LongDescription", "whitelisted_accounts": ["WhitelistedAccounts"]}], "plans": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "additional_features": [{"title": "Title", "description": "Description"}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "deployments": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z"}]}]}], "permit_request_ibm_public_publish": false, "ibm_publish_approved": true, "public_publish_approved": false, "public_original_crn": "PublicOriginalCRN", "publish_public_crn": "PublishPublicCRN", "portal_approval_record": "PortalApprovalRecord", "portal_ui_url": "PortalUIURL", "catalog_id": "CatalogID", "catalog_name": "CatalogName", "metadata": {"mapKey": "anyValue"}, "disclaimer": "Disclaimer", "hidden": true, "provider": "Provider", "provider_info": {"id": "ID", "name": "Name"}, "repo_info": {"token": "Token", "type": "Type"}, "support": {"url": "URL", "process": "Process", "locations": ["Locations"]}, "media": [{"url": "URL", "caption": "Caption", "type": "Type", "thumbnail_url": "ThumbnailURL"}]}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"shared": true, "ibm": false, "public": true, "allow_request": true, "approved": true, "portal_record": "PortalRecord", "portal_url": "PortalURL", "changed": false}`) })) }) - It(`Invoke ReloadOffering successfully`, func() { + It(`Invoke SetOfferingPublish successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -5283,31 +12220,30 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := catalogManagementService.ReloadOffering(nil) + result, response, operationErr := catalogManagementService.SetOfferingPublish(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ReloadOfferingOptions model - reloadOfferingOptionsModel := new(catalogmanagementv1.ReloadOfferingOptions) - reloadOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") - reloadOfferingOptionsModel.OfferingID = core.StringPtr("testString") - reloadOfferingOptionsModel.TargetVersion = core.StringPtr("testString") - reloadOfferingOptionsModel.Tags = []string{"testString"} - reloadOfferingOptionsModel.TargetKinds = []string{"testString"} - reloadOfferingOptionsModel.Content = CreateMockByteArray("This is a mock byte array value.") - reloadOfferingOptionsModel.Zipurl = core.StringPtr("testString") - reloadOfferingOptionsModel.RepoType = core.StringPtr("testString") - reloadOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SetOfferingPublishOptions model + setOfferingPublishOptionsModel := new(catalogmanagementv1.SetOfferingPublishOptions) + setOfferingPublishOptionsModel.CatalogIdentifier = core.StringPtr("testString") + setOfferingPublishOptionsModel.OfferingID = core.StringPtr("testString") + setOfferingPublishOptionsModel.ApprovalType = core.StringPtr("pc_managed") + setOfferingPublishOptionsModel.Approved = core.StringPtr("true") + setOfferingPublishOptionsModel.PortalRecord = core.StringPtr("testString") + setOfferingPublishOptionsModel.PortalURL = core.StringPtr("testString") + setOfferingPublishOptionsModel.XApproverToken = core.StringPtr("testString") + setOfferingPublishOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = catalogManagementService.ReloadOffering(reloadOfferingOptionsModel) + result, response, operationErr = catalogManagementService.SetOfferingPublish(setOfferingPublishOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ReloadOffering with error: Operation validation and request error`, func() { + It(`Invoke SetOfferingPublish with error: Operation validation and request error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -5315,29 +12251,28 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the ReloadOfferingOptions model - reloadOfferingOptionsModel := new(catalogmanagementv1.ReloadOfferingOptions) - reloadOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") - reloadOfferingOptionsModel.OfferingID = core.StringPtr("testString") - reloadOfferingOptionsModel.TargetVersion = core.StringPtr("testString") - reloadOfferingOptionsModel.Tags = []string{"testString"} - reloadOfferingOptionsModel.TargetKinds = []string{"testString"} - reloadOfferingOptionsModel.Content = CreateMockByteArray("This is a mock byte array value.") - reloadOfferingOptionsModel.Zipurl = core.StringPtr("testString") - reloadOfferingOptionsModel.RepoType = core.StringPtr("testString") - reloadOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SetOfferingPublishOptions model + setOfferingPublishOptionsModel := new(catalogmanagementv1.SetOfferingPublishOptions) + setOfferingPublishOptionsModel.CatalogIdentifier = core.StringPtr("testString") + setOfferingPublishOptionsModel.OfferingID = core.StringPtr("testString") + setOfferingPublishOptionsModel.ApprovalType = core.StringPtr("pc_managed") + setOfferingPublishOptionsModel.Approved = core.StringPtr("true") + setOfferingPublishOptionsModel.PortalRecord = core.StringPtr("testString") + setOfferingPublishOptionsModel.PortalURL = core.StringPtr("testString") + setOfferingPublishOptionsModel.XApproverToken = core.StringPtr("testString") + setOfferingPublishOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := catalogManagementService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := catalogManagementService.ReloadOffering(reloadOfferingOptionsModel) + result, response, operationErr := catalogManagementService.SetOfferingPublish(setOfferingPublishOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the ReloadOfferingOptions model with no property values - reloadOfferingOptionsModelNew := new(catalogmanagementv1.ReloadOfferingOptions) + // Construct a second instance of the SetOfferingPublishOptions model with no property values + setOfferingPublishOptionsModelNew := new(catalogmanagementv1.SetOfferingPublishOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = catalogManagementService.ReloadOffering(reloadOfferingOptionsModelNew) + result, response, operationErr = catalogManagementService.SetOfferingPublish(setOfferingPublishOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -5352,10 +12287,10 @@ var _ = Describe(`CatalogManagementV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(201) + res.WriteHeader(200) })) }) - It(`Invoke ReloadOffering successfully`, func() { + It(`Invoke SetOfferingPublish successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -5363,20 +12298,19 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the ReloadOfferingOptions model - reloadOfferingOptionsModel := new(catalogmanagementv1.ReloadOfferingOptions) - reloadOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") - reloadOfferingOptionsModel.OfferingID = core.StringPtr("testString") - reloadOfferingOptionsModel.TargetVersion = core.StringPtr("testString") - reloadOfferingOptionsModel.Tags = []string{"testString"} - reloadOfferingOptionsModel.TargetKinds = []string{"testString"} - reloadOfferingOptionsModel.Content = CreateMockByteArray("This is a mock byte array value.") - reloadOfferingOptionsModel.Zipurl = core.StringPtr("testString") - reloadOfferingOptionsModel.RepoType = core.StringPtr("testString") - reloadOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SetOfferingPublishOptions model + setOfferingPublishOptionsModel := new(catalogmanagementv1.SetOfferingPublishOptions) + setOfferingPublishOptionsModel.CatalogIdentifier = core.StringPtr("testString") + setOfferingPublishOptionsModel.OfferingID = core.StringPtr("testString") + setOfferingPublishOptionsModel.ApprovalType = core.StringPtr("pc_managed") + setOfferingPublishOptionsModel.Approved = core.StringPtr("true") + setOfferingPublishOptionsModel.PortalRecord = core.StringPtr("testString") + setOfferingPublishOptionsModel.PortalURL = core.StringPtr("testString") + setOfferingPublishOptionsModel.XApproverToken = core.StringPtr("testString") + setOfferingPublishOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := catalogManagementService.ReloadOffering(reloadOfferingOptionsModel) + result, response, operationErr := catalogManagementService.SetOfferingPublish(setOfferingPublishOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -5388,24 +12322,114 @@ var _ = Describe(`CatalogManagementV1`, func() { }) }) }) - Describe(`GetOffering(getOfferingOptions *GetOfferingOptions) - Operation response error`, func() { - getOfferingPath := "/catalogs/testString/offerings/testString" + Describe(`DeprecateOffering(deprecateOfferingOptions *DeprecateOfferingOptions)`, func() { + deprecateOfferingPath := "/catalogs/testString/offerings/testString/deprecate/true" + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(deprecateOfferingPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + res.WriteHeader(202) + })) + }) + It(`Invoke DeprecateOffering successfully`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + response, operationErr := catalogManagementService.DeprecateOffering(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeprecateOfferingOptions model + deprecateOfferingOptionsModel := new(catalogmanagementv1.DeprecateOfferingOptions) + deprecateOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") + deprecateOfferingOptionsModel.OfferingID = core.StringPtr("testString") + deprecateOfferingOptionsModel.Setting = core.StringPtr("true") + deprecateOfferingOptionsModel.Description = core.StringPtr("testString") + deprecateOfferingOptionsModel.DaysUntilDeprecate = core.Int64Ptr(int64(38)) + deprecateOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = catalogManagementService.DeprecateOffering(deprecateOfferingOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeprecateOffering with error: Operation validation and request error`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Construct an instance of the DeprecateOfferingOptions model + deprecateOfferingOptionsModel := new(catalogmanagementv1.DeprecateOfferingOptions) + deprecateOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") + deprecateOfferingOptionsModel.OfferingID = core.StringPtr("testString") + deprecateOfferingOptionsModel.Setting = core.StringPtr("true") + deprecateOfferingOptionsModel.Description = core.StringPtr("testString") + deprecateOfferingOptionsModel.DaysUntilDeprecate = core.Int64Ptr(int64(38)) + deprecateOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := catalogManagementService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := catalogManagementService.DeprecateOffering(deprecateOfferingOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeprecateOfferingOptions model with no property values + deprecateOfferingOptionsModelNew := new(catalogmanagementv1.DeprecateOfferingOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = catalogManagementService.DeprecateOffering(deprecateOfferingOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ShareOffering(shareOfferingOptions *ShareOfferingOptions) - Operation response error`, func() { + shareOfferingPath := "/catalogs/testString/offerings/testString/share" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getOfferingPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["type"]).To(Equal([]string{"testString"})) - // TODO: Add check for digest query parameter + Expect(req.URL.EscapedPath()).To(Equal(shareOfferingPath)) + Expect(req.Method).To(Equal("POST")) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, `} this is not valid json {`) + fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetOffering with error: Operation response processing error`, func() { + It(`Invoke ShareOffering with error: Operation response processing error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -5413,22 +12437,23 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the GetOfferingOptions model - getOfferingOptionsModel := new(catalogmanagementv1.GetOfferingOptions) - getOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") - getOfferingOptionsModel.OfferingID = core.StringPtr("testString") - getOfferingOptionsModel.Type = core.StringPtr("testString") - getOfferingOptionsModel.Digest = core.BoolPtr(true) - getOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ShareOfferingOptions model + shareOfferingOptionsModel := new(catalogmanagementv1.ShareOfferingOptions) + shareOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") + shareOfferingOptionsModel.OfferingID = core.StringPtr("testString") + shareOfferingOptionsModel.IBM = core.BoolPtr(true) + shareOfferingOptionsModel.Public = core.BoolPtr(true) + shareOfferingOptionsModel.Enabled = core.BoolPtr(true) + shareOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := catalogManagementService.GetOffering(getOfferingOptionsModel) + result, response, operationErr := catalogManagementService.ShareOffering(shareOfferingOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again catalogManagementService.EnableRetries(0, 0) - result, response, operationErr = catalogManagementService.GetOffering(getOfferingOptionsModel) + result, response, operationErr = catalogManagementService.ShareOffering(shareOfferingOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -5438,29 +12463,43 @@ var _ = Describe(`CatalogManagementV1`, func() { }) }) }) - Describe(`GetOffering(getOfferingOptions *GetOfferingOptions)`, func() { - getOfferingPath := "/catalogs/testString/offerings/testString" + Describe(`ShareOffering(shareOfferingOptions *ShareOfferingOptions)`, func() { + shareOfferingPath := "/catalogs/testString/offerings/testString/share" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getOfferingPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(shareOfferingPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) - Expect(req.URL.Query()["type"]).To(Equal([]string{"testString"})) - // TODO: Add check for digest query parameter // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "url": "URL", "crn": "CRN", "label": "Label", "name": "Name", "offering_icon_url": "OfferingIconURL", "offering_docs_url": "OfferingDocsURL", "offering_support_url": "OfferingSupportURL", "tags": ["Tags"], "keywords": ["Keywords"], "rating": {"one_star_count": 12, "two_star_count": 12, "three_star_count": 14, "four_star_count": 13}, "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "short_description": "ShortDescription", "long_description": "LongDescription", "features": [{"title": "Title", "description": "Description"}], "kinds": [{"id": "ID", "format_kind": "FormatKind", "target_kind": "TargetKind", "metadata": {"mapKey": "anyValue"}, "install_description": "InstallDescription", "tags": ["Tags"], "additional_features": [{"title": "Title", "description": "Description"}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "versions": [{"id": "ID", "_rev": "Rev", "crn": "CRN", "version": "Version", "sha": "Sha", "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "offering_id": "OfferingID", "catalog_id": "CatalogID", "kind_id": "KindID", "tags": ["Tags"], "repo_url": "RepoURL", "source_url": "SourceURL", "tgz_url": "TgzURL", "configuration": [{"key": "Key", "type": "Type", "default_value": "anyValue", "value_constraint": "ValueConstraint", "description": "Description", "required": true, "options": ["anyValue"], "hidden": true}], "metadata": {"mapKey": "anyValue"}, "validation": {"validated": "2019-01-01T12:00:00.000Z", "requested": "2019-01-01T12:00:00.000Z", "state": "State", "last_operation": "LastOperation", "target": {"mapKey": "anyValue"}}, "required_resources": [{"type": "mem", "value": "anyValue"}], "single_instance": true, "install": {"instructions": "Instructions", "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}, "pre_install": [{"instructions": "Instructions", "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}], "entitlement": {"provider_name": "ProviderName", "provider_id": "ProviderID", "product_id": "ProductID", "part_numbers": ["PartNumbers"], "image_repo_name": "ImageRepoName"}, "licenses": [{"id": "ID", "name": "Name", "type": "Type", "url": "URL", "description": "Description"}], "image_manifest_url": "ImageManifestURL", "deprecated": true, "package_version": "PackageVersion", "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "version_locator": "VersionLocator", "console_url": "ConsoleURL", "long_description": "LongDescription", "whitelisted_accounts": ["WhitelistedAccounts"]}], "plans": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "additional_features": [{"title": "Title", "description": "Description"}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "deployments": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z"}]}]}], "permit_request_ibm_public_publish": false, "ibm_publish_approved": true, "public_publish_approved": false, "public_original_crn": "PublicOriginalCRN", "publish_public_crn": "PublishPublicCRN", "portal_approval_record": "PortalApprovalRecord", "portal_ui_url": "PortalUIURL", "catalog_id": "CatalogID", "catalog_name": "CatalogName", "metadata": {"mapKey": "anyValue"}, "disclaimer": "Disclaimer", "hidden": true, "provider": "Provider", "provider_info": {"id": "ID", "name": "Name"}, "repo_info": {"token": "Token", "type": "Type"}, "support": {"url": "URL", "process": "Process", "locations": ["Locations"]}, "media": [{"url": "URL", "caption": "Caption", "type": "Type", "thumbnail_url": "ThumbnailURL"}]}`) + fmt.Fprintf(res, "%s", `{"ibm": false, "public": true, "enabled": false}`) })) }) - It(`Invoke GetOffering successfully with retries`, func() { + It(`Invoke ShareOffering successfully with retries`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -5469,24 +12508,25 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) catalogManagementService.EnableRetries(0, 0) - // Construct an instance of the GetOfferingOptions model - getOfferingOptionsModel := new(catalogmanagementv1.GetOfferingOptions) - getOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") - getOfferingOptionsModel.OfferingID = core.StringPtr("testString") - getOfferingOptionsModel.Type = core.StringPtr("testString") - getOfferingOptionsModel.Digest = core.BoolPtr(true) - getOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ShareOfferingOptions model + shareOfferingOptionsModel := new(catalogmanagementv1.ShareOfferingOptions) + shareOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") + shareOfferingOptionsModel.OfferingID = core.StringPtr("testString") + shareOfferingOptionsModel.IBM = core.BoolPtr(true) + shareOfferingOptionsModel.Public = core.BoolPtr(true) + shareOfferingOptionsModel.Enabled = core.BoolPtr(true) + shareOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := catalogManagementService.GetOfferingWithContext(ctx, getOfferingOptionsModel) + _, _, operationErr := catalogManagementService.ShareOfferingWithContext(ctx, shareOfferingOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again catalogManagementService.DisableRetries() - result, response, operationErr := catalogManagementService.GetOffering(getOfferingOptionsModel) + result, response, operationErr := catalogManagementService.ShareOffering(shareOfferingOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -5494,7 +12534,7 @@ var _ = Describe(`CatalogManagementV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = catalogManagementService.GetOfferingWithContext(ctx, getOfferingOptionsModel) + _, _, operationErr = catalogManagementService.ShareOfferingWithContext(ctx, shareOfferingOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -5508,18 +12548,32 @@ var _ = Describe(`CatalogManagementV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getOfferingPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(shareOfferingPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) - Expect(req.URL.Query()["type"]).To(Equal([]string{"testString"})) - // TODO: Add check for digest query parameter // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "url": "URL", "crn": "CRN", "label": "Label", "name": "Name", "offering_icon_url": "OfferingIconURL", "offering_docs_url": "OfferingDocsURL", "offering_support_url": "OfferingSupportURL", "tags": ["Tags"], "keywords": ["Keywords"], "rating": {"one_star_count": 12, "two_star_count": 12, "three_star_count": 14, "four_star_count": 13}, "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "short_description": "ShortDescription", "long_description": "LongDescription", "features": [{"title": "Title", "description": "Description"}], "kinds": [{"id": "ID", "format_kind": "FormatKind", "target_kind": "TargetKind", "metadata": {"mapKey": "anyValue"}, "install_description": "InstallDescription", "tags": ["Tags"], "additional_features": [{"title": "Title", "description": "Description"}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "versions": [{"id": "ID", "_rev": "Rev", "crn": "CRN", "version": "Version", "sha": "Sha", "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "offering_id": "OfferingID", "catalog_id": "CatalogID", "kind_id": "KindID", "tags": ["Tags"], "repo_url": "RepoURL", "source_url": "SourceURL", "tgz_url": "TgzURL", "configuration": [{"key": "Key", "type": "Type", "default_value": "anyValue", "value_constraint": "ValueConstraint", "description": "Description", "required": true, "options": ["anyValue"], "hidden": true}], "metadata": {"mapKey": "anyValue"}, "validation": {"validated": "2019-01-01T12:00:00.000Z", "requested": "2019-01-01T12:00:00.000Z", "state": "State", "last_operation": "LastOperation", "target": {"mapKey": "anyValue"}}, "required_resources": [{"type": "mem", "value": "anyValue"}], "single_instance": true, "install": {"instructions": "Instructions", "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}, "pre_install": [{"instructions": "Instructions", "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}], "entitlement": {"provider_name": "ProviderName", "provider_id": "ProviderID", "product_id": "ProductID", "part_numbers": ["PartNumbers"], "image_repo_name": "ImageRepoName"}, "licenses": [{"id": "ID", "name": "Name", "type": "Type", "url": "URL", "description": "Description"}], "image_manifest_url": "ImageManifestURL", "deprecated": true, "package_version": "PackageVersion", "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "version_locator": "VersionLocator", "console_url": "ConsoleURL", "long_description": "LongDescription", "whitelisted_accounts": ["WhitelistedAccounts"]}], "plans": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "additional_features": [{"title": "Title", "description": "Description"}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "deployments": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z"}]}]}], "permit_request_ibm_public_publish": false, "ibm_publish_approved": true, "public_publish_approved": false, "public_original_crn": "PublicOriginalCRN", "publish_public_crn": "PublishPublicCRN", "portal_approval_record": "PortalApprovalRecord", "portal_ui_url": "PortalUIURL", "catalog_id": "CatalogID", "catalog_name": "CatalogName", "metadata": {"mapKey": "anyValue"}, "disclaimer": "Disclaimer", "hidden": true, "provider": "Provider", "provider_info": {"id": "ID", "name": "Name"}, "repo_info": {"token": "Token", "type": "Type"}, "support": {"url": "URL", "process": "Process", "locations": ["Locations"]}, "media": [{"url": "URL", "caption": "Caption", "type": "Type", "thumbnail_url": "ThumbnailURL"}]}`) + fmt.Fprintf(res, "%s", `{"ibm": false, "public": true, "enabled": false}`) })) }) - It(`Invoke GetOffering successfully`, func() { + It(`Invoke ShareOffering successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -5528,27 +12582,28 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := catalogManagementService.GetOffering(nil) + result, response, operationErr := catalogManagementService.ShareOffering(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetOfferingOptions model - getOfferingOptionsModel := new(catalogmanagementv1.GetOfferingOptions) - getOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") - getOfferingOptionsModel.OfferingID = core.StringPtr("testString") - getOfferingOptionsModel.Type = core.StringPtr("testString") - getOfferingOptionsModel.Digest = core.BoolPtr(true) - getOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ShareOfferingOptions model + shareOfferingOptionsModel := new(catalogmanagementv1.ShareOfferingOptions) + shareOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") + shareOfferingOptionsModel.OfferingID = core.StringPtr("testString") + shareOfferingOptionsModel.IBM = core.BoolPtr(true) + shareOfferingOptionsModel.Public = core.BoolPtr(true) + shareOfferingOptionsModel.Enabled = core.BoolPtr(true) + shareOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = catalogManagementService.GetOffering(getOfferingOptionsModel) + result, response, operationErr = catalogManagementService.ShareOffering(shareOfferingOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetOffering with error: Operation validation and request error`, func() { + It(`Invoke ShareOffering with error: Operation validation and request error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -5556,25 +12611,26 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the GetOfferingOptions model - getOfferingOptionsModel := new(catalogmanagementv1.GetOfferingOptions) - getOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") - getOfferingOptionsModel.OfferingID = core.StringPtr("testString") - getOfferingOptionsModel.Type = core.StringPtr("testString") - getOfferingOptionsModel.Digest = core.BoolPtr(true) - getOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ShareOfferingOptions model + shareOfferingOptionsModel := new(catalogmanagementv1.ShareOfferingOptions) + shareOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") + shareOfferingOptionsModel.OfferingID = core.StringPtr("testString") + shareOfferingOptionsModel.IBM = core.BoolPtr(true) + shareOfferingOptionsModel.Public = core.BoolPtr(true) + shareOfferingOptionsModel.Enabled = core.BoolPtr(true) + shareOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := catalogManagementService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := catalogManagementService.GetOffering(getOfferingOptionsModel) + result, response, operationErr := catalogManagementService.ShareOffering(shareOfferingOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetOfferingOptions model with no property values - getOfferingOptionsModelNew := new(catalogmanagementv1.GetOfferingOptions) + // Construct a second instance of the ShareOfferingOptions model with no property values + shareOfferingOptionsModelNew := new(catalogmanagementv1.ShareOfferingOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = catalogManagementService.GetOffering(getOfferingOptionsModelNew) + result, response, operationErr = catalogManagementService.ShareOffering(shareOfferingOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -5585,279 +12641,81 @@ var _ = Describe(`CatalogManagementV1`, func() { }) Context(`Using mock server endpoint with missing response body`, func() { BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Set success status code with no respoonse body - res.WriteHeader(200) - })) - }) - It(`Invoke GetOffering successfully`, func() { - catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(catalogManagementService).ToNot(BeNil()) - - // Construct an instance of the GetOfferingOptions model - getOfferingOptionsModel := new(catalogmanagementv1.GetOfferingOptions) - getOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") - getOfferingOptionsModel.OfferingID = core.StringPtr("testString") - getOfferingOptionsModel.Type = core.StringPtr("testString") - getOfferingOptionsModel.Digest = core.BoolPtr(true) - getOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := catalogManagementService.GetOffering(getOfferingOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ReplaceOffering(replaceOfferingOptions *ReplaceOfferingOptions) - Operation response error`, func() { - replaceOfferingPath := "/catalogs/testString/offerings/testString" - Context(`Using mock server endpoint with invalid JSON response`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(replaceOfferingPath)) - Expect(req.Method).To(Equal("PUT")) - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, `} this is not valid json {`) - })) - }) - It(`Invoke ReplaceOffering with error: Operation response processing error`, func() { - catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(catalogManagementService).ToNot(BeNil()) - - // Construct an instance of the Rating model - ratingModel := new(catalogmanagementv1.Rating) - ratingModel.OneStarCount = core.Int64Ptr(int64(38)) - ratingModel.TwoStarCount = core.Int64Ptr(int64(38)) - ratingModel.ThreeStarCount = core.Int64Ptr(int64(38)) - ratingModel.FourStarCount = core.Int64Ptr(int64(38)) - - // Construct an instance of the Feature model - featureModel := new(catalogmanagementv1.Feature) - featureModel.Title = core.StringPtr("testString") - featureModel.Description = core.StringPtr("testString") - - // Construct an instance of the Configuration model - configurationModel := new(catalogmanagementv1.Configuration) - configurationModel.Key = core.StringPtr("testString") - configurationModel.Type = core.StringPtr("testString") - configurationModel.DefaultValue = core.StringPtr("testString") - configurationModel.ValueConstraint = core.StringPtr("testString") - configurationModel.Description = core.StringPtr("testString") - configurationModel.Required = core.BoolPtr(true) - configurationModel.Options = []interface{}{"testString"} - configurationModel.Hidden = core.BoolPtr(true) - - // Construct an instance of the Validation model - validationModel := new(catalogmanagementv1.Validation) - validationModel.Validated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - validationModel.Requested = CreateMockDateTime("2019-01-01T12:00:00.000Z") - validationModel.State = core.StringPtr("testString") - validationModel.LastOperation = core.StringPtr("testString") - validationModel.Target = make(map[string]interface{}) - - // Construct an instance of the Resource model - resourceModel := new(catalogmanagementv1.Resource) - resourceModel.Type = core.StringPtr("mem") - resourceModel.Value = core.StringPtr("testString") - - // Construct an instance of the Script model - scriptModel := new(catalogmanagementv1.Script) - scriptModel.Instructions = core.StringPtr("testString") - scriptModel.Script = core.StringPtr("testString") - scriptModel.ScriptPermission = core.StringPtr("testString") - scriptModel.DeleteScript = core.StringPtr("testString") - scriptModel.Scope = core.StringPtr("testString") - - // Construct an instance of the VersionEntitlement model - versionEntitlementModel := new(catalogmanagementv1.VersionEntitlement) - versionEntitlementModel.ProviderName = core.StringPtr("testString") - versionEntitlementModel.ProviderID = core.StringPtr("testString") - versionEntitlementModel.ProductID = core.StringPtr("testString") - versionEntitlementModel.PartNumbers = []string{"testString"} - versionEntitlementModel.ImageRepoName = core.StringPtr("testString") - - // Construct an instance of the License model - licenseModel := new(catalogmanagementv1.License) - licenseModel.ID = core.StringPtr("testString") - licenseModel.Name = core.StringPtr("testString") - licenseModel.Type = core.StringPtr("testString") - licenseModel.URL = core.StringPtr("testString") - licenseModel.Description = core.StringPtr("testString") - - // Construct an instance of the State model - stateModel := new(catalogmanagementv1.State) - stateModel.Current = core.StringPtr("testString") - stateModel.CurrentEntered = CreateMockDateTime("2019-01-01T12:00:00.000Z") - stateModel.Pending = core.StringPtr("testString") - stateModel.PendingRequested = CreateMockDateTime("2019-01-01T12:00:00.000Z") - stateModel.Previous = core.StringPtr("testString") - - // Construct an instance of the Version model - versionModel := new(catalogmanagementv1.Version) - versionModel.ID = core.StringPtr("testString") - versionModel.Rev = core.StringPtr("testString") - versionModel.CRN = core.StringPtr("testString") - versionModel.Version = core.StringPtr("testString") - versionModel.Sha = core.StringPtr("testString") - versionModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") - versionModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - versionModel.OfferingID = core.StringPtr("testString") - versionModel.CatalogID = core.StringPtr("testString") - versionModel.KindID = core.StringPtr("testString") - versionModel.Tags = []string{"testString"} - versionModel.RepoURL = core.StringPtr("testString") - versionModel.SourceURL = core.StringPtr("testString") - versionModel.TgzURL = core.StringPtr("testString") - versionModel.Configuration = []catalogmanagementv1.Configuration{*configurationModel} - versionModel.Metadata = make(map[string]interface{}) - versionModel.Validation = validationModel - versionModel.RequiredResources = []catalogmanagementv1.Resource{*resourceModel} - versionModel.SingleInstance = core.BoolPtr(true) - versionModel.Install = scriptModel - versionModel.PreInstall = []catalogmanagementv1.Script{*scriptModel} - versionModel.Entitlement = versionEntitlementModel - versionModel.Licenses = []catalogmanagementv1.License{*licenseModel} - versionModel.ImageManifestURL = core.StringPtr("testString") - versionModel.Deprecated = core.BoolPtr(true) - versionModel.PackageVersion = core.StringPtr("testString") - versionModel.State = stateModel - versionModel.VersionLocator = core.StringPtr("testString") - versionModel.ConsoleURL = core.StringPtr("testString") - versionModel.LongDescription = core.StringPtr("testString") - versionModel.WhitelistedAccounts = []string{"testString"} - - // Construct an instance of the Deployment model - deploymentModel := new(catalogmanagementv1.Deployment) - deploymentModel.ID = core.StringPtr("testString") - deploymentModel.Label = core.StringPtr("testString") - deploymentModel.Name = core.StringPtr("testString") - deploymentModel.ShortDescription = core.StringPtr("testString") - deploymentModel.LongDescription = core.StringPtr("testString") - deploymentModel.Metadata = make(map[string]interface{}) - deploymentModel.Tags = []string{"testString"} - deploymentModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") - deploymentModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - - // Construct an instance of the Plan model - planModel := new(catalogmanagementv1.Plan) - planModel.ID = core.StringPtr("testString") - planModel.Label = core.StringPtr("testString") - planModel.Name = core.StringPtr("testString") - planModel.ShortDescription = core.StringPtr("testString") - planModel.LongDescription = core.StringPtr("testString") - planModel.Metadata = make(map[string]interface{}) - planModel.Tags = []string{"testString"} - planModel.AdditionalFeatures = []catalogmanagementv1.Feature{*featureModel} - planModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") - planModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - planModel.Deployments = []catalogmanagementv1.Deployment{*deploymentModel} - - // Construct an instance of the Kind model - kindModel := new(catalogmanagementv1.Kind) - kindModel.ID = core.StringPtr("testString") - kindModel.FormatKind = core.StringPtr("testString") - kindModel.TargetKind = core.StringPtr("testString") - kindModel.Metadata = make(map[string]interface{}) - kindModel.InstallDescription = core.StringPtr("testString") - kindModel.Tags = []string{"testString"} - kindModel.AdditionalFeatures = []catalogmanagementv1.Feature{*featureModel} - kindModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") - kindModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - kindModel.Versions = []catalogmanagementv1.Version{*versionModel} - kindModel.Plans = []catalogmanagementv1.Plan{*planModel} + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() - // Construct an instance of the ProviderInfo model - providerInfoModel := new(catalogmanagementv1.ProviderInfo) - providerInfoModel.ID = core.StringPtr("testString") - providerInfoModel.Name = core.StringPtr("testString") + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke ShareOffering successfully`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the RepoInfo model - repoInfoModel := new(catalogmanagementv1.RepoInfo) - repoInfoModel.Token = core.StringPtr("testString") - repoInfoModel.Type = core.StringPtr("testString") + // Construct an instance of the ShareOfferingOptions model + shareOfferingOptionsModel := new(catalogmanagementv1.ShareOfferingOptions) + shareOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") + shareOfferingOptionsModel.OfferingID = core.StringPtr("testString") + shareOfferingOptionsModel.IBM = core.BoolPtr(true) + shareOfferingOptionsModel.Public = core.BoolPtr(true) + shareOfferingOptionsModel.Enabled = core.BoolPtr(true) + shareOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Construct an instance of the Support model - supportModel := new(catalogmanagementv1.Support) - supportModel.URL = core.StringPtr("testString") - supportModel.Process = core.StringPtr("testString") - supportModel.Locations = []string{"testString"} + // Invoke operation + result, response, operationErr := catalogManagementService.ShareOffering(shareOfferingOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) - // Construct an instance of the MediaItem model - mediaItemModel := new(catalogmanagementv1.MediaItem) - mediaItemModel.URL = core.StringPtr("testString") - mediaItemModel.Caption = core.StringPtr("testString") - mediaItemModel.Type = core.StringPtr("testString") - mediaItemModel.ThumbnailURL = core.StringPtr("testString") + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetOfferingAccess(getOfferingAccessOptions *GetOfferingAccessOptions) - Operation response error`, func() { + getOfferingAccessPath := "/catalogs/testString/offerings/testString/access/testString" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() - // Construct an instance of the ReplaceOfferingOptions model - replaceOfferingOptionsModel := new(catalogmanagementv1.ReplaceOfferingOptions) - replaceOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") - replaceOfferingOptionsModel.OfferingID = core.StringPtr("testString") - replaceOfferingOptionsModel.ID = core.StringPtr("testString") - replaceOfferingOptionsModel.Rev = core.StringPtr("testString") - replaceOfferingOptionsModel.URL = core.StringPtr("testString") - replaceOfferingOptionsModel.CRN = core.StringPtr("testString") - replaceOfferingOptionsModel.Label = core.StringPtr("testString") - replaceOfferingOptionsModel.Name = core.StringPtr("testString") - replaceOfferingOptionsModel.OfferingIconURL = core.StringPtr("testString") - replaceOfferingOptionsModel.OfferingDocsURL = core.StringPtr("testString") - replaceOfferingOptionsModel.OfferingSupportURL = core.StringPtr("testString") - replaceOfferingOptionsModel.Tags = []string{"testString"} - replaceOfferingOptionsModel.Keywords = []string{"testString"} - replaceOfferingOptionsModel.Rating = ratingModel - replaceOfferingOptionsModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") - replaceOfferingOptionsModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - replaceOfferingOptionsModel.ShortDescription = core.StringPtr("testString") - replaceOfferingOptionsModel.LongDescription = core.StringPtr("testString") - replaceOfferingOptionsModel.Features = []catalogmanagementv1.Feature{*featureModel} - replaceOfferingOptionsModel.Kinds = []catalogmanagementv1.Kind{*kindModel} - replaceOfferingOptionsModel.PermitRequestIBMPublicPublish = core.BoolPtr(true) - replaceOfferingOptionsModel.IBMPublishApproved = core.BoolPtr(true) - replaceOfferingOptionsModel.PublicPublishApproved = core.BoolPtr(true) - replaceOfferingOptionsModel.PublicOriginalCRN = core.StringPtr("testString") - replaceOfferingOptionsModel.PublishPublicCRN = core.StringPtr("testString") - replaceOfferingOptionsModel.PortalApprovalRecord = core.StringPtr("testString") - replaceOfferingOptionsModel.PortalUIURL = core.StringPtr("testString") - replaceOfferingOptionsModel.CatalogID = core.StringPtr("testString") - replaceOfferingOptionsModel.CatalogName = core.StringPtr("testString") - replaceOfferingOptionsModel.Metadata = make(map[string]interface{}) - replaceOfferingOptionsModel.Disclaimer = core.StringPtr("testString") - replaceOfferingOptionsModel.Hidden = core.BoolPtr(true) - replaceOfferingOptionsModel.Provider = core.StringPtr("testString") - replaceOfferingOptionsModel.ProviderInfo = providerInfoModel - replaceOfferingOptionsModel.RepoInfo = repoInfoModel - replaceOfferingOptionsModel.Support = supportModel - replaceOfferingOptionsModel.Media = []catalogmanagementv1.MediaItem{*mediaItemModel} - replaceOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getOfferingAccessPath)) + Expect(req.Method).To(Equal("GET")) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke GetOfferingAccess with error: Operation response processing error`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Construct an instance of the GetOfferingAccessOptions model + getOfferingAccessOptionsModel := new(catalogmanagementv1.GetOfferingAccessOptions) + getOfferingAccessOptionsModel.CatalogIdentifier = core.StringPtr("testString") + getOfferingAccessOptionsModel.OfferingID = core.StringPtr("testString") + getOfferingAccessOptionsModel.AccessIdentifier = core.StringPtr("testString") + getOfferingAccessOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := catalogManagementService.ReplaceOffering(replaceOfferingOptionsModel) + result, response, operationErr := catalogManagementService.GetOfferingAccess(getOfferingAccessOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again catalogManagementService.EnableRetries(0, 0) - result, response, operationErr = catalogManagementService.ReplaceOffering(replaceOfferingOptionsModel) + result, response, operationErr = catalogManagementService.GetOfferingAccess(getOfferingAccessOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -5867,32 +12725,16 @@ var _ = Describe(`CatalogManagementV1`, func() { }) }) }) - Describe(`ReplaceOffering(replaceOfferingOptions *ReplaceOfferingOptions)`, func() { - replaceOfferingPath := "/catalogs/testString/offerings/testString" + Describe(`GetOfferingAccess(getOfferingAccessOptions *GetOfferingAccessOptions)`, func() { + getOfferingAccessPath := "/catalogs/testString/offerings/testString/access/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(replaceOfferingPath)) - Expect(req.Method).To(Equal("PUT")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(getOfferingAccessPath)) + Expect(req.Method).To(Equal("GET")) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) @@ -5900,10 +12742,10 @@ var _ = Describe(`CatalogManagementV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "url": "URL", "crn": "CRN", "label": "Label", "name": "Name", "offering_icon_url": "OfferingIconURL", "offering_docs_url": "OfferingDocsURL", "offering_support_url": "OfferingSupportURL", "tags": ["Tags"], "keywords": ["Keywords"], "rating": {"one_star_count": 12, "two_star_count": 12, "three_star_count": 14, "four_star_count": 13}, "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "short_description": "ShortDescription", "long_description": "LongDescription", "features": [{"title": "Title", "description": "Description"}], "kinds": [{"id": "ID", "format_kind": "FormatKind", "target_kind": "TargetKind", "metadata": {"mapKey": "anyValue"}, "install_description": "InstallDescription", "tags": ["Tags"], "additional_features": [{"title": "Title", "description": "Description"}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "versions": [{"id": "ID", "_rev": "Rev", "crn": "CRN", "version": "Version", "sha": "Sha", "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "offering_id": "OfferingID", "catalog_id": "CatalogID", "kind_id": "KindID", "tags": ["Tags"], "repo_url": "RepoURL", "source_url": "SourceURL", "tgz_url": "TgzURL", "configuration": [{"key": "Key", "type": "Type", "default_value": "anyValue", "value_constraint": "ValueConstraint", "description": "Description", "required": true, "options": ["anyValue"], "hidden": true}], "metadata": {"mapKey": "anyValue"}, "validation": {"validated": "2019-01-01T12:00:00.000Z", "requested": "2019-01-01T12:00:00.000Z", "state": "State", "last_operation": "LastOperation", "target": {"mapKey": "anyValue"}}, "required_resources": [{"type": "mem", "value": "anyValue"}], "single_instance": true, "install": {"instructions": "Instructions", "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}, "pre_install": [{"instructions": "Instructions", "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}], "entitlement": {"provider_name": "ProviderName", "provider_id": "ProviderID", "product_id": "ProductID", "part_numbers": ["PartNumbers"], "image_repo_name": "ImageRepoName"}, "licenses": [{"id": "ID", "name": "Name", "type": "Type", "url": "URL", "description": "Description"}], "image_manifest_url": "ImageManifestURL", "deprecated": true, "package_version": "PackageVersion", "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "version_locator": "VersionLocator", "console_url": "ConsoleURL", "long_description": "LongDescription", "whitelisted_accounts": ["WhitelistedAccounts"]}], "plans": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "additional_features": [{"title": "Title", "description": "Description"}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "deployments": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z"}]}]}], "permit_request_ibm_public_publish": false, "ibm_publish_approved": true, "public_publish_approved": false, "public_original_crn": "PublicOriginalCRN", "publish_public_crn": "PublishPublicCRN", "portal_approval_record": "PortalApprovalRecord", "portal_ui_url": "PortalUIURL", "catalog_id": "CatalogID", "catalog_name": "CatalogName", "metadata": {"mapKey": "anyValue"}, "disclaimer": "Disclaimer", "hidden": true, "provider": "Provider", "provider_info": {"id": "ID", "name": "Name"}, "repo_info": {"token": "Token", "type": "Type"}, "support": {"url": "URL", "process": "Process", "locations": ["Locations"]}, "media": [{"url": "URL", "caption": "Caption", "type": "Type", "thumbnail_url": "ThumbnailURL"}]}`) + fmt.Fprintf(res, "%s", `{"id": "ID", "account": "Account", "account_type": 11, "catalog_id": "CatalogID", "target_id": "TargetID", "target_account": "TargetAccount", "target_kind": "TargetKind", "private_accessible": false, "created": "2019-01-01T12:00:00.000Z"}`) })) }) - It(`Invoke ReplaceOffering successfully with retries`, func() { + It(`Invoke GetOfferingAccess successfully with retries`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -5912,222 +12754,251 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) catalogManagementService.EnableRetries(0, 0) - // Construct an instance of the Rating model - ratingModel := new(catalogmanagementv1.Rating) - ratingModel.OneStarCount = core.Int64Ptr(int64(38)) - ratingModel.TwoStarCount = core.Int64Ptr(int64(38)) - ratingModel.ThreeStarCount = core.Int64Ptr(int64(38)) - ratingModel.FourStarCount = core.Int64Ptr(int64(38)) + // Construct an instance of the GetOfferingAccessOptions model + getOfferingAccessOptionsModel := new(catalogmanagementv1.GetOfferingAccessOptions) + getOfferingAccessOptionsModel.CatalogIdentifier = core.StringPtr("testString") + getOfferingAccessOptionsModel.OfferingID = core.StringPtr("testString") + getOfferingAccessOptionsModel.AccessIdentifier = core.StringPtr("testString") + getOfferingAccessOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Construct an instance of the Feature model - featureModel := new(catalogmanagementv1.Feature) - featureModel.Title = core.StringPtr("testString") - featureModel.Description = core.StringPtr("testString") + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := catalogManagementService.GetOfferingAccessWithContext(ctx, getOfferingAccessOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - // Construct an instance of the Configuration model - configurationModel := new(catalogmanagementv1.Configuration) - configurationModel.Key = core.StringPtr("testString") - configurationModel.Type = core.StringPtr("testString") - configurationModel.DefaultValue = core.StringPtr("testString") - configurationModel.ValueConstraint = core.StringPtr("testString") - configurationModel.Description = core.StringPtr("testString") - configurationModel.Required = core.BoolPtr(true) - configurationModel.Options = []interface{}{"testString"} - configurationModel.Hidden = core.BoolPtr(true) + // Disable retries and test again + catalogManagementService.DisableRetries() + result, response, operationErr := catalogManagementService.GetOfferingAccess(getOfferingAccessOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) - // Construct an instance of the Validation model - validationModel := new(catalogmanagementv1.Validation) - validationModel.Validated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - validationModel.Requested = CreateMockDateTime("2019-01-01T12:00:00.000Z") - validationModel.State = core.StringPtr("testString") - validationModel.LastOperation = core.StringPtr("testString") - validationModel.Target = make(map[string]interface{}) + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = catalogManagementService.GetOfferingAccessWithContext(ctx, getOfferingAccessOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() - // Construct an instance of the Resource model - resourceModel := new(catalogmanagementv1.Resource) - resourceModel.Type = core.StringPtr("mem") - resourceModel.Value = core.StringPtr("testString") + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getOfferingAccessPath)) + Expect(req.Method).To(Equal("GET")) - // Construct an instance of the Script model - scriptModel := new(catalogmanagementv1.Script) - scriptModel.Instructions = core.StringPtr("testString") - scriptModel.Script = core.StringPtr("testString") - scriptModel.ScriptPermission = core.StringPtr("testString") - scriptModel.DeleteScript = core.StringPtr("testString") - scriptModel.Scope = core.StringPtr("testString") + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"id": "ID", "account": "Account", "account_type": 11, "catalog_id": "CatalogID", "target_id": "TargetID", "target_account": "TargetAccount", "target_kind": "TargetKind", "private_accessible": false, "created": "2019-01-01T12:00:00.000Z"}`) + })) + }) + It(`Invoke GetOfferingAccess successfully`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the VersionEntitlement model - versionEntitlementModel := new(catalogmanagementv1.VersionEntitlement) - versionEntitlementModel.ProviderName = core.StringPtr("testString") - versionEntitlementModel.ProviderID = core.StringPtr("testString") - versionEntitlementModel.ProductID = core.StringPtr("testString") - versionEntitlementModel.PartNumbers = []string{"testString"} - versionEntitlementModel.ImageRepoName = core.StringPtr("testString") + // Invoke operation with nil options model (negative test) + result, response, operationErr := catalogManagementService.GetOfferingAccess(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) - // Construct an instance of the License model - licenseModel := new(catalogmanagementv1.License) - licenseModel.ID = core.StringPtr("testString") - licenseModel.Name = core.StringPtr("testString") - licenseModel.Type = core.StringPtr("testString") - licenseModel.URL = core.StringPtr("testString") - licenseModel.Description = core.StringPtr("testString") + // Construct an instance of the GetOfferingAccessOptions model + getOfferingAccessOptionsModel := new(catalogmanagementv1.GetOfferingAccessOptions) + getOfferingAccessOptionsModel.CatalogIdentifier = core.StringPtr("testString") + getOfferingAccessOptionsModel.OfferingID = core.StringPtr("testString") + getOfferingAccessOptionsModel.AccessIdentifier = core.StringPtr("testString") + getOfferingAccessOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = catalogManagementService.GetOfferingAccess(getOfferingAccessOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetOfferingAccess with error: Operation validation and request error`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Construct an instance of the GetOfferingAccessOptions model + getOfferingAccessOptionsModel := new(catalogmanagementv1.GetOfferingAccessOptions) + getOfferingAccessOptionsModel.CatalogIdentifier = core.StringPtr("testString") + getOfferingAccessOptionsModel.OfferingID = core.StringPtr("testString") + getOfferingAccessOptionsModel.AccessIdentifier = core.StringPtr("testString") + getOfferingAccessOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := catalogManagementService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := catalogManagementService.GetOfferingAccess(getOfferingAccessOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the GetOfferingAccessOptions model with no property values + getOfferingAccessOptionsModelNew := new(catalogmanagementv1.GetOfferingAccessOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = catalogManagementService.GetOfferingAccess(getOfferingAccessOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke GetOfferingAccess successfully`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the State model - stateModel := new(catalogmanagementv1.State) - stateModel.Current = core.StringPtr("testString") - stateModel.CurrentEntered = CreateMockDateTime("2019-01-01T12:00:00.000Z") - stateModel.Pending = core.StringPtr("testString") - stateModel.PendingRequested = CreateMockDateTime("2019-01-01T12:00:00.000Z") - stateModel.Previous = core.StringPtr("testString") + // Construct an instance of the GetOfferingAccessOptions model + getOfferingAccessOptionsModel := new(catalogmanagementv1.GetOfferingAccessOptions) + getOfferingAccessOptionsModel.CatalogIdentifier = core.StringPtr("testString") + getOfferingAccessOptionsModel.OfferingID = core.StringPtr("testString") + getOfferingAccessOptionsModel.AccessIdentifier = core.StringPtr("testString") + getOfferingAccessOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Construct an instance of the Version model - versionModel := new(catalogmanagementv1.Version) - versionModel.ID = core.StringPtr("testString") - versionModel.Rev = core.StringPtr("testString") - versionModel.CRN = core.StringPtr("testString") - versionModel.Version = core.StringPtr("testString") - versionModel.Sha = core.StringPtr("testString") - versionModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") - versionModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - versionModel.OfferingID = core.StringPtr("testString") - versionModel.CatalogID = core.StringPtr("testString") - versionModel.KindID = core.StringPtr("testString") - versionModel.Tags = []string{"testString"} - versionModel.RepoURL = core.StringPtr("testString") - versionModel.SourceURL = core.StringPtr("testString") - versionModel.TgzURL = core.StringPtr("testString") - versionModel.Configuration = []catalogmanagementv1.Configuration{*configurationModel} - versionModel.Metadata = make(map[string]interface{}) - versionModel.Validation = validationModel - versionModel.RequiredResources = []catalogmanagementv1.Resource{*resourceModel} - versionModel.SingleInstance = core.BoolPtr(true) - versionModel.Install = scriptModel - versionModel.PreInstall = []catalogmanagementv1.Script{*scriptModel} - versionModel.Entitlement = versionEntitlementModel - versionModel.Licenses = []catalogmanagementv1.License{*licenseModel} - versionModel.ImageManifestURL = core.StringPtr("testString") - versionModel.Deprecated = core.BoolPtr(true) - versionModel.PackageVersion = core.StringPtr("testString") - versionModel.State = stateModel - versionModel.VersionLocator = core.StringPtr("testString") - versionModel.ConsoleURL = core.StringPtr("testString") - versionModel.LongDescription = core.StringPtr("testString") - versionModel.WhitelistedAccounts = []string{"testString"} + // Invoke operation + result, response, operationErr := catalogManagementService.GetOfferingAccess(getOfferingAccessOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) - // Construct an instance of the Deployment model - deploymentModel := new(catalogmanagementv1.Deployment) - deploymentModel.ID = core.StringPtr("testString") - deploymentModel.Label = core.StringPtr("testString") - deploymentModel.Name = core.StringPtr("testString") - deploymentModel.ShortDescription = core.StringPtr("testString") - deploymentModel.LongDescription = core.StringPtr("testString") - deploymentModel.Metadata = make(map[string]interface{}) - deploymentModel.Tags = []string{"testString"} - deploymentModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") - deploymentModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetOfferingAccessList(getOfferingAccessListOptions *GetOfferingAccessListOptions) - Operation response error`, func() { + getOfferingAccessListPath := "/catalogs/testString/offerings/testString/access" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() - // Construct an instance of the Plan model - planModel := new(catalogmanagementv1.Plan) - planModel.ID = core.StringPtr("testString") - planModel.Label = core.StringPtr("testString") - planModel.Name = core.StringPtr("testString") - planModel.ShortDescription = core.StringPtr("testString") - planModel.LongDescription = core.StringPtr("testString") - planModel.Metadata = make(map[string]interface{}) - planModel.Tags = []string{"testString"} - planModel.AdditionalFeatures = []catalogmanagementv1.Feature{*featureModel} - planModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") - planModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - planModel.Deployments = []catalogmanagementv1.Deployment{*deploymentModel} + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getOfferingAccessListPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke GetOfferingAccessList with error: Operation response processing error`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the Kind model - kindModel := new(catalogmanagementv1.Kind) - kindModel.ID = core.StringPtr("testString") - kindModel.FormatKind = core.StringPtr("testString") - kindModel.TargetKind = core.StringPtr("testString") - kindModel.Metadata = make(map[string]interface{}) - kindModel.InstallDescription = core.StringPtr("testString") - kindModel.Tags = []string{"testString"} - kindModel.AdditionalFeatures = []catalogmanagementv1.Feature{*featureModel} - kindModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") - kindModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - kindModel.Versions = []catalogmanagementv1.Version{*versionModel} - kindModel.Plans = []catalogmanagementv1.Plan{*planModel} + // Construct an instance of the GetOfferingAccessListOptions model + getOfferingAccessListOptionsModel := new(catalogmanagementv1.GetOfferingAccessListOptions) + getOfferingAccessListOptionsModel.CatalogIdentifier = core.StringPtr("testString") + getOfferingAccessListOptionsModel.OfferingID = core.StringPtr("testString") + getOfferingAccessListOptionsModel.Start = core.StringPtr("testString") + getOfferingAccessListOptionsModel.Limit = core.Int64Ptr(int64(10)) + getOfferingAccessListOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := catalogManagementService.GetOfferingAccessList(getOfferingAccessListOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) - // Construct an instance of the ProviderInfo model - providerInfoModel := new(catalogmanagementv1.ProviderInfo) - providerInfoModel.ID = core.StringPtr("testString") - providerInfoModel.Name = core.StringPtr("testString") + // Enable retries and test again + catalogManagementService.EnableRetries(0, 0) + result, response, operationErr = catalogManagementService.GetOfferingAccessList(getOfferingAccessListOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetOfferingAccessList(getOfferingAccessListOptions *GetOfferingAccessListOptions)`, func() { + getOfferingAccessListPath := "/catalogs/testString/offerings/testString/access" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() - // Construct an instance of the RepoInfo model - repoInfoModel := new(catalogmanagementv1.RepoInfo) - repoInfoModel.Token = core.StringPtr("testString") - repoInfoModel.Type = core.StringPtr("testString") + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getOfferingAccessListPath)) + Expect(req.Method).To(Equal("GET")) - // Construct an instance of the Support model - supportModel := new(catalogmanagementv1.Support) - supportModel.URL = core.StringPtr("testString") - supportModel.Process = core.StringPtr("testString") - supportModel.Locations = []string{"testString"} + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) - // Construct an instance of the MediaItem model - mediaItemModel := new(catalogmanagementv1.MediaItem) - mediaItemModel.URL = core.StringPtr("testString") - mediaItemModel.Caption = core.StringPtr("testString") - mediaItemModel.Type = core.StringPtr("testString") - mediaItemModel.ThumbnailURL = core.StringPtr("testString") + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"start": "Start", "limit": 5, "total_count": 10, "resource_count": 13, "first": {"href": "Href", "start": "Start"}, "next": {"href": "Href", "start": "Start"}, "prev": {"href": "Href", "start": "Start"}, "last": {"href": "Href", "start": "Start"}, "resources": [{"id": "ID", "account": "Account", "account_type": 11, "catalog_id": "CatalogID", "target_id": "TargetID", "target_account": "TargetAccount", "target_kind": "TargetKind", "private_accessible": false, "created": "2019-01-01T12:00:00.000Z"}]}`) + })) + }) + It(`Invoke GetOfferingAccessList successfully with retries`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + catalogManagementService.EnableRetries(0, 0) - // Construct an instance of the ReplaceOfferingOptions model - replaceOfferingOptionsModel := new(catalogmanagementv1.ReplaceOfferingOptions) - replaceOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") - replaceOfferingOptionsModel.OfferingID = core.StringPtr("testString") - replaceOfferingOptionsModel.ID = core.StringPtr("testString") - replaceOfferingOptionsModel.Rev = core.StringPtr("testString") - replaceOfferingOptionsModel.URL = core.StringPtr("testString") - replaceOfferingOptionsModel.CRN = core.StringPtr("testString") - replaceOfferingOptionsModel.Label = core.StringPtr("testString") - replaceOfferingOptionsModel.Name = core.StringPtr("testString") - replaceOfferingOptionsModel.OfferingIconURL = core.StringPtr("testString") - replaceOfferingOptionsModel.OfferingDocsURL = core.StringPtr("testString") - replaceOfferingOptionsModel.OfferingSupportURL = core.StringPtr("testString") - replaceOfferingOptionsModel.Tags = []string{"testString"} - replaceOfferingOptionsModel.Keywords = []string{"testString"} - replaceOfferingOptionsModel.Rating = ratingModel - replaceOfferingOptionsModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") - replaceOfferingOptionsModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - replaceOfferingOptionsModel.ShortDescription = core.StringPtr("testString") - replaceOfferingOptionsModel.LongDescription = core.StringPtr("testString") - replaceOfferingOptionsModel.Features = []catalogmanagementv1.Feature{*featureModel} - replaceOfferingOptionsModel.Kinds = []catalogmanagementv1.Kind{*kindModel} - replaceOfferingOptionsModel.PermitRequestIBMPublicPublish = core.BoolPtr(true) - replaceOfferingOptionsModel.IBMPublishApproved = core.BoolPtr(true) - replaceOfferingOptionsModel.PublicPublishApproved = core.BoolPtr(true) - replaceOfferingOptionsModel.PublicOriginalCRN = core.StringPtr("testString") - replaceOfferingOptionsModel.PublishPublicCRN = core.StringPtr("testString") - replaceOfferingOptionsModel.PortalApprovalRecord = core.StringPtr("testString") - replaceOfferingOptionsModel.PortalUIURL = core.StringPtr("testString") - replaceOfferingOptionsModel.CatalogID = core.StringPtr("testString") - replaceOfferingOptionsModel.CatalogName = core.StringPtr("testString") - replaceOfferingOptionsModel.Metadata = make(map[string]interface{}) - replaceOfferingOptionsModel.Disclaimer = core.StringPtr("testString") - replaceOfferingOptionsModel.Hidden = core.BoolPtr(true) - replaceOfferingOptionsModel.Provider = core.StringPtr("testString") - replaceOfferingOptionsModel.ProviderInfo = providerInfoModel - replaceOfferingOptionsModel.RepoInfo = repoInfoModel - replaceOfferingOptionsModel.Support = supportModel - replaceOfferingOptionsModel.Media = []catalogmanagementv1.MediaItem{*mediaItemModel} - replaceOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetOfferingAccessListOptions model + getOfferingAccessListOptionsModel := new(catalogmanagementv1.GetOfferingAccessListOptions) + getOfferingAccessListOptionsModel.CatalogIdentifier = core.StringPtr("testString") + getOfferingAccessListOptionsModel.OfferingID = core.StringPtr("testString") + getOfferingAccessListOptionsModel.Start = core.StringPtr("testString") + getOfferingAccessListOptionsModel.Limit = core.Int64Ptr(int64(10)) + getOfferingAccessListOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := catalogManagementService.ReplaceOfferingWithContext(ctx, replaceOfferingOptionsModel) + _, _, operationErr := catalogManagementService.GetOfferingAccessListWithContext(ctx, getOfferingAccessListOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again catalogManagementService.DisableRetries() - result, response, operationErr := catalogManagementService.ReplaceOffering(replaceOfferingOptionsModel) + result, response, operationErr := catalogManagementService.GetOfferingAccessList(getOfferingAccessListOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -6135,46 +13006,105 @@ var _ = Describe(`CatalogManagementV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = catalogManagementService.ReplaceOfferingWithContext(ctx, replaceOfferingOptionsModel) + _, _, operationErr = catalogManagementService.GetOfferingAccessListWithContext(ctx, getOfferingAccessListOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getOfferingAccessListPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"start": "Start", "limit": 5, "total_count": 10, "resource_count": 13, "first": {"href": "Href", "start": "Start"}, "next": {"href": "Href", "start": "Start"}, "prev": {"href": "Href", "start": "Start"}, "last": {"href": "Href", "start": "Start"}, "resources": [{"id": "ID", "account": "Account", "account_type": 11, "catalog_id": "CatalogID", "target_id": "TargetID", "target_account": "TargetAccount", "target_kind": "TargetKind", "private_accessible": false, "created": "2019-01-01T12:00:00.000Z"}]}`) + })) + }) + It(`Invoke GetOfferingAccessList successfully`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := catalogManagementService.GetOfferingAccessList(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetOfferingAccessListOptions model + getOfferingAccessListOptionsModel := new(catalogmanagementv1.GetOfferingAccessListOptions) + getOfferingAccessListOptionsModel.CatalogIdentifier = core.StringPtr("testString") + getOfferingAccessListOptionsModel.OfferingID = core.StringPtr("testString") + getOfferingAccessListOptionsModel.Start = core.StringPtr("testString") + getOfferingAccessListOptionsModel.Limit = core.Int64Ptr(int64(10)) + getOfferingAccessListOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = catalogManagementService.GetOfferingAccessList(getOfferingAccessListOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetOfferingAccessList with error: Operation validation and request error`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Construct an instance of the GetOfferingAccessListOptions model + getOfferingAccessListOptionsModel := new(catalogmanagementv1.GetOfferingAccessListOptions) + getOfferingAccessListOptionsModel.CatalogIdentifier = core.StringPtr("testString") + getOfferingAccessListOptionsModel.OfferingID = core.StringPtr("testString") + getOfferingAccessListOptionsModel.Start = core.StringPtr("testString") + getOfferingAccessListOptionsModel.Limit = core.Int64Ptr(int64(10)) + getOfferingAccessListOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := catalogManagementService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := catalogManagementService.GetOfferingAccessList(getOfferingAccessListOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the GetOfferingAccessListOptions model with no property values + getOfferingAccessListOptionsModelNew := new(catalogmanagementv1.GetOfferingAccessListOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = catalogManagementService.GetOfferingAccessList(getOfferingAccessListOptionsModelNew) Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) - Context(`Using mock server endpoint`, func() { + Context(`Using mock server endpoint with missing response body`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(replaceOfferingPath)) - Expect(req.Method).To(Equal("PUT")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) - - // Set mock response - res.Header().Set("Content-type", "application/json") + // Set success status code with no respoonse body res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "url": "URL", "crn": "CRN", "label": "Label", "name": "Name", "offering_icon_url": "OfferingIconURL", "offering_docs_url": "OfferingDocsURL", "offering_support_url": "OfferingSupportURL", "tags": ["Tags"], "keywords": ["Keywords"], "rating": {"one_star_count": 12, "two_star_count": 12, "three_star_count": 14, "four_star_count": 13}, "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "short_description": "ShortDescription", "long_description": "LongDescription", "features": [{"title": "Title", "description": "Description"}], "kinds": [{"id": "ID", "format_kind": "FormatKind", "target_kind": "TargetKind", "metadata": {"mapKey": "anyValue"}, "install_description": "InstallDescription", "tags": ["Tags"], "additional_features": [{"title": "Title", "description": "Description"}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "versions": [{"id": "ID", "_rev": "Rev", "crn": "CRN", "version": "Version", "sha": "Sha", "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "offering_id": "OfferingID", "catalog_id": "CatalogID", "kind_id": "KindID", "tags": ["Tags"], "repo_url": "RepoURL", "source_url": "SourceURL", "tgz_url": "TgzURL", "configuration": [{"key": "Key", "type": "Type", "default_value": "anyValue", "value_constraint": "ValueConstraint", "description": "Description", "required": true, "options": ["anyValue"], "hidden": true}], "metadata": {"mapKey": "anyValue"}, "validation": {"validated": "2019-01-01T12:00:00.000Z", "requested": "2019-01-01T12:00:00.000Z", "state": "State", "last_operation": "LastOperation", "target": {"mapKey": "anyValue"}}, "required_resources": [{"type": "mem", "value": "anyValue"}], "single_instance": true, "install": {"instructions": "Instructions", "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}, "pre_install": [{"instructions": "Instructions", "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}], "entitlement": {"provider_name": "ProviderName", "provider_id": "ProviderID", "product_id": "ProductID", "part_numbers": ["PartNumbers"], "image_repo_name": "ImageRepoName"}, "licenses": [{"id": "ID", "name": "Name", "type": "Type", "url": "URL", "description": "Description"}], "image_manifest_url": "ImageManifestURL", "deprecated": true, "package_version": "PackageVersion", "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "version_locator": "VersionLocator", "console_url": "ConsoleURL", "long_description": "LongDescription", "whitelisted_accounts": ["WhitelistedAccounts"]}], "plans": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "additional_features": [{"title": "Title", "description": "Description"}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "deployments": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z"}]}]}], "permit_request_ibm_public_publish": false, "ibm_publish_approved": true, "public_publish_approved": false, "public_original_crn": "PublicOriginalCRN", "publish_public_crn": "PublishPublicCRN", "portal_approval_record": "PortalApprovalRecord", "portal_ui_url": "PortalUIURL", "catalog_id": "CatalogID", "catalog_name": "CatalogName", "metadata": {"mapKey": "anyValue"}, "disclaimer": "Disclaimer", "hidden": true, "provider": "Provider", "provider_info": {"id": "ID", "name": "Name"}, "repo_info": {"token": "Token", "type": "Type"}, "support": {"url": "URL", "process": "Process", "locations": ["Locations"]}, "media": [{"url": "URL", "caption": "Caption", "type": "Type", "thumbnail_url": "ThumbnailURL"}]}`) })) }) - It(`Invoke ReplaceOffering successfully`, func() { + It(`Invoke GetOfferingAccessList successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -6182,226 +13112,69 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Invoke operation with nil options model (negative test) - result, response, operationErr := catalogManagementService.ReplaceOffering(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the Rating model - ratingModel := new(catalogmanagementv1.Rating) - ratingModel.OneStarCount = core.Int64Ptr(int64(38)) - ratingModel.TwoStarCount = core.Int64Ptr(int64(38)) - ratingModel.ThreeStarCount = core.Int64Ptr(int64(38)) - ratingModel.FourStarCount = core.Int64Ptr(int64(38)) - - // Construct an instance of the Feature model - featureModel := new(catalogmanagementv1.Feature) - featureModel.Title = core.StringPtr("testString") - featureModel.Description = core.StringPtr("testString") - - // Construct an instance of the Configuration model - configurationModel := new(catalogmanagementv1.Configuration) - configurationModel.Key = core.StringPtr("testString") - configurationModel.Type = core.StringPtr("testString") - configurationModel.DefaultValue = core.StringPtr("testString") - configurationModel.ValueConstraint = core.StringPtr("testString") - configurationModel.Description = core.StringPtr("testString") - configurationModel.Required = core.BoolPtr(true) - configurationModel.Options = []interface{}{"testString"} - configurationModel.Hidden = core.BoolPtr(true) - - // Construct an instance of the Validation model - validationModel := new(catalogmanagementv1.Validation) - validationModel.Validated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - validationModel.Requested = CreateMockDateTime("2019-01-01T12:00:00.000Z") - validationModel.State = core.StringPtr("testString") - validationModel.LastOperation = core.StringPtr("testString") - validationModel.Target = make(map[string]interface{}) - - // Construct an instance of the Resource model - resourceModel := new(catalogmanagementv1.Resource) - resourceModel.Type = core.StringPtr("mem") - resourceModel.Value = core.StringPtr("testString") - - // Construct an instance of the Script model - scriptModel := new(catalogmanagementv1.Script) - scriptModel.Instructions = core.StringPtr("testString") - scriptModel.Script = core.StringPtr("testString") - scriptModel.ScriptPermission = core.StringPtr("testString") - scriptModel.DeleteScript = core.StringPtr("testString") - scriptModel.Scope = core.StringPtr("testString") - - // Construct an instance of the VersionEntitlement model - versionEntitlementModel := new(catalogmanagementv1.VersionEntitlement) - versionEntitlementModel.ProviderName = core.StringPtr("testString") - versionEntitlementModel.ProviderID = core.StringPtr("testString") - versionEntitlementModel.ProductID = core.StringPtr("testString") - versionEntitlementModel.PartNumbers = []string{"testString"} - versionEntitlementModel.ImageRepoName = core.StringPtr("testString") - - // Construct an instance of the License model - licenseModel := new(catalogmanagementv1.License) - licenseModel.ID = core.StringPtr("testString") - licenseModel.Name = core.StringPtr("testString") - licenseModel.Type = core.StringPtr("testString") - licenseModel.URL = core.StringPtr("testString") - licenseModel.Description = core.StringPtr("testString") - - // Construct an instance of the State model - stateModel := new(catalogmanagementv1.State) - stateModel.Current = core.StringPtr("testString") - stateModel.CurrentEntered = CreateMockDateTime("2019-01-01T12:00:00.000Z") - stateModel.Pending = core.StringPtr("testString") - stateModel.PendingRequested = CreateMockDateTime("2019-01-01T12:00:00.000Z") - stateModel.Previous = core.StringPtr("testString") - - // Construct an instance of the Version model - versionModel := new(catalogmanagementv1.Version) - versionModel.ID = core.StringPtr("testString") - versionModel.Rev = core.StringPtr("testString") - versionModel.CRN = core.StringPtr("testString") - versionModel.Version = core.StringPtr("testString") - versionModel.Sha = core.StringPtr("testString") - versionModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") - versionModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - versionModel.OfferingID = core.StringPtr("testString") - versionModel.CatalogID = core.StringPtr("testString") - versionModel.KindID = core.StringPtr("testString") - versionModel.Tags = []string{"testString"} - versionModel.RepoURL = core.StringPtr("testString") - versionModel.SourceURL = core.StringPtr("testString") - versionModel.TgzURL = core.StringPtr("testString") - versionModel.Configuration = []catalogmanagementv1.Configuration{*configurationModel} - versionModel.Metadata = make(map[string]interface{}) - versionModel.Validation = validationModel - versionModel.RequiredResources = []catalogmanagementv1.Resource{*resourceModel} - versionModel.SingleInstance = core.BoolPtr(true) - versionModel.Install = scriptModel - versionModel.PreInstall = []catalogmanagementv1.Script{*scriptModel} - versionModel.Entitlement = versionEntitlementModel - versionModel.Licenses = []catalogmanagementv1.License{*licenseModel} - versionModel.ImageManifestURL = core.StringPtr("testString") - versionModel.Deprecated = core.BoolPtr(true) - versionModel.PackageVersion = core.StringPtr("testString") - versionModel.State = stateModel - versionModel.VersionLocator = core.StringPtr("testString") - versionModel.ConsoleURL = core.StringPtr("testString") - versionModel.LongDescription = core.StringPtr("testString") - versionModel.WhitelistedAccounts = []string{"testString"} - - // Construct an instance of the Deployment model - deploymentModel := new(catalogmanagementv1.Deployment) - deploymentModel.ID = core.StringPtr("testString") - deploymentModel.Label = core.StringPtr("testString") - deploymentModel.Name = core.StringPtr("testString") - deploymentModel.ShortDescription = core.StringPtr("testString") - deploymentModel.LongDescription = core.StringPtr("testString") - deploymentModel.Metadata = make(map[string]interface{}) - deploymentModel.Tags = []string{"testString"} - deploymentModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") - deploymentModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - - // Construct an instance of the Plan model - planModel := new(catalogmanagementv1.Plan) - planModel.ID = core.StringPtr("testString") - planModel.Label = core.StringPtr("testString") - planModel.Name = core.StringPtr("testString") - planModel.ShortDescription = core.StringPtr("testString") - planModel.LongDescription = core.StringPtr("testString") - planModel.Metadata = make(map[string]interface{}) - planModel.Tags = []string{"testString"} - planModel.AdditionalFeatures = []catalogmanagementv1.Feature{*featureModel} - planModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") - planModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - planModel.Deployments = []catalogmanagementv1.Deployment{*deploymentModel} - - // Construct an instance of the Kind model - kindModel := new(catalogmanagementv1.Kind) - kindModel.ID = core.StringPtr("testString") - kindModel.FormatKind = core.StringPtr("testString") - kindModel.TargetKind = core.StringPtr("testString") - kindModel.Metadata = make(map[string]interface{}) - kindModel.InstallDescription = core.StringPtr("testString") - kindModel.Tags = []string{"testString"} - kindModel.AdditionalFeatures = []catalogmanagementv1.Feature{*featureModel} - kindModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") - kindModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - kindModel.Versions = []catalogmanagementv1.Version{*versionModel} - kindModel.Plans = []catalogmanagementv1.Plan{*planModel} - - // Construct an instance of the ProviderInfo model - providerInfoModel := new(catalogmanagementv1.ProviderInfo) - providerInfoModel.ID = core.StringPtr("testString") - providerInfoModel.Name = core.StringPtr("testString") - - // Construct an instance of the RepoInfo model - repoInfoModel := new(catalogmanagementv1.RepoInfo) - repoInfoModel.Token = core.StringPtr("testString") - repoInfoModel.Type = core.StringPtr("testString") - - // Construct an instance of the Support model - supportModel := new(catalogmanagementv1.Support) - supportModel.URL = core.StringPtr("testString") - supportModel.Process = core.StringPtr("testString") - supportModel.Locations = []string{"testString"} + // Construct an instance of the GetOfferingAccessListOptions model + getOfferingAccessListOptionsModel := new(catalogmanagementv1.GetOfferingAccessListOptions) + getOfferingAccessListOptionsModel.CatalogIdentifier = core.StringPtr("testString") + getOfferingAccessListOptionsModel.OfferingID = core.StringPtr("testString") + getOfferingAccessListOptionsModel.Start = core.StringPtr("testString") + getOfferingAccessListOptionsModel.Limit = core.Int64Ptr(int64(10)) + getOfferingAccessListOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Construct an instance of the MediaItem model - mediaItemModel := new(catalogmanagementv1.MediaItem) - mediaItemModel.URL = core.StringPtr("testString") - mediaItemModel.Caption = core.StringPtr("testString") - mediaItemModel.Type = core.StringPtr("testString") - mediaItemModel.ThumbnailURL = core.StringPtr("testString") + // Invoke operation + result, response, operationErr := catalogManagementService.GetOfferingAccessList(getOfferingAccessListOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) - // Construct an instance of the ReplaceOfferingOptions model - replaceOfferingOptionsModel := new(catalogmanagementv1.ReplaceOfferingOptions) - replaceOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") - replaceOfferingOptionsModel.OfferingID = core.StringPtr("testString") - replaceOfferingOptionsModel.ID = core.StringPtr("testString") - replaceOfferingOptionsModel.Rev = core.StringPtr("testString") - replaceOfferingOptionsModel.URL = core.StringPtr("testString") - replaceOfferingOptionsModel.CRN = core.StringPtr("testString") - replaceOfferingOptionsModel.Label = core.StringPtr("testString") - replaceOfferingOptionsModel.Name = core.StringPtr("testString") - replaceOfferingOptionsModel.OfferingIconURL = core.StringPtr("testString") - replaceOfferingOptionsModel.OfferingDocsURL = core.StringPtr("testString") - replaceOfferingOptionsModel.OfferingSupportURL = core.StringPtr("testString") - replaceOfferingOptionsModel.Tags = []string{"testString"} - replaceOfferingOptionsModel.Keywords = []string{"testString"} - replaceOfferingOptionsModel.Rating = ratingModel - replaceOfferingOptionsModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") - replaceOfferingOptionsModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - replaceOfferingOptionsModel.ShortDescription = core.StringPtr("testString") - replaceOfferingOptionsModel.LongDescription = core.StringPtr("testString") - replaceOfferingOptionsModel.Features = []catalogmanagementv1.Feature{*featureModel} - replaceOfferingOptionsModel.Kinds = []catalogmanagementv1.Kind{*kindModel} - replaceOfferingOptionsModel.PermitRequestIBMPublicPublish = core.BoolPtr(true) - replaceOfferingOptionsModel.IBMPublishApproved = core.BoolPtr(true) - replaceOfferingOptionsModel.PublicPublishApproved = core.BoolPtr(true) - replaceOfferingOptionsModel.PublicOriginalCRN = core.StringPtr("testString") - replaceOfferingOptionsModel.PublishPublicCRN = core.StringPtr("testString") - replaceOfferingOptionsModel.PortalApprovalRecord = core.StringPtr("testString") - replaceOfferingOptionsModel.PortalUIURL = core.StringPtr("testString") - replaceOfferingOptionsModel.CatalogID = core.StringPtr("testString") - replaceOfferingOptionsModel.CatalogName = core.StringPtr("testString") - replaceOfferingOptionsModel.Metadata = make(map[string]interface{}) - replaceOfferingOptionsModel.Disclaimer = core.StringPtr("testString") - replaceOfferingOptionsModel.Hidden = core.BoolPtr(true) - replaceOfferingOptionsModel.Provider = core.StringPtr("testString") - replaceOfferingOptionsModel.ProviderInfo = providerInfoModel - replaceOfferingOptionsModel.RepoInfo = repoInfoModel - replaceOfferingOptionsModel.Support = supportModel - replaceOfferingOptionsModel.Media = []catalogmanagementv1.MediaItem{*mediaItemModel} - replaceOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Test pagination helper method on response`, func() { + It(`Invoke GetNextStart successfully`, func() { + responseObject := new(catalogmanagementv1.AccessListResult) + nextObject := new(catalogmanagementv1.PaginationTokenLink) + nextObject.Start = core.StringPtr("abc-123") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(Equal(core.StringPtr("abc-123"))) + }) + It(`Invoke GetNextStart without a "Next" property in the response`, func() { + responseObject := new(catalogmanagementv1.AccessListResult) + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + Context(`Using mock server endpoint - paginated response`, func() { + BeforeEach(func() { + var requestNumber int = 0 + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() - // Invoke operation with valid options model (positive test) - result, response, operationErr = catalogManagementService.ReplaceOffering(replaceOfferingOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getOfferingAccessListPath)) + Expect(req.Method).To(Equal("GET")) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + requestNumber++ + if requestNumber == 1 { + fmt.Fprintf(res, "%s", `{"next":{"start":"1"},"total_count":2,"limit":1,"resources":[{"id":"ID","account":"Account","account_type":11,"catalog_id":"CatalogID","target_id":"TargetID","target_account":"TargetAccount","target_kind":"TargetKind","private_accessible":false,"created":"2019-01-01T12:00:00.000Z"}]}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"resources":[{"id":"ID","account":"Account","account_type":11,"catalog_id":"CatalogID","target_id":"TargetID","target_account":"TargetAccount","target_kind":"TargetKind","private_accessible":false,"created":"2019-01-01T12:00:00.000Z"}]}`) + } else { + res.WriteHeader(400) + } + })) }) - It(`Invoke ReplaceOffering with error: Operation validation and request error`, func() { + It(`Use GetOfferingAccessListPager.GetNext successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -6409,456 +13182,293 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the Rating model - ratingModel := new(catalogmanagementv1.Rating) - ratingModel.OneStarCount = core.Int64Ptr(int64(38)) - ratingModel.TwoStarCount = core.Int64Ptr(int64(38)) - ratingModel.ThreeStarCount = core.Int64Ptr(int64(38)) - ratingModel.FourStarCount = core.Int64Ptr(int64(38)) - - // Construct an instance of the Feature model - featureModel := new(catalogmanagementv1.Feature) - featureModel.Title = core.StringPtr("testString") - featureModel.Description = core.StringPtr("testString") - - // Construct an instance of the Configuration model - configurationModel := new(catalogmanagementv1.Configuration) - configurationModel.Key = core.StringPtr("testString") - configurationModel.Type = core.StringPtr("testString") - configurationModel.DefaultValue = core.StringPtr("testString") - configurationModel.ValueConstraint = core.StringPtr("testString") - configurationModel.Description = core.StringPtr("testString") - configurationModel.Required = core.BoolPtr(true) - configurationModel.Options = []interface{}{"testString"} - configurationModel.Hidden = core.BoolPtr(true) - - // Construct an instance of the Validation model - validationModel := new(catalogmanagementv1.Validation) - validationModel.Validated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - validationModel.Requested = CreateMockDateTime("2019-01-01T12:00:00.000Z") - validationModel.State = core.StringPtr("testString") - validationModel.LastOperation = core.StringPtr("testString") - validationModel.Target = make(map[string]interface{}) - - // Construct an instance of the Resource model - resourceModel := new(catalogmanagementv1.Resource) - resourceModel.Type = core.StringPtr("mem") - resourceModel.Value = core.StringPtr("testString") - - // Construct an instance of the Script model - scriptModel := new(catalogmanagementv1.Script) - scriptModel.Instructions = core.StringPtr("testString") - scriptModel.Script = core.StringPtr("testString") - scriptModel.ScriptPermission = core.StringPtr("testString") - scriptModel.DeleteScript = core.StringPtr("testString") - scriptModel.Scope = core.StringPtr("testString") - - // Construct an instance of the VersionEntitlement model - versionEntitlementModel := new(catalogmanagementv1.VersionEntitlement) - versionEntitlementModel.ProviderName = core.StringPtr("testString") - versionEntitlementModel.ProviderID = core.StringPtr("testString") - versionEntitlementModel.ProductID = core.StringPtr("testString") - versionEntitlementModel.PartNumbers = []string{"testString"} - versionEntitlementModel.ImageRepoName = core.StringPtr("testString") - - // Construct an instance of the License model - licenseModel := new(catalogmanagementv1.License) - licenseModel.ID = core.StringPtr("testString") - licenseModel.Name = core.StringPtr("testString") - licenseModel.Type = core.StringPtr("testString") - licenseModel.URL = core.StringPtr("testString") - licenseModel.Description = core.StringPtr("testString") - - // Construct an instance of the State model - stateModel := new(catalogmanagementv1.State) - stateModel.Current = core.StringPtr("testString") - stateModel.CurrentEntered = CreateMockDateTime("2019-01-01T12:00:00.000Z") - stateModel.Pending = core.StringPtr("testString") - stateModel.PendingRequested = CreateMockDateTime("2019-01-01T12:00:00.000Z") - stateModel.Previous = core.StringPtr("testString") - - // Construct an instance of the Version model - versionModel := new(catalogmanagementv1.Version) - versionModel.ID = core.StringPtr("testString") - versionModel.Rev = core.StringPtr("testString") - versionModel.CRN = core.StringPtr("testString") - versionModel.Version = core.StringPtr("testString") - versionModel.Sha = core.StringPtr("testString") - versionModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") - versionModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - versionModel.OfferingID = core.StringPtr("testString") - versionModel.CatalogID = core.StringPtr("testString") - versionModel.KindID = core.StringPtr("testString") - versionModel.Tags = []string{"testString"} - versionModel.RepoURL = core.StringPtr("testString") - versionModel.SourceURL = core.StringPtr("testString") - versionModel.TgzURL = core.StringPtr("testString") - versionModel.Configuration = []catalogmanagementv1.Configuration{*configurationModel} - versionModel.Metadata = make(map[string]interface{}) - versionModel.Validation = validationModel - versionModel.RequiredResources = []catalogmanagementv1.Resource{*resourceModel} - versionModel.SingleInstance = core.BoolPtr(true) - versionModel.Install = scriptModel - versionModel.PreInstall = []catalogmanagementv1.Script{*scriptModel} - versionModel.Entitlement = versionEntitlementModel - versionModel.Licenses = []catalogmanagementv1.License{*licenseModel} - versionModel.ImageManifestURL = core.StringPtr("testString") - versionModel.Deprecated = core.BoolPtr(true) - versionModel.PackageVersion = core.StringPtr("testString") - versionModel.State = stateModel - versionModel.VersionLocator = core.StringPtr("testString") - versionModel.ConsoleURL = core.StringPtr("testString") - versionModel.LongDescription = core.StringPtr("testString") - versionModel.WhitelistedAccounts = []string{"testString"} - - // Construct an instance of the Deployment model - deploymentModel := new(catalogmanagementv1.Deployment) - deploymentModel.ID = core.StringPtr("testString") - deploymentModel.Label = core.StringPtr("testString") - deploymentModel.Name = core.StringPtr("testString") - deploymentModel.ShortDescription = core.StringPtr("testString") - deploymentModel.LongDescription = core.StringPtr("testString") - deploymentModel.Metadata = make(map[string]interface{}) - deploymentModel.Tags = []string{"testString"} - deploymentModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") - deploymentModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - - // Construct an instance of the Plan model - planModel := new(catalogmanagementv1.Plan) - planModel.ID = core.StringPtr("testString") - planModel.Label = core.StringPtr("testString") - planModel.Name = core.StringPtr("testString") - planModel.ShortDescription = core.StringPtr("testString") - planModel.LongDescription = core.StringPtr("testString") - planModel.Metadata = make(map[string]interface{}) - planModel.Tags = []string{"testString"} - planModel.AdditionalFeatures = []catalogmanagementv1.Feature{*featureModel} - planModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") - planModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - planModel.Deployments = []catalogmanagementv1.Deployment{*deploymentModel} + getOfferingAccessListOptionsModel := &catalogmanagementv1.GetOfferingAccessListOptions{ + CatalogIdentifier: core.StringPtr("testString"), + OfferingID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + } - // Construct an instance of the Kind model - kindModel := new(catalogmanagementv1.Kind) - kindModel.ID = core.StringPtr("testString") - kindModel.FormatKind = core.StringPtr("testString") - kindModel.TargetKind = core.StringPtr("testString") - kindModel.Metadata = make(map[string]interface{}) - kindModel.InstallDescription = core.StringPtr("testString") - kindModel.Tags = []string{"testString"} - kindModel.AdditionalFeatures = []catalogmanagementv1.Feature{*featureModel} - kindModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") - kindModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - kindModel.Versions = []catalogmanagementv1.Version{*versionModel} - kindModel.Plans = []catalogmanagementv1.Plan{*planModel} + pager, err := catalogManagementService.NewGetOfferingAccessListPager(getOfferingAccessListOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []catalogmanagementv1.Access + for pager.HasNext() { + nextPage, err := pager.GetNext() + Expect(err).To(BeNil()) + Expect(nextPage).ToNot(BeNil()) + allResults = append(allResults, nextPage...) + } + Expect(len(allResults)).To(Equal(2)) + }) + It(`Use GetOfferingAccessListPager.GetAll successfully`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the ProviderInfo model - providerInfoModel := new(catalogmanagementv1.ProviderInfo) - providerInfoModel.ID = core.StringPtr("testString") - providerInfoModel.Name = core.StringPtr("testString") + getOfferingAccessListOptionsModel := &catalogmanagementv1.GetOfferingAccessListOptions{ + CatalogIdentifier: core.StringPtr("testString"), + OfferingID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + } - // Construct an instance of the RepoInfo model - repoInfoModel := new(catalogmanagementv1.RepoInfo) - repoInfoModel.Token = core.StringPtr("testString") - repoInfoModel.Type = core.StringPtr("testString") + pager, err := catalogManagementService.NewGetOfferingAccessListPager(getOfferingAccessListOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) - // Construct an instance of the Support model - supportModel := new(catalogmanagementv1.Support) - supportModel.URL = core.StringPtr("testString") - supportModel.Process = core.StringPtr("testString") - supportModel.Locations = []string{"testString"} + allResults, err := pager.GetAll() + Expect(err).To(BeNil()) + Expect(allResults).ToNot(BeNil()) + Expect(len(allResults)).To(Equal(2)) + }) + }) + }) + Describe(`DeleteOfferingAccessList(deleteOfferingAccessListOptions *DeleteOfferingAccessListOptions) - Operation response error`, func() { + deleteOfferingAccessListPath := "/catalogs/testString/offerings/testString/access" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() - // Construct an instance of the MediaItem model - mediaItemModel := new(catalogmanagementv1.MediaItem) - mediaItemModel.URL = core.StringPtr("testString") - mediaItemModel.Caption = core.StringPtr("testString") - mediaItemModel.Type = core.StringPtr("testString") - mediaItemModel.ThumbnailURL = core.StringPtr("testString") + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(deleteOfferingAccessListPath)) + Expect(req.Method).To(Equal("DELETE")) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke DeleteOfferingAccessList with error: Operation response processing error`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the ReplaceOfferingOptions model - replaceOfferingOptionsModel := new(catalogmanagementv1.ReplaceOfferingOptions) - replaceOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") - replaceOfferingOptionsModel.OfferingID = core.StringPtr("testString") - replaceOfferingOptionsModel.ID = core.StringPtr("testString") - replaceOfferingOptionsModel.Rev = core.StringPtr("testString") - replaceOfferingOptionsModel.URL = core.StringPtr("testString") - replaceOfferingOptionsModel.CRN = core.StringPtr("testString") - replaceOfferingOptionsModel.Label = core.StringPtr("testString") - replaceOfferingOptionsModel.Name = core.StringPtr("testString") - replaceOfferingOptionsModel.OfferingIconURL = core.StringPtr("testString") - replaceOfferingOptionsModel.OfferingDocsURL = core.StringPtr("testString") - replaceOfferingOptionsModel.OfferingSupportURL = core.StringPtr("testString") - replaceOfferingOptionsModel.Tags = []string{"testString"} - replaceOfferingOptionsModel.Keywords = []string{"testString"} - replaceOfferingOptionsModel.Rating = ratingModel - replaceOfferingOptionsModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") - replaceOfferingOptionsModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - replaceOfferingOptionsModel.ShortDescription = core.StringPtr("testString") - replaceOfferingOptionsModel.LongDescription = core.StringPtr("testString") - replaceOfferingOptionsModel.Features = []catalogmanagementv1.Feature{*featureModel} - replaceOfferingOptionsModel.Kinds = []catalogmanagementv1.Kind{*kindModel} - replaceOfferingOptionsModel.PermitRequestIBMPublicPublish = core.BoolPtr(true) - replaceOfferingOptionsModel.IBMPublishApproved = core.BoolPtr(true) - replaceOfferingOptionsModel.PublicPublishApproved = core.BoolPtr(true) - replaceOfferingOptionsModel.PublicOriginalCRN = core.StringPtr("testString") - replaceOfferingOptionsModel.PublishPublicCRN = core.StringPtr("testString") - replaceOfferingOptionsModel.PortalApprovalRecord = core.StringPtr("testString") - replaceOfferingOptionsModel.PortalUIURL = core.StringPtr("testString") - replaceOfferingOptionsModel.CatalogID = core.StringPtr("testString") - replaceOfferingOptionsModel.CatalogName = core.StringPtr("testString") - replaceOfferingOptionsModel.Metadata = make(map[string]interface{}) - replaceOfferingOptionsModel.Disclaimer = core.StringPtr("testString") - replaceOfferingOptionsModel.Hidden = core.BoolPtr(true) - replaceOfferingOptionsModel.Provider = core.StringPtr("testString") - replaceOfferingOptionsModel.ProviderInfo = providerInfoModel - replaceOfferingOptionsModel.RepoInfo = repoInfoModel - replaceOfferingOptionsModel.Support = supportModel - replaceOfferingOptionsModel.Media = []catalogmanagementv1.MediaItem{*mediaItemModel} - replaceOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := catalogManagementService.SetServiceURL("") - Expect(err).To(BeNil()) - result, response, operationErr := catalogManagementService.ReplaceOffering(replaceOfferingOptionsModel) + // Construct an instance of the DeleteOfferingAccessListOptions model + deleteOfferingAccessListOptionsModel := new(catalogmanagementv1.DeleteOfferingAccessListOptions) + deleteOfferingAccessListOptionsModel.CatalogIdentifier = core.StringPtr("testString") + deleteOfferingAccessListOptionsModel.OfferingID = core.StringPtr("testString") + deleteOfferingAccessListOptionsModel.Accesses = []string{"testString"} + deleteOfferingAccessListOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := catalogManagementService.DeleteOfferingAccessList(deleteOfferingAccessListOptionsModel) Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - // Construct a second instance of the ReplaceOfferingOptions model with no property values - replaceOfferingOptionsModelNew := new(catalogmanagementv1.ReplaceOfferingOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = catalogManagementService.ReplaceOffering(replaceOfferingOptionsModelNew) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + catalogManagementService.EnableRetries(0, 0) + result, response, operationErr = catalogManagementService.DeleteOfferingAccessList(deleteOfferingAccessListOptionsModel) Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) + Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) - Context(`Using mock server endpoint with missing response body`, func() { + }) + Describe(`DeleteOfferingAccessList(deleteOfferingAccessListOptions *DeleteOfferingAccessListOptions)`, func() { + deleteOfferingAccessListPath := "/catalogs/testString/offerings/testString/access" + Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() - // Set success status code with no respoonse body + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(deleteOfferingAccessListPath)) + Expect(req.Method).To(Equal("DELETE")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"errors": {"mapKey": "Inner"}}`) })) }) - It(`Invoke ReplaceOffering successfully`, func() { + It(`Invoke DeleteOfferingAccessList successfully with retries`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) + catalogManagementService.EnableRetries(0, 0) - // Construct an instance of the Rating model - ratingModel := new(catalogmanagementv1.Rating) - ratingModel.OneStarCount = core.Int64Ptr(int64(38)) - ratingModel.TwoStarCount = core.Int64Ptr(int64(38)) - ratingModel.ThreeStarCount = core.Int64Ptr(int64(38)) - ratingModel.FourStarCount = core.Int64Ptr(int64(38)) - - // Construct an instance of the Feature model - featureModel := new(catalogmanagementv1.Feature) - featureModel.Title = core.StringPtr("testString") - featureModel.Description = core.StringPtr("testString") - - // Construct an instance of the Configuration model - configurationModel := new(catalogmanagementv1.Configuration) - configurationModel.Key = core.StringPtr("testString") - configurationModel.Type = core.StringPtr("testString") - configurationModel.DefaultValue = core.StringPtr("testString") - configurationModel.ValueConstraint = core.StringPtr("testString") - configurationModel.Description = core.StringPtr("testString") - configurationModel.Required = core.BoolPtr(true) - configurationModel.Options = []interface{}{"testString"} - configurationModel.Hidden = core.BoolPtr(true) - - // Construct an instance of the Validation model - validationModel := new(catalogmanagementv1.Validation) - validationModel.Validated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - validationModel.Requested = CreateMockDateTime("2019-01-01T12:00:00.000Z") - validationModel.State = core.StringPtr("testString") - validationModel.LastOperation = core.StringPtr("testString") - validationModel.Target = make(map[string]interface{}) + // Construct an instance of the DeleteOfferingAccessListOptions model + deleteOfferingAccessListOptionsModel := new(catalogmanagementv1.DeleteOfferingAccessListOptions) + deleteOfferingAccessListOptionsModel.CatalogIdentifier = core.StringPtr("testString") + deleteOfferingAccessListOptionsModel.OfferingID = core.StringPtr("testString") + deleteOfferingAccessListOptionsModel.Accesses = []string{"testString"} + deleteOfferingAccessListOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Construct an instance of the Resource model - resourceModel := new(catalogmanagementv1.Resource) - resourceModel.Type = core.StringPtr("mem") - resourceModel.Value = core.StringPtr("testString") + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := catalogManagementService.DeleteOfferingAccessListWithContext(ctx, deleteOfferingAccessListOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - // Construct an instance of the Script model - scriptModel := new(catalogmanagementv1.Script) - scriptModel.Instructions = core.StringPtr("testString") - scriptModel.Script = core.StringPtr("testString") - scriptModel.ScriptPermission = core.StringPtr("testString") - scriptModel.DeleteScript = core.StringPtr("testString") - scriptModel.Scope = core.StringPtr("testString") + // Disable retries and test again + catalogManagementService.DisableRetries() + result, response, operationErr := catalogManagementService.DeleteOfferingAccessList(deleteOfferingAccessListOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) - // Construct an instance of the VersionEntitlement model - versionEntitlementModel := new(catalogmanagementv1.VersionEntitlement) - versionEntitlementModel.ProviderName = core.StringPtr("testString") - versionEntitlementModel.ProviderID = core.StringPtr("testString") - versionEntitlementModel.ProductID = core.StringPtr("testString") - versionEntitlementModel.PartNumbers = []string{"testString"} - versionEntitlementModel.ImageRepoName = core.StringPtr("testString") + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = catalogManagementService.DeleteOfferingAccessListWithContext(ctx, deleteOfferingAccessListOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() - // Construct an instance of the License model - licenseModel := new(catalogmanagementv1.License) - licenseModel.ID = core.StringPtr("testString") - licenseModel.Name = core.StringPtr("testString") - licenseModel.Type = core.StringPtr("testString") - licenseModel.URL = core.StringPtr("testString") - licenseModel.Description = core.StringPtr("testString") + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(deleteOfferingAccessListPath)) + Expect(req.Method).To(Equal("DELETE")) - // Construct an instance of the State model - stateModel := new(catalogmanagementv1.State) - stateModel.Current = core.StringPtr("testString") - stateModel.CurrentEntered = CreateMockDateTime("2019-01-01T12:00:00.000Z") - stateModel.Pending = core.StringPtr("testString") - stateModel.PendingRequested = CreateMockDateTime("2019-01-01T12:00:00.000Z") - stateModel.Previous = core.StringPtr("testString") + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - // Construct an instance of the Version model - versionModel := new(catalogmanagementv1.Version) - versionModel.ID = core.StringPtr("testString") - versionModel.Rev = core.StringPtr("testString") - versionModel.CRN = core.StringPtr("testString") - versionModel.Version = core.StringPtr("testString") - versionModel.Sha = core.StringPtr("testString") - versionModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") - versionModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - versionModel.OfferingID = core.StringPtr("testString") - versionModel.CatalogID = core.StringPtr("testString") - versionModel.KindID = core.StringPtr("testString") - versionModel.Tags = []string{"testString"} - versionModel.RepoURL = core.StringPtr("testString") - versionModel.SourceURL = core.StringPtr("testString") - versionModel.TgzURL = core.StringPtr("testString") - versionModel.Configuration = []catalogmanagementv1.Configuration{*configurationModel} - versionModel.Metadata = make(map[string]interface{}) - versionModel.Validation = validationModel - versionModel.RequiredResources = []catalogmanagementv1.Resource{*resourceModel} - versionModel.SingleInstance = core.BoolPtr(true) - versionModel.Install = scriptModel - versionModel.PreInstall = []catalogmanagementv1.Script{*scriptModel} - versionModel.Entitlement = versionEntitlementModel - versionModel.Licenses = []catalogmanagementv1.License{*licenseModel} - versionModel.ImageManifestURL = core.StringPtr("testString") - versionModel.Deprecated = core.BoolPtr(true) - versionModel.PackageVersion = core.StringPtr("testString") - versionModel.State = stateModel - versionModel.VersionLocator = core.StringPtr("testString") - versionModel.ConsoleURL = core.StringPtr("testString") - versionModel.LongDescription = core.StringPtr("testString") - versionModel.WhitelistedAccounts = []string{"testString"} + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) - // Construct an instance of the Deployment model - deploymentModel := new(catalogmanagementv1.Deployment) - deploymentModel.ID = core.StringPtr("testString") - deploymentModel.Label = core.StringPtr("testString") - deploymentModel.Name = core.StringPtr("testString") - deploymentModel.ShortDescription = core.StringPtr("testString") - deploymentModel.LongDescription = core.StringPtr("testString") - deploymentModel.Metadata = make(map[string]interface{}) - deploymentModel.Tags = []string{"testString"} - deploymentModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") - deploymentModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"errors": {"mapKey": "Inner"}}`) + })) + }) + It(`Invoke DeleteOfferingAccessList successfully`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the Plan model - planModel := new(catalogmanagementv1.Plan) - planModel.ID = core.StringPtr("testString") - planModel.Label = core.StringPtr("testString") - planModel.Name = core.StringPtr("testString") - planModel.ShortDescription = core.StringPtr("testString") - planModel.LongDescription = core.StringPtr("testString") - planModel.Metadata = make(map[string]interface{}) - planModel.Tags = []string{"testString"} - planModel.AdditionalFeatures = []catalogmanagementv1.Feature{*featureModel} - planModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") - planModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - planModel.Deployments = []catalogmanagementv1.Deployment{*deploymentModel} + // Invoke operation with nil options model (negative test) + result, response, operationErr := catalogManagementService.DeleteOfferingAccessList(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) - // Construct an instance of the Kind model - kindModel := new(catalogmanagementv1.Kind) - kindModel.ID = core.StringPtr("testString") - kindModel.FormatKind = core.StringPtr("testString") - kindModel.TargetKind = core.StringPtr("testString") - kindModel.Metadata = make(map[string]interface{}) - kindModel.InstallDescription = core.StringPtr("testString") - kindModel.Tags = []string{"testString"} - kindModel.AdditionalFeatures = []catalogmanagementv1.Feature{*featureModel} - kindModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") - kindModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - kindModel.Versions = []catalogmanagementv1.Version{*versionModel} - kindModel.Plans = []catalogmanagementv1.Plan{*planModel} + // Construct an instance of the DeleteOfferingAccessListOptions model + deleteOfferingAccessListOptionsModel := new(catalogmanagementv1.DeleteOfferingAccessListOptions) + deleteOfferingAccessListOptionsModel.CatalogIdentifier = core.StringPtr("testString") + deleteOfferingAccessListOptionsModel.OfferingID = core.StringPtr("testString") + deleteOfferingAccessListOptionsModel.Accesses = []string{"testString"} + deleteOfferingAccessListOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Construct an instance of the ProviderInfo model - providerInfoModel := new(catalogmanagementv1.ProviderInfo) - providerInfoModel.ID = core.StringPtr("testString") - providerInfoModel.Name = core.StringPtr("testString") + // Invoke operation with valid options model (positive test) + result, response, operationErr = catalogManagementService.DeleteOfferingAccessList(deleteOfferingAccessListOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) - // Construct an instance of the RepoInfo model - repoInfoModel := new(catalogmanagementv1.RepoInfo) - repoInfoModel.Token = core.StringPtr("testString") - repoInfoModel.Type = core.StringPtr("testString") + }) + It(`Invoke DeleteOfferingAccessList with error: Operation validation and request error`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the Support model - supportModel := new(catalogmanagementv1.Support) - supportModel.URL = core.StringPtr("testString") - supportModel.Process = core.StringPtr("testString") - supportModel.Locations = []string{"testString"} + // Construct an instance of the DeleteOfferingAccessListOptions model + deleteOfferingAccessListOptionsModel := new(catalogmanagementv1.DeleteOfferingAccessListOptions) + deleteOfferingAccessListOptionsModel.CatalogIdentifier = core.StringPtr("testString") + deleteOfferingAccessListOptionsModel.OfferingID = core.StringPtr("testString") + deleteOfferingAccessListOptionsModel.Accesses = []string{"testString"} + deleteOfferingAccessListOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := catalogManagementService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := catalogManagementService.DeleteOfferingAccessList(deleteOfferingAccessListOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the DeleteOfferingAccessListOptions model with no property values + deleteOfferingAccessListOptionsModelNew := new(catalogmanagementv1.DeleteOfferingAccessListOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = catalogManagementService.DeleteOfferingAccessList(deleteOfferingAccessListOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() - // Construct an instance of the MediaItem model - mediaItemModel := new(catalogmanagementv1.MediaItem) - mediaItemModel.URL = core.StringPtr("testString") - mediaItemModel.Caption = core.StringPtr("testString") - mediaItemModel.Type = core.StringPtr("testString") - mediaItemModel.ThumbnailURL = core.StringPtr("testString") + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke DeleteOfferingAccessList successfully`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the ReplaceOfferingOptions model - replaceOfferingOptionsModel := new(catalogmanagementv1.ReplaceOfferingOptions) - replaceOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") - replaceOfferingOptionsModel.OfferingID = core.StringPtr("testString") - replaceOfferingOptionsModel.ID = core.StringPtr("testString") - replaceOfferingOptionsModel.Rev = core.StringPtr("testString") - replaceOfferingOptionsModel.URL = core.StringPtr("testString") - replaceOfferingOptionsModel.CRN = core.StringPtr("testString") - replaceOfferingOptionsModel.Label = core.StringPtr("testString") - replaceOfferingOptionsModel.Name = core.StringPtr("testString") - replaceOfferingOptionsModel.OfferingIconURL = core.StringPtr("testString") - replaceOfferingOptionsModel.OfferingDocsURL = core.StringPtr("testString") - replaceOfferingOptionsModel.OfferingSupportURL = core.StringPtr("testString") - replaceOfferingOptionsModel.Tags = []string{"testString"} - replaceOfferingOptionsModel.Keywords = []string{"testString"} - replaceOfferingOptionsModel.Rating = ratingModel - replaceOfferingOptionsModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") - replaceOfferingOptionsModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - replaceOfferingOptionsModel.ShortDescription = core.StringPtr("testString") - replaceOfferingOptionsModel.LongDescription = core.StringPtr("testString") - replaceOfferingOptionsModel.Features = []catalogmanagementv1.Feature{*featureModel} - replaceOfferingOptionsModel.Kinds = []catalogmanagementv1.Kind{*kindModel} - replaceOfferingOptionsModel.PermitRequestIBMPublicPublish = core.BoolPtr(true) - replaceOfferingOptionsModel.IBMPublishApproved = core.BoolPtr(true) - replaceOfferingOptionsModel.PublicPublishApproved = core.BoolPtr(true) - replaceOfferingOptionsModel.PublicOriginalCRN = core.StringPtr("testString") - replaceOfferingOptionsModel.PublishPublicCRN = core.StringPtr("testString") - replaceOfferingOptionsModel.PortalApprovalRecord = core.StringPtr("testString") - replaceOfferingOptionsModel.PortalUIURL = core.StringPtr("testString") - replaceOfferingOptionsModel.CatalogID = core.StringPtr("testString") - replaceOfferingOptionsModel.CatalogName = core.StringPtr("testString") - replaceOfferingOptionsModel.Metadata = make(map[string]interface{}) - replaceOfferingOptionsModel.Disclaimer = core.StringPtr("testString") - replaceOfferingOptionsModel.Hidden = core.BoolPtr(true) - replaceOfferingOptionsModel.Provider = core.StringPtr("testString") - replaceOfferingOptionsModel.ProviderInfo = providerInfoModel - replaceOfferingOptionsModel.RepoInfo = repoInfoModel - replaceOfferingOptionsModel.Support = supportModel - replaceOfferingOptionsModel.Media = []catalogmanagementv1.MediaItem{*mediaItemModel} - replaceOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteOfferingAccessListOptions model + deleteOfferingAccessListOptionsModel := new(catalogmanagementv1.DeleteOfferingAccessListOptions) + deleteOfferingAccessListOptionsModel.CatalogIdentifier = core.StringPtr("testString") + deleteOfferingAccessListOptionsModel.OfferingID = core.StringPtr("testString") + deleteOfferingAccessListOptionsModel.Accesses = []string{"testString"} + deleteOfferingAccessListOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := catalogManagementService.ReplaceOffering(replaceOfferingOptionsModel) + result, response, operationErr := catalogManagementService.DeleteOfferingAccessList(deleteOfferingAccessListOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -6870,24 +13480,22 @@ var _ = Describe(`CatalogManagementV1`, func() { }) }) }) - Describe(`UpdateOffering(updateOfferingOptions *UpdateOfferingOptions) - Operation response error`, func() { - updateOfferingPath := "/catalogs/testString/offerings/testString" + Describe(`AddOfferingAccessList(addOfferingAccessListOptions *AddOfferingAccessListOptions) - Operation response error`, func() { + addOfferingAccessListPath := "/catalogs/testString/offerings/testString/access" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateOfferingPath)) - Expect(req.Method).To(Equal("PATCH")) - Expect(req.Header["If-Match"]).ToNot(BeNil()) - Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.EscapedPath()).To(Equal(addOfferingAccessListPath)) + Expect(req.Method).To(Equal("POST")) res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, `} this is not valid json {`) + res.WriteHeader(201) + fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke UpdateOffering with error: Operation response processing error`, func() { + It(`Invoke AddOfferingAccessList with error: Operation response processing error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -6895,29 +13503,21 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the JSONPatchOperation model - jsonPatchOperationModel := new(catalogmanagementv1.JSONPatchOperation) - jsonPatchOperationModel.Op = core.StringPtr("add") - jsonPatchOperationModel.Path = core.StringPtr("testString") - jsonPatchOperationModel.From = core.StringPtr("testString") - jsonPatchOperationModel.Value = core.StringPtr("testString") - - // Construct an instance of the UpdateOfferingOptions model - updateOfferingOptionsModel := new(catalogmanagementv1.UpdateOfferingOptions) - updateOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") - updateOfferingOptionsModel.OfferingID = core.StringPtr("testString") - updateOfferingOptionsModel.IfMatch = core.StringPtr("testString") - updateOfferingOptionsModel.Updates = []catalogmanagementv1.JSONPatchOperation{*jsonPatchOperationModel} - updateOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the AddOfferingAccessListOptions model + addOfferingAccessListOptionsModel := new(catalogmanagementv1.AddOfferingAccessListOptions) + addOfferingAccessListOptionsModel.CatalogIdentifier = core.StringPtr("testString") + addOfferingAccessListOptionsModel.OfferingID = core.StringPtr("testString") + addOfferingAccessListOptionsModel.Accesses = []string{"testString"} + addOfferingAccessListOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := catalogManagementService.UpdateOffering(updateOfferingOptionsModel) + result, response, operationErr := catalogManagementService.AddOfferingAccessList(addOfferingAccessListOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again catalogManagementService.EnableRetries(0, 0) - result, response, operationErr = catalogManagementService.UpdateOffering(updateOfferingOptionsModel) + result, response, operationErr = catalogManagementService.AddOfferingAccessList(addOfferingAccessListOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -6927,16 +13527,16 @@ var _ = Describe(`CatalogManagementV1`, func() { }) }) }) - Describe(`UpdateOffering(updateOfferingOptions *UpdateOfferingOptions)`, func() { - updateOfferingPath := "/catalogs/testString/offerings/testString" + Describe(`AddOfferingAccessList(addOfferingAccessListOptions *AddOfferingAccessListOptions)`, func() { + addOfferingAccessListPath := "/catalogs/testString/offerings/testString/access" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateOfferingPath)) - Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.EscapedPath()).To(Equal(addOfferingAccessListPath)) + Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) @@ -6954,18 +13554,16 @@ var _ = Describe(`CatalogManagementV1`, func() { } fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) - Expect(req.Header["If-Match"]).ToNot(BeNil()) - Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "url": "URL", "crn": "CRN", "label": "Label", "name": "Name", "offering_icon_url": "OfferingIconURL", "offering_docs_url": "OfferingDocsURL", "offering_support_url": "OfferingSupportURL", "tags": ["Tags"], "keywords": ["Keywords"], "rating": {"one_star_count": 12, "two_star_count": 12, "three_star_count": 14, "four_star_count": 13}, "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "short_description": "ShortDescription", "long_description": "LongDescription", "features": [{"title": "Title", "description": "Description"}], "kinds": [{"id": "ID", "format_kind": "FormatKind", "target_kind": "TargetKind", "metadata": {"mapKey": "anyValue"}, "install_description": "InstallDescription", "tags": ["Tags"], "additional_features": [{"title": "Title", "description": "Description"}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "versions": [{"id": "ID", "_rev": "Rev", "crn": "CRN", "version": "Version", "sha": "Sha", "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "offering_id": "OfferingID", "catalog_id": "CatalogID", "kind_id": "KindID", "tags": ["Tags"], "repo_url": "RepoURL", "source_url": "SourceURL", "tgz_url": "TgzURL", "configuration": [{"key": "Key", "type": "Type", "default_value": "anyValue", "value_constraint": "ValueConstraint", "description": "Description", "required": true, "options": ["anyValue"], "hidden": true}], "metadata": {"mapKey": "anyValue"}, "validation": {"validated": "2019-01-01T12:00:00.000Z", "requested": "2019-01-01T12:00:00.000Z", "state": "State", "last_operation": "LastOperation", "target": {"mapKey": "anyValue"}}, "required_resources": [{"type": "mem", "value": "anyValue"}], "single_instance": true, "install": {"instructions": "Instructions", "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}, "pre_install": [{"instructions": "Instructions", "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}], "entitlement": {"provider_name": "ProviderName", "provider_id": "ProviderID", "product_id": "ProductID", "part_numbers": ["PartNumbers"], "image_repo_name": "ImageRepoName"}, "licenses": [{"id": "ID", "name": "Name", "type": "Type", "url": "URL", "description": "Description"}], "image_manifest_url": "ImageManifestURL", "deprecated": true, "package_version": "PackageVersion", "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "version_locator": "VersionLocator", "console_url": "ConsoleURL", "long_description": "LongDescription", "whitelisted_accounts": ["WhitelistedAccounts"]}], "plans": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "additional_features": [{"title": "Title", "description": "Description"}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "deployments": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z"}]}]}], "permit_request_ibm_public_publish": false, "ibm_publish_approved": true, "public_publish_approved": false, "public_original_crn": "PublicOriginalCRN", "publish_public_crn": "PublishPublicCRN", "portal_approval_record": "PortalApprovalRecord", "portal_ui_url": "PortalUIURL", "catalog_id": "CatalogID", "catalog_name": "CatalogName", "metadata": {"mapKey": "anyValue"}, "disclaimer": "Disclaimer", "hidden": true, "provider": "Provider", "provider_info": {"id": "ID", "name": "Name"}, "repo_info": {"token": "Token", "type": "Type"}, "support": {"url": "URL", "process": "Process", "locations": ["Locations"]}, "media": [{"url": "URL", "caption": "Caption", "type": "Type", "thumbnail_url": "ThumbnailURL"}]}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"start": "Start", "limit": 5, "total_count": 10, "resource_count": 13, "first": {"href": "Href", "start": "Start"}, "next": {"href": "Href", "start": "Start"}, "prev": {"href": "Href", "start": "Start"}, "last": {"href": "Href", "start": "Start"}, "resources": [{"id": "ID", "account": "Account", "account_type": 11, "catalog_id": "CatalogID", "target_id": "TargetID", "target_account": "TargetAccount", "target_kind": "TargetKind", "private_accessible": false, "created": "2019-01-01T12:00:00.000Z"}]}`) })) }) - It(`Invoke UpdateOffering successfully with retries`, func() { + It(`Invoke AddOfferingAccessList successfully with retries`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -6974,31 +13572,23 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) catalogManagementService.EnableRetries(0, 0) - // Construct an instance of the JSONPatchOperation model - jsonPatchOperationModel := new(catalogmanagementv1.JSONPatchOperation) - jsonPatchOperationModel.Op = core.StringPtr("add") - jsonPatchOperationModel.Path = core.StringPtr("testString") - jsonPatchOperationModel.From = core.StringPtr("testString") - jsonPatchOperationModel.Value = core.StringPtr("testString") - - // Construct an instance of the UpdateOfferingOptions model - updateOfferingOptionsModel := new(catalogmanagementv1.UpdateOfferingOptions) - updateOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") - updateOfferingOptionsModel.OfferingID = core.StringPtr("testString") - updateOfferingOptionsModel.IfMatch = core.StringPtr("testString") - updateOfferingOptionsModel.Updates = []catalogmanagementv1.JSONPatchOperation{*jsonPatchOperationModel} - updateOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the AddOfferingAccessListOptions model + addOfferingAccessListOptionsModel := new(catalogmanagementv1.AddOfferingAccessListOptions) + addOfferingAccessListOptionsModel.CatalogIdentifier = core.StringPtr("testString") + addOfferingAccessListOptionsModel.OfferingID = core.StringPtr("testString") + addOfferingAccessListOptionsModel.Accesses = []string{"testString"} + addOfferingAccessListOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := catalogManagementService.UpdateOfferingWithContext(ctx, updateOfferingOptionsModel) + _, _, operationErr := catalogManagementService.AddOfferingAccessListWithContext(ctx, addOfferingAccessListOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again catalogManagementService.DisableRetries() - result, response, operationErr := catalogManagementService.UpdateOffering(updateOfferingOptionsModel) + result, response, operationErr := catalogManagementService.AddOfferingAccessList(addOfferingAccessListOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -7006,7 +13596,7 @@ var _ = Describe(`CatalogManagementV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = catalogManagementService.UpdateOfferingWithContext(ctx, updateOfferingOptionsModel) + _, _, operationErr = catalogManagementService.AddOfferingAccessListWithContext(ctx, addOfferingAccessListOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -7020,8 +13610,8 @@ var _ = Describe(`CatalogManagementV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateOfferingPath)) - Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.EscapedPath()).To(Equal(addOfferingAccessListPath)) + Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) @@ -7039,15 +13629,13 @@ var _ = Describe(`CatalogManagementV1`, func() { } fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) - Expect(req.Header["If-Match"]).ToNot(BeNil()) - Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "url": "URL", "crn": "CRN", "label": "Label", "name": "Name", "offering_icon_url": "OfferingIconURL", "offering_docs_url": "OfferingDocsURL", "offering_support_url": "OfferingSupportURL", "tags": ["Tags"], "keywords": ["Keywords"], "rating": {"one_star_count": 12, "two_star_count": 12, "three_star_count": 14, "four_star_count": 13}, "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "short_description": "ShortDescription", "long_description": "LongDescription", "features": [{"title": "Title", "description": "Description"}], "kinds": [{"id": "ID", "format_kind": "FormatKind", "target_kind": "TargetKind", "metadata": {"mapKey": "anyValue"}, "install_description": "InstallDescription", "tags": ["Tags"], "additional_features": [{"title": "Title", "description": "Description"}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "versions": [{"id": "ID", "_rev": "Rev", "crn": "CRN", "version": "Version", "sha": "Sha", "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "offering_id": "OfferingID", "catalog_id": "CatalogID", "kind_id": "KindID", "tags": ["Tags"], "repo_url": "RepoURL", "source_url": "SourceURL", "tgz_url": "TgzURL", "configuration": [{"key": "Key", "type": "Type", "default_value": "anyValue", "value_constraint": "ValueConstraint", "description": "Description", "required": true, "options": ["anyValue"], "hidden": true}], "metadata": {"mapKey": "anyValue"}, "validation": {"validated": "2019-01-01T12:00:00.000Z", "requested": "2019-01-01T12:00:00.000Z", "state": "State", "last_operation": "LastOperation", "target": {"mapKey": "anyValue"}}, "required_resources": [{"type": "mem", "value": "anyValue"}], "single_instance": true, "install": {"instructions": "Instructions", "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}, "pre_install": [{"instructions": "Instructions", "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}], "entitlement": {"provider_name": "ProviderName", "provider_id": "ProviderID", "product_id": "ProductID", "part_numbers": ["PartNumbers"], "image_repo_name": "ImageRepoName"}, "licenses": [{"id": "ID", "name": "Name", "type": "Type", "url": "URL", "description": "Description"}], "image_manifest_url": "ImageManifestURL", "deprecated": true, "package_version": "PackageVersion", "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "version_locator": "VersionLocator", "console_url": "ConsoleURL", "long_description": "LongDescription", "whitelisted_accounts": ["WhitelistedAccounts"]}], "plans": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "additional_features": [{"title": "Title", "description": "Description"}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "deployments": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z"}]}]}], "permit_request_ibm_public_publish": false, "ibm_publish_approved": true, "public_publish_approved": false, "public_original_crn": "PublicOriginalCRN", "publish_public_crn": "PublishPublicCRN", "portal_approval_record": "PortalApprovalRecord", "portal_ui_url": "PortalUIURL", "catalog_id": "CatalogID", "catalog_name": "CatalogName", "metadata": {"mapKey": "anyValue"}, "disclaimer": "Disclaimer", "hidden": true, "provider": "Provider", "provider_info": {"id": "ID", "name": "Name"}, "repo_info": {"token": "Token", "type": "Type"}, "support": {"url": "URL", "process": "Process", "locations": ["Locations"]}, "media": [{"url": "URL", "caption": "Caption", "type": "Type", "thumbnail_url": "ThumbnailURL"}]}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"start": "Start", "limit": 5, "total_count": 10, "resource_count": 13, "first": {"href": "Href", "start": "Start"}, "next": {"href": "Href", "start": "Start"}, "prev": {"href": "Href", "start": "Start"}, "last": {"href": "Href", "start": "Start"}, "resources": [{"id": "ID", "account": "Account", "account_type": 11, "catalog_id": "CatalogID", "target_id": "TargetID", "target_account": "TargetAccount", "target_kind": "TargetKind", "private_accessible": false, "created": "2019-01-01T12:00:00.000Z"}]}`) })) }) - It(`Invoke UpdateOffering successfully`, func() { + It(`Invoke AddOfferingAccessList successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -7056,34 +13644,26 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := catalogManagementService.UpdateOffering(nil) + result, response, operationErr := catalogManagementService.AddOfferingAccessList(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the JSONPatchOperation model - jsonPatchOperationModel := new(catalogmanagementv1.JSONPatchOperation) - jsonPatchOperationModel.Op = core.StringPtr("add") - jsonPatchOperationModel.Path = core.StringPtr("testString") - jsonPatchOperationModel.From = core.StringPtr("testString") - jsonPatchOperationModel.Value = core.StringPtr("testString") - - // Construct an instance of the UpdateOfferingOptions model - updateOfferingOptionsModel := new(catalogmanagementv1.UpdateOfferingOptions) - updateOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") - updateOfferingOptionsModel.OfferingID = core.StringPtr("testString") - updateOfferingOptionsModel.IfMatch = core.StringPtr("testString") - updateOfferingOptionsModel.Updates = []catalogmanagementv1.JSONPatchOperation{*jsonPatchOperationModel} - updateOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the AddOfferingAccessListOptions model + addOfferingAccessListOptionsModel := new(catalogmanagementv1.AddOfferingAccessListOptions) + addOfferingAccessListOptionsModel.CatalogIdentifier = core.StringPtr("testString") + addOfferingAccessListOptionsModel.OfferingID = core.StringPtr("testString") + addOfferingAccessListOptionsModel.Accesses = []string{"testString"} + addOfferingAccessListOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = catalogManagementService.UpdateOffering(updateOfferingOptionsModel) + result, response, operationErr = catalogManagementService.AddOfferingAccessList(addOfferingAccessListOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdateOffering with error: Operation validation and request error`, func() { + It(`Invoke AddOfferingAccessList with error: Operation validation and request error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -7091,32 +13671,24 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the JSONPatchOperation model - jsonPatchOperationModel := new(catalogmanagementv1.JSONPatchOperation) - jsonPatchOperationModel.Op = core.StringPtr("add") - jsonPatchOperationModel.Path = core.StringPtr("testString") - jsonPatchOperationModel.From = core.StringPtr("testString") - jsonPatchOperationModel.Value = core.StringPtr("testString") - - // Construct an instance of the UpdateOfferingOptions model - updateOfferingOptionsModel := new(catalogmanagementv1.UpdateOfferingOptions) - updateOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") - updateOfferingOptionsModel.OfferingID = core.StringPtr("testString") - updateOfferingOptionsModel.IfMatch = core.StringPtr("testString") - updateOfferingOptionsModel.Updates = []catalogmanagementv1.JSONPatchOperation{*jsonPatchOperationModel} - updateOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the AddOfferingAccessListOptions model + addOfferingAccessListOptionsModel := new(catalogmanagementv1.AddOfferingAccessListOptions) + addOfferingAccessListOptionsModel.CatalogIdentifier = core.StringPtr("testString") + addOfferingAccessListOptionsModel.OfferingID = core.StringPtr("testString") + addOfferingAccessListOptionsModel.Accesses = []string{"testString"} + addOfferingAccessListOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := catalogManagementService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := catalogManagementService.UpdateOffering(updateOfferingOptionsModel) + result, response, operationErr := catalogManagementService.AddOfferingAccessList(addOfferingAccessListOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the UpdateOfferingOptions model with no property values - updateOfferingOptionsModelNew := new(catalogmanagementv1.UpdateOfferingOptions) + // Construct a second instance of the AddOfferingAccessListOptions model with no property values + addOfferingAccessListOptionsModelNew := new(catalogmanagementv1.AddOfferingAccessListOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = catalogManagementService.UpdateOffering(updateOfferingOptionsModelNew) + result, response, operationErr = catalogManagementService.AddOfferingAccessList(addOfferingAccessListOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -7131,10 +13703,10 @@ var _ = Describe(`CatalogManagementV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(201) })) }) - It(`Invoke UpdateOffering successfully`, func() { + It(`Invoke AddOfferingAccessList successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -7142,23 +13714,15 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the JSONPatchOperation model - jsonPatchOperationModel := new(catalogmanagementv1.JSONPatchOperation) - jsonPatchOperationModel.Op = core.StringPtr("add") - jsonPatchOperationModel.Path = core.StringPtr("testString") - jsonPatchOperationModel.From = core.StringPtr("testString") - jsonPatchOperationModel.Value = core.StringPtr("testString") - - // Construct an instance of the UpdateOfferingOptions model - updateOfferingOptionsModel := new(catalogmanagementv1.UpdateOfferingOptions) - updateOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") - updateOfferingOptionsModel.OfferingID = core.StringPtr("testString") - updateOfferingOptionsModel.IfMatch = core.StringPtr("testString") - updateOfferingOptionsModel.Updates = []catalogmanagementv1.JSONPatchOperation{*jsonPatchOperationModel} - updateOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the AddOfferingAccessListOptions model + addOfferingAccessListOptionsModel := new(catalogmanagementv1.AddOfferingAccessListOptions) + addOfferingAccessListOptionsModel.CatalogIdentifier = core.StringPtr("testString") + addOfferingAccessListOptionsModel.OfferingID = core.StringPtr("testString") + addOfferingAccessListOptionsModel.Accesses = []string{"testString"} + addOfferingAccessListOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := catalogManagementService.UpdateOffering(updateOfferingOptionsModel) + result, response, operationErr := catalogManagementService.AddOfferingAccessList(addOfferingAccessListOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -7170,92 +13734,34 @@ var _ = Describe(`CatalogManagementV1`, func() { }) }) }) - Describe(`DeleteOffering(deleteOfferingOptions *DeleteOfferingOptions)`, func() { - deleteOfferingPath := "/catalogs/testString/offerings/testString" - Context(`Using mock server endpoint`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteOfferingPath)) - Expect(req.Method).To(Equal("DELETE")) - - res.WriteHeader(200) - })) - }) - It(`Invoke DeleteOffering successfully`, func() { - catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(catalogManagementService).ToNot(BeNil()) - - // Invoke operation with nil options model (negative test) - response, operationErr := catalogManagementService.DeleteOffering(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteOfferingOptions model - deleteOfferingOptionsModel := new(catalogmanagementv1.DeleteOfferingOptions) - deleteOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") - deleteOfferingOptionsModel.OfferingID = core.StringPtr("testString") - deleteOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = catalogManagementService.DeleteOffering(deleteOfferingOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteOffering with error: Operation validation and request error`, func() { - catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(catalogManagementService).ToNot(BeNil()) - - // Construct an instance of the DeleteOfferingOptions model - deleteOfferingOptionsModel := new(catalogmanagementv1.DeleteOfferingOptions) - deleteOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") - deleteOfferingOptionsModel.OfferingID = core.StringPtr("testString") - deleteOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := catalogManagementService.SetServiceURL("") - Expect(err).To(BeNil()) - response, operationErr := catalogManagementService.DeleteOffering(deleteOfferingOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteOfferingOptions model with no property values - deleteOfferingOptionsModelNew := new(catalogmanagementv1.DeleteOfferingOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = catalogManagementService.DeleteOffering(deleteOfferingOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetOfferingAudit(getOfferingAuditOptions *GetOfferingAuditOptions) - Operation response error`, func() { - getOfferingAuditPath := "/catalogs/testString/offerings/testString/audit" + Describe(`GetOfferingUpdates(getOfferingUpdatesOptions *GetOfferingUpdatesOptions) - Operation response error`, func() { + getOfferingUpdatesPath := "/catalogs/testString/offerings/testString/updates" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getOfferingAuditPath)) + Expect(req.URL.EscapedPath()).To(Equal(getOfferingUpdatesPath)) Expect(req.Method).To(Equal("GET")) + Expect(req.Header["X-Auth-Refresh-Token"]).ToNot(BeNil()) + Expect(req.Header["X-Auth-Refresh-Token"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["kind"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["target"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["cluster_id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["region"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["resource_group_id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["namespace"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["sha"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["channel"]).To(Equal([]string{"testString"})) + // TODO: Add check for all_namespaces query parameter res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, `} this is not valid json {`) + fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetOfferingAudit with error: Operation response processing error`, func() { + It(`Invoke GetOfferingUpdates with error: Operation response processing error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -7263,20 +13769,32 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the GetOfferingAuditOptions model - getOfferingAuditOptionsModel := new(catalogmanagementv1.GetOfferingAuditOptions) - getOfferingAuditOptionsModel.CatalogIdentifier = core.StringPtr("testString") - getOfferingAuditOptionsModel.OfferingID = core.StringPtr("testString") - getOfferingAuditOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetOfferingUpdatesOptions model + getOfferingUpdatesOptionsModel := new(catalogmanagementv1.GetOfferingUpdatesOptions) + getOfferingUpdatesOptionsModel.CatalogIdentifier = core.StringPtr("testString") + getOfferingUpdatesOptionsModel.OfferingID = core.StringPtr("testString") + getOfferingUpdatesOptionsModel.Kind = core.StringPtr("testString") + getOfferingUpdatesOptionsModel.XAuthRefreshToken = core.StringPtr("testString") + getOfferingUpdatesOptionsModel.Target = core.StringPtr("testString") + getOfferingUpdatesOptionsModel.Version = core.StringPtr("testString") + getOfferingUpdatesOptionsModel.ClusterID = core.StringPtr("testString") + getOfferingUpdatesOptionsModel.Region = core.StringPtr("testString") + getOfferingUpdatesOptionsModel.ResourceGroupID = core.StringPtr("testString") + getOfferingUpdatesOptionsModel.Namespace = core.StringPtr("testString") + getOfferingUpdatesOptionsModel.Sha = core.StringPtr("testString") + getOfferingUpdatesOptionsModel.Channel = core.StringPtr("testString") + getOfferingUpdatesOptionsModel.Namespaces = []string{"testString"} + getOfferingUpdatesOptionsModel.AllNamespaces = core.BoolPtr(true) + getOfferingUpdatesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := catalogManagementService.GetOfferingAudit(getOfferingAuditOptionsModel) + result, response, operationErr := catalogManagementService.GetOfferingUpdates(getOfferingUpdatesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again catalogManagementService.EnableRetries(0, 0) - result, response, operationErr = catalogManagementService.GetOfferingAudit(getOfferingAuditOptionsModel) + result, response, operationErr = catalogManagementService.GetOfferingUpdates(getOfferingUpdatesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -7286,27 +13804,39 @@ var _ = Describe(`CatalogManagementV1`, func() { }) }) }) - Describe(`GetOfferingAudit(getOfferingAuditOptions *GetOfferingAuditOptions)`, func() { - getOfferingAuditPath := "/catalogs/testString/offerings/testString/audit" + Describe(`GetOfferingUpdates(getOfferingUpdatesOptions *GetOfferingUpdatesOptions)`, func() { + getOfferingUpdatesPath := "/catalogs/testString/offerings/testString/updates" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getOfferingAuditPath)) + Expect(req.URL.EscapedPath()).To(Equal(getOfferingUpdatesPath)) Expect(req.Method).To(Equal("GET")) + Expect(req.Header["X-Auth-Refresh-Token"]).ToNot(BeNil()) + Expect(req.Header["X-Auth-Refresh-Token"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["kind"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["target"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["cluster_id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["region"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["resource_group_id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["namespace"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["sha"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["channel"]).To(Equal([]string{"testString"})) + // TODO: Add check for all_namespaces query parameter // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"list": [{"id": "ID", "created": "2019-01-01T12:00:00.000Z", "change_type": "ChangeType", "target_type": "TargetType", "target_id": "TargetID", "who_delegate_email": "WhoDelegateEmail", "message": "Message"}]}`) + fmt.Fprintf(res, "%s", `[{"version_locator": "VersionLocator", "version": "Version", "flavor": {"name": "Name", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "index": 5}, "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "required_resources": [{"type": "mem", "value": "anyValue"}], "package_version": "PackageVersion", "sha": "Sha", "can_update": false, "messages": {"mapKey": "Inner"}}]`) })) }) - It(`Invoke GetOfferingAudit successfully with retries`, func() { + It(`Invoke GetOfferingUpdates successfully with retries`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -7315,22 +13845,34 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) catalogManagementService.EnableRetries(0, 0) - // Construct an instance of the GetOfferingAuditOptions model - getOfferingAuditOptionsModel := new(catalogmanagementv1.GetOfferingAuditOptions) - getOfferingAuditOptionsModel.CatalogIdentifier = core.StringPtr("testString") - getOfferingAuditOptionsModel.OfferingID = core.StringPtr("testString") - getOfferingAuditOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetOfferingUpdatesOptions model + getOfferingUpdatesOptionsModel := new(catalogmanagementv1.GetOfferingUpdatesOptions) + getOfferingUpdatesOptionsModel.CatalogIdentifier = core.StringPtr("testString") + getOfferingUpdatesOptionsModel.OfferingID = core.StringPtr("testString") + getOfferingUpdatesOptionsModel.Kind = core.StringPtr("testString") + getOfferingUpdatesOptionsModel.XAuthRefreshToken = core.StringPtr("testString") + getOfferingUpdatesOptionsModel.Target = core.StringPtr("testString") + getOfferingUpdatesOptionsModel.Version = core.StringPtr("testString") + getOfferingUpdatesOptionsModel.ClusterID = core.StringPtr("testString") + getOfferingUpdatesOptionsModel.Region = core.StringPtr("testString") + getOfferingUpdatesOptionsModel.ResourceGroupID = core.StringPtr("testString") + getOfferingUpdatesOptionsModel.Namespace = core.StringPtr("testString") + getOfferingUpdatesOptionsModel.Sha = core.StringPtr("testString") + getOfferingUpdatesOptionsModel.Channel = core.StringPtr("testString") + getOfferingUpdatesOptionsModel.Namespaces = []string{"testString"} + getOfferingUpdatesOptionsModel.AllNamespaces = core.BoolPtr(true) + getOfferingUpdatesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := catalogManagementService.GetOfferingAuditWithContext(ctx, getOfferingAuditOptionsModel) + _, _, operationErr := catalogManagementService.GetOfferingUpdatesWithContext(ctx, getOfferingUpdatesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again catalogManagementService.DisableRetries() - result, response, operationErr := catalogManagementService.GetOfferingAudit(getOfferingAuditOptionsModel) + result, response, operationErr := catalogManagementService.GetOfferingUpdates(getOfferingUpdatesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -7338,7 +13880,7 @@ var _ = Describe(`CatalogManagementV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = catalogManagementService.GetOfferingAuditWithContext(ctx, getOfferingAuditOptionsModel) + _, _, operationErr = catalogManagementService.GetOfferingUpdatesWithContext(ctx, getOfferingUpdatesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -7352,16 +13894,28 @@ var _ = Describe(`CatalogManagementV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getOfferingAuditPath)) + Expect(req.URL.EscapedPath()).To(Equal(getOfferingUpdatesPath)) Expect(req.Method).To(Equal("GET")) + Expect(req.Header["X-Auth-Refresh-Token"]).ToNot(BeNil()) + Expect(req.Header["X-Auth-Refresh-Token"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["kind"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["target"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["cluster_id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["region"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["resource_group_id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["namespace"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["sha"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["channel"]).To(Equal([]string{"testString"})) + // TODO: Add check for all_namespaces query parameter // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"list": [{"id": "ID", "created": "2019-01-01T12:00:00.000Z", "change_type": "ChangeType", "target_type": "TargetType", "target_id": "TargetID", "who_delegate_email": "WhoDelegateEmail", "message": "Message"}]}`) + fmt.Fprintf(res, "%s", `[{"version_locator": "VersionLocator", "version": "Version", "flavor": {"name": "Name", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "index": 5}, "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "required_resources": [{"type": "mem", "value": "anyValue"}], "package_version": "PackageVersion", "sha": "Sha", "can_update": false, "messages": {"mapKey": "Inner"}}]`) })) }) - It(`Invoke GetOfferingAudit successfully`, func() { + It(`Invoke GetOfferingUpdates successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -7370,25 +13924,37 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := catalogManagementService.GetOfferingAudit(nil) + result, response, operationErr := catalogManagementService.GetOfferingUpdates(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetOfferingAuditOptions model - getOfferingAuditOptionsModel := new(catalogmanagementv1.GetOfferingAuditOptions) - getOfferingAuditOptionsModel.CatalogIdentifier = core.StringPtr("testString") - getOfferingAuditOptionsModel.OfferingID = core.StringPtr("testString") - getOfferingAuditOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetOfferingUpdatesOptions model + getOfferingUpdatesOptionsModel := new(catalogmanagementv1.GetOfferingUpdatesOptions) + getOfferingUpdatesOptionsModel.CatalogIdentifier = core.StringPtr("testString") + getOfferingUpdatesOptionsModel.OfferingID = core.StringPtr("testString") + getOfferingUpdatesOptionsModel.Kind = core.StringPtr("testString") + getOfferingUpdatesOptionsModel.XAuthRefreshToken = core.StringPtr("testString") + getOfferingUpdatesOptionsModel.Target = core.StringPtr("testString") + getOfferingUpdatesOptionsModel.Version = core.StringPtr("testString") + getOfferingUpdatesOptionsModel.ClusterID = core.StringPtr("testString") + getOfferingUpdatesOptionsModel.Region = core.StringPtr("testString") + getOfferingUpdatesOptionsModel.ResourceGroupID = core.StringPtr("testString") + getOfferingUpdatesOptionsModel.Namespace = core.StringPtr("testString") + getOfferingUpdatesOptionsModel.Sha = core.StringPtr("testString") + getOfferingUpdatesOptionsModel.Channel = core.StringPtr("testString") + getOfferingUpdatesOptionsModel.Namespaces = []string{"testString"} + getOfferingUpdatesOptionsModel.AllNamespaces = core.BoolPtr(true) + getOfferingUpdatesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = catalogManagementService.GetOfferingAudit(getOfferingAuditOptionsModel) + result, response, operationErr = catalogManagementService.GetOfferingUpdates(getOfferingUpdatesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetOfferingAudit with error: Operation validation and request error`, func() { + It(`Invoke GetOfferingUpdates with error: Operation validation and request error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -7396,23 +13962,35 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the GetOfferingAuditOptions model - getOfferingAuditOptionsModel := new(catalogmanagementv1.GetOfferingAuditOptions) - getOfferingAuditOptionsModel.CatalogIdentifier = core.StringPtr("testString") - getOfferingAuditOptionsModel.OfferingID = core.StringPtr("testString") - getOfferingAuditOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetOfferingUpdatesOptions model + getOfferingUpdatesOptionsModel := new(catalogmanagementv1.GetOfferingUpdatesOptions) + getOfferingUpdatesOptionsModel.CatalogIdentifier = core.StringPtr("testString") + getOfferingUpdatesOptionsModel.OfferingID = core.StringPtr("testString") + getOfferingUpdatesOptionsModel.Kind = core.StringPtr("testString") + getOfferingUpdatesOptionsModel.XAuthRefreshToken = core.StringPtr("testString") + getOfferingUpdatesOptionsModel.Target = core.StringPtr("testString") + getOfferingUpdatesOptionsModel.Version = core.StringPtr("testString") + getOfferingUpdatesOptionsModel.ClusterID = core.StringPtr("testString") + getOfferingUpdatesOptionsModel.Region = core.StringPtr("testString") + getOfferingUpdatesOptionsModel.ResourceGroupID = core.StringPtr("testString") + getOfferingUpdatesOptionsModel.Namespace = core.StringPtr("testString") + getOfferingUpdatesOptionsModel.Sha = core.StringPtr("testString") + getOfferingUpdatesOptionsModel.Channel = core.StringPtr("testString") + getOfferingUpdatesOptionsModel.Namespaces = []string{"testString"} + getOfferingUpdatesOptionsModel.AllNamespaces = core.BoolPtr(true) + getOfferingUpdatesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := catalogManagementService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := catalogManagementService.GetOfferingAudit(getOfferingAuditOptionsModel) + result, response, operationErr := catalogManagementService.GetOfferingUpdates(getOfferingUpdatesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetOfferingAuditOptions model with no property values - getOfferingAuditOptionsModelNew := new(catalogmanagementv1.GetOfferingAuditOptions) + // Construct a second instance of the GetOfferingUpdatesOptions model with no property values + getOfferingUpdatesOptionsModelNew := new(catalogmanagementv1.GetOfferingUpdatesOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = catalogManagementService.GetOfferingAudit(getOfferingAuditOptionsModelNew) + result, response, operationErr = catalogManagementService.GetOfferingUpdates(getOfferingUpdatesOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -7430,7 +14008,7 @@ var _ = Describe(`CatalogManagementV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetOfferingAudit successfully`, func() { + It(`Invoke GetOfferingUpdates successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -7438,14 +14016,26 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the GetOfferingAuditOptions model - getOfferingAuditOptionsModel := new(catalogmanagementv1.GetOfferingAuditOptions) - getOfferingAuditOptionsModel.CatalogIdentifier = core.StringPtr("testString") - getOfferingAuditOptionsModel.OfferingID = core.StringPtr("testString") - getOfferingAuditOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetOfferingUpdatesOptions model + getOfferingUpdatesOptionsModel := new(catalogmanagementv1.GetOfferingUpdatesOptions) + getOfferingUpdatesOptionsModel.CatalogIdentifier = core.StringPtr("testString") + getOfferingUpdatesOptionsModel.OfferingID = core.StringPtr("testString") + getOfferingUpdatesOptionsModel.Kind = core.StringPtr("testString") + getOfferingUpdatesOptionsModel.XAuthRefreshToken = core.StringPtr("testString") + getOfferingUpdatesOptionsModel.Target = core.StringPtr("testString") + getOfferingUpdatesOptionsModel.Version = core.StringPtr("testString") + getOfferingUpdatesOptionsModel.ClusterID = core.StringPtr("testString") + getOfferingUpdatesOptionsModel.Region = core.StringPtr("testString") + getOfferingUpdatesOptionsModel.ResourceGroupID = core.StringPtr("testString") + getOfferingUpdatesOptionsModel.Namespace = core.StringPtr("testString") + getOfferingUpdatesOptionsModel.Sha = core.StringPtr("testString") + getOfferingUpdatesOptionsModel.Channel = core.StringPtr("testString") + getOfferingUpdatesOptionsModel.Namespaces = []string{"testString"} + getOfferingUpdatesOptionsModel.AllNamespaces = core.BoolPtr(true) + getOfferingUpdatesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := catalogManagementService.GetOfferingAudit(getOfferingAuditOptionsModel) + result, response, operationErr := catalogManagementService.GetOfferingUpdates(getOfferingUpdatesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -7457,74 +14047,35 @@ var _ = Describe(`CatalogManagementV1`, func() { }) }) }) - Describe(`ReplaceOfferingIcon(replaceOfferingIconOptions *ReplaceOfferingIconOptions) - Operation response error`, func() { - replaceOfferingIconPath := "/catalogs/testString/offerings/testString/icon/testString" - Context(`Using mock server endpoint with invalid JSON response`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(replaceOfferingIconPath)) - Expect(req.Method).To(Equal("PUT")) - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, `} this is not valid json {`) - })) - }) - It(`Invoke ReplaceOfferingIcon with error: Operation response processing error`, func() { - catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(catalogManagementService).ToNot(BeNil()) - - // Construct an instance of the ReplaceOfferingIconOptions model - replaceOfferingIconOptionsModel := new(catalogmanagementv1.ReplaceOfferingIconOptions) - replaceOfferingIconOptionsModel.CatalogIdentifier = core.StringPtr("testString") - replaceOfferingIconOptionsModel.OfferingID = core.StringPtr("testString") - replaceOfferingIconOptionsModel.FileName = core.StringPtr("testString") - replaceOfferingIconOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := catalogManagementService.ReplaceOfferingIcon(replaceOfferingIconOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - - // Enable retries and test again - catalogManagementService.EnableRetries(0, 0) - result, response, operationErr = catalogManagementService.ReplaceOfferingIcon(replaceOfferingIconOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ReplaceOfferingIcon(replaceOfferingIconOptions *ReplaceOfferingIconOptions)`, func() { - replaceOfferingIconPath := "/catalogs/testString/offerings/testString/icon/testString" + Describe(`GetOfferingSource(getOfferingSourceOptions *GetOfferingSourceOptions)`, func() { + getOfferingSourcePath := "/offering/source" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(replaceOfferingIconPath)) - Expect(req.Method).To(Equal("PUT")) + Expect(req.URL.EscapedPath()).To(Equal(getOfferingSourcePath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.Header["Accept"]).ToNot(BeNil()) + Expect(req.Header["Accept"][0]).To(Equal(fmt.Sprintf("%v", "application/yaml"))) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["catalogID"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["kind"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["channel"]).To(Equal([]string{"testString"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response - res.Header().Set("Content-type", "application/json") + res.Header().Set("Content-type", "application/yaml") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "url": "URL", "crn": "CRN", "label": "Label", "name": "Name", "offering_icon_url": "OfferingIconURL", "offering_docs_url": "OfferingDocsURL", "offering_support_url": "OfferingSupportURL", "tags": ["Tags"], "keywords": ["Keywords"], "rating": {"one_star_count": 12, "two_star_count": 12, "three_star_count": 14, "four_star_count": 13}, "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "short_description": "ShortDescription", "long_description": "LongDescription", "features": [{"title": "Title", "description": "Description"}], "kinds": [{"id": "ID", "format_kind": "FormatKind", "target_kind": "TargetKind", "metadata": {"mapKey": "anyValue"}, "install_description": "InstallDescription", "tags": ["Tags"], "additional_features": [{"title": "Title", "description": "Description"}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "versions": [{"id": "ID", "_rev": "Rev", "crn": "CRN", "version": "Version", "sha": "Sha", "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "offering_id": "OfferingID", "catalog_id": "CatalogID", "kind_id": "KindID", "tags": ["Tags"], "repo_url": "RepoURL", "source_url": "SourceURL", "tgz_url": "TgzURL", "configuration": [{"key": "Key", "type": "Type", "default_value": "anyValue", "value_constraint": "ValueConstraint", "description": "Description", "required": true, "options": ["anyValue"], "hidden": true}], "metadata": {"mapKey": "anyValue"}, "validation": {"validated": "2019-01-01T12:00:00.000Z", "requested": "2019-01-01T12:00:00.000Z", "state": "State", "last_operation": "LastOperation", "target": {"mapKey": "anyValue"}}, "required_resources": [{"type": "mem", "value": "anyValue"}], "single_instance": true, "install": {"instructions": "Instructions", "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}, "pre_install": [{"instructions": "Instructions", "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}], "entitlement": {"provider_name": "ProviderName", "provider_id": "ProviderID", "product_id": "ProductID", "part_numbers": ["PartNumbers"], "image_repo_name": "ImageRepoName"}, "licenses": [{"id": "ID", "name": "Name", "type": "Type", "url": "URL", "description": "Description"}], "image_manifest_url": "ImageManifestURL", "deprecated": true, "package_version": "PackageVersion", "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "version_locator": "VersionLocator", "console_url": "ConsoleURL", "long_description": "LongDescription", "whitelisted_accounts": ["WhitelistedAccounts"]}], "plans": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "additional_features": [{"title": "Title", "description": "Description"}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "deployments": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z"}]}]}], "permit_request_ibm_public_publish": false, "ibm_publish_approved": true, "public_publish_approved": false, "public_original_crn": "PublicOriginalCRN", "publish_public_crn": "PublishPublicCRN", "portal_approval_record": "PortalApprovalRecord", "portal_ui_url": "PortalUIURL", "catalog_id": "CatalogID", "catalog_name": "CatalogName", "metadata": {"mapKey": "anyValue"}, "disclaimer": "Disclaimer", "hidden": true, "provider": "Provider", "provider_info": {"id": "ID", "name": "Name"}, "repo_info": {"token": "Token", "type": "Type"}, "support": {"url": "URL", "process": "Process", "locations": ["Locations"]}, "media": [{"url": "URL", "caption": "Caption", "type": "Type", "thumbnail_url": "ThumbnailURL"}]}`) + fmt.Fprintf(res, "%s", `This is a mock binary response.`) })) }) - It(`Invoke ReplaceOfferingIcon successfully with retries`, func() { + It(`Invoke GetOfferingSource successfully with retries`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -7533,23 +14084,27 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) catalogManagementService.EnableRetries(0, 0) - // Construct an instance of the ReplaceOfferingIconOptions model - replaceOfferingIconOptionsModel := new(catalogmanagementv1.ReplaceOfferingIconOptions) - replaceOfferingIconOptionsModel.CatalogIdentifier = core.StringPtr("testString") - replaceOfferingIconOptionsModel.OfferingID = core.StringPtr("testString") - replaceOfferingIconOptionsModel.FileName = core.StringPtr("testString") - replaceOfferingIconOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetOfferingSourceOptions model + getOfferingSourceOptionsModel := new(catalogmanagementv1.GetOfferingSourceOptions) + getOfferingSourceOptionsModel.Version = core.StringPtr("testString") + getOfferingSourceOptionsModel.Accept = core.StringPtr("application/yaml") + getOfferingSourceOptionsModel.CatalogID = core.StringPtr("testString") + getOfferingSourceOptionsModel.Name = core.StringPtr("testString") + getOfferingSourceOptionsModel.ID = core.StringPtr("testString") + getOfferingSourceOptionsModel.Kind = core.StringPtr("testString") + getOfferingSourceOptionsModel.Channel = core.StringPtr("testString") + getOfferingSourceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := catalogManagementService.ReplaceOfferingIconWithContext(ctx, replaceOfferingIconOptionsModel) + _, _, operationErr := catalogManagementService.GetOfferingSourceWithContext(ctx, getOfferingSourceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again catalogManagementService.DisableRetries() - result, response, operationErr := catalogManagementService.ReplaceOfferingIcon(replaceOfferingIconOptionsModel) + result, response, operationErr := catalogManagementService.GetOfferingSource(getOfferingSourceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -7557,7 +14112,7 @@ var _ = Describe(`CatalogManagementV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = catalogManagementService.ReplaceOfferingIconWithContext(ctx, replaceOfferingIconOptionsModel) + _, _, operationErr = catalogManagementService.GetOfferingSourceWithContext(ctx, getOfferingSourceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -7571,16 +14126,24 @@ var _ = Describe(`CatalogManagementV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(replaceOfferingIconPath)) - Expect(req.Method).To(Equal("PUT")) + Expect(req.URL.EscapedPath()).To(Equal(getOfferingSourcePath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.Header["Accept"]).ToNot(BeNil()) + Expect(req.Header["Accept"][0]).To(Equal(fmt.Sprintf("%v", "application/yaml"))) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["catalogID"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["kind"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["channel"]).To(Equal([]string{"testString"})) // Set mock response - res.Header().Set("Content-type", "application/json") + res.Header().Set("Content-type", "application/yaml") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "url": "URL", "crn": "CRN", "label": "Label", "name": "Name", "offering_icon_url": "OfferingIconURL", "offering_docs_url": "OfferingDocsURL", "offering_support_url": "OfferingSupportURL", "tags": ["Tags"], "keywords": ["Keywords"], "rating": {"one_star_count": 12, "two_star_count": 12, "three_star_count": 14, "four_star_count": 13}, "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "short_description": "ShortDescription", "long_description": "LongDescription", "features": [{"title": "Title", "description": "Description"}], "kinds": [{"id": "ID", "format_kind": "FormatKind", "target_kind": "TargetKind", "metadata": {"mapKey": "anyValue"}, "install_description": "InstallDescription", "tags": ["Tags"], "additional_features": [{"title": "Title", "description": "Description"}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "versions": [{"id": "ID", "_rev": "Rev", "crn": "CRN", "version": "Version", "sha": "Sha", "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "offering_id": "OfferingID", "catalog_id": "CatalogID", "kind_id": "KindID", "tags": ["Tags"], "repo_url": "RepoURL", "source_url": "SourceURL", "tgz_url": "TgzURL", "configuration": [{"key": "Key", "type": "Type", "default_value": "anyValue", "value_constraint": "ValueConstraint", "description": "Description", "required": true, "options": ["anyValue"], "hidden": true}], "metadata": {"mapKey": "anyValue"}, "validation": {"validated": "2019-01-01T12:00:00.000Z", "requested": "2019-01-01T12:00:00.000Z", "state": "State", "last_operation": "LastOperation", "target": {"mapKey": "anyValue"}}, "required_resources": [{"type": "mem", "value": "anyValue"}], "single_instance": true, "install": {"instructions": "Instructions", "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}, "pre_install": [{"instructions": "Instructions", "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}], "entitlement": {"provider_name": "ProviderName", "provider_id": "ProviderID", "product_id": "ProductID", "part_numbers": ["PartNumbers"], "image_repo_name": "ImageRepoName"}, "licenses": [{"id": "ID", "name": "Name", "type": "Type", "url": "URL", "description": "Description"}], "image_manifest_url": "ImageManifestURL", "deprecated": true, "package_version": "PackageVersion", "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "version_locator": "VersionLocator", "console_url": "ConsoleURL", "long_description": "LongDescription", "whitelisted_accounts": ["WhitelistedAccounts"]}], "plans": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "additional_features": [{"title": "Title", "description": "Description"}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "deployments": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z"}]}]}], "permit_request_ibm_public_publish": false, "ibm_publish_approved": true, "public_publish_approved": false, "public_original_crn": "PublicOriginalCRN", "publish_public_crn": "PublishPublicCRN", "portal_approval_record": "PortalApprovalRecord", "portal_ui_url": "PortalUIURL", "catalog_id": "CatalogID", "catalog_name": "CatalogName", "metadata": {"mapKey": "anyValue"}, "disclaimer": "Disclaimer", "hidden": true, "provider": "Provider", "provider_info": {"id": "ID", "name": "Name"}, "repo_info": {"token": "Token", "type": "Type"}, "support": {"url": "URL", "process": "Process", "locations": ["Locations"]}, "media": [{"url": "URL", "caption": "Caption", "type": "Type", "thumbnail_url": "ThumbnailURL"}]}`) + fmt.Fprintf(res, "%s", `This is a mock binary response.`) })) }) - It(`Invoke ReplaceOfferingIcon successfully`, func() { + It(`Invoke GetOfferingSource successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -7589,26 +14152,30 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := catalogManagementService.ReplaceOfferingIcon(nil) + result, response, operationErr := catalogManagementService.GetOfferingSource(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ReplaceOfferingIconOptions model - replaceOfferingIconOptionsModel := new(catalogmanagementv1.ReplaceOfferingIconOptions) - replaceOfferingIconOptionsModel.CatalogIdentifier = core.StringPtr("testString") - replaceOfferingIconOptionsModel.OfferingID = core.StringPtr("testString") - replaceOfferingIconOptionsModel.FileName = core.StringPtr("testString") - replaceOfferingIconOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetOfferingSourceOptions model + getOfferingSourceOptionsModel := new(catalogmanagementv1.GetOfferingSourceOptions) + getOfferingSourceOptionsModel.Version = core.StringPtr("testString") + getOfferingSourceOptionsModel.Accept = core.StringPtr("application/yaml") + getOfferingSourceOptionsModel.CatalogID = core.StringPtr("testString") + getOfferingSourceOptionsModel.Name = core.StringPtr("testString") + getOfferingSourceOptionsModel.ID = core.StringPtr("testString") + getOfferingSourceOptionsModel.Kind = core.StringPtr("testString") + getOfferingSourceOptionsModel.Channel = core.StringPtr("testString") + getOfferingSourceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = catalogManagementService.ReplaceOfferingIcon(replaceOfferingIconOptionsModel) + result, response, operationErr = catalogManagementService.GetOfferingSource(getOfferingSourceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ReplaceOfferingIcon with error: Operation validation and request error`, func() { + It(`Invoke GetOfferingSource with error: Operation validation and request error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -7616,24 +14183,28 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the ReplaceOfferingIconOptions model - replaceOfferingIconOptionsModel := new(catalogmanagementv1.ReplaceOfferingIconOptions) - replaceOfferingIconOptionsModel.CatalogIdentifier = core.StringPtr("testString") - replaceOfferingIconOptionsModel.OfferingID = core.StringPtr("testString") - replaceOfferingIconOptionsModel.FileName = core.StringPtr("testString") - replaceOfferingIconOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetOfferingSourceOptions model + getOfferingSourceOptionsModel := new(catalogmanagementv1.GetOfferingSourceOptions) + getOfferingSourceOptionsModel.Version = core.StringPtr("testString") + getOfferingSourceOptionsModel.Accept = core.StringPtr("application/yaml") + getOfferingSourceOptionsModel.CatalogID = core.StringPtr("testString") + getOfferingSourceOptionsModel.Name = core.StringPtr("testString") + getOfferingSourceOptionsModel.ID = core.StringPtr("testString") + getOfferingSourceOptionsModel.Kind = core.StringPtr("testString") + getOfferingSourceOptionsModel.Channel = core.StringPtr("testString") + getOfferingSourceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := catalogManagementService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := catalogManagementService.ReplaceOfferingIcon(replaceOfferingIconOptionsModel) + result, response, operationErr := catalogManagementService.GetOfferingSource(getOfferingSourceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the ReplaceOfferingIconOptions model with no property values - replaceOfferingIconOptionsModelNew := new(catalogmanagementv1.ReplaceOfferingIconOptions) + // Construct a second instance of the GetOfferingSourceOptions model with no property values + getOfferingSourceOptionsModelNew := new(catalogmanagementv1.GetOfferingSourceOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = catalogManagementService.ReplaceOfferingIcon(replaceOfferingIconOptionsModelNew) + result, response, operationErr = catalogManagementService.GetOfferingSource(getOfferingSourceOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -7651,7 +14222,7 @@ var _ = Describe(`CatalogManagementV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ReplaceOfferingIcon successfully`, func() { + It(`Invoke GetOfferingSource successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -7659,95 +14230,61 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the ReplaceOfferingIconOptions model - replaceOfferingIconOptionsModel := new(catalogmanagementv1.ReplaceOfferingIconOptions) - replaceOfferingIconOptionsModel.CatalogIdentifier = core.StringPtr("testString") - replaceOfferingIconOptionsModel.OfferingID = core.StringPtr("testString") - replaceOfferingIconOptionsModel.FileName = core.StringPtr("testString") - replaceOfferingIconOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetOfferingSourceOptions model + getOfferingSourceOptionsModel := new(catalogmanagementv1.GetOfferingSourceOptions) + getOfferingSourceOptionsModel.Version = core.StringPtr("testString") + getOfferingSourceOptionsModel.Accept = core.StringPtr("application/yaml") + getOfferingSourceOptionsModel.CatalogID = core.StringPtr("testString") + getOfferingSourceOptionsModel.Name = core.StringPtr("testString") + getOfferingSourceOptionsModel.ID = core.StringPtr("testString") + getOfferingSourceOptionsModel.Kind = core.StringPtr("testString") + getOfferingSourceOptionsModel.Channel = core.StringPtr("testString") + getOfferingSourceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := catalogManagementService.ReplaceOfferingIcon(replaceOfferingIconOptionsModel) + result, response, operationErr := catalogManagementService.GetOfferingSource(getOfferingSourceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateOfferingIBM(updateOfferingIBMOptions *UpdateOfferingIBMOptions) - Operation response error`, func() { - updateOfferingIBMPath := "/catalogs/testString/offerings/testString/publish/pc_managed/true" - Context(`Using mock server endpoint with invalid JSON response`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateOfferingIBMPath)) - Expect(req.Method).To(Equal("POST")) - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, `} this is not valid json {`) - })) - }) - It(`Invoke UpdateOfferingIBM with error: Operation response processing error`, func() { - catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(catalogManagementService).ToNot(BeNil()) - - // Construct an instance of the UpdateOfferingIBMOptions model - updateOfferingIBMOptionsModel := new(catalogmanagementv1.UpdateOfferingIBMOptions) - updateOfferingIBMOptionsModel.CatalogIdentifier = core.StringPtr("testString") - updateOfferingIBMOptionsModel.OfferingID = core.StringPtr("testString") - updateOfferingIBMOptionsModel.ApprovalType = core.StringPtr("pc_managed") - updateOfferingIBMOptionsModel.Approved = core.StringPtr("true") - updateOfferingIBMOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := catalogManagementService.UpdateOfferingIBM(updateOfferingIBMOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - // Enable retries and test again - catalogManagementService.EnableRetries(0, 0) - result, response, operationErr = catalogManagementService.UpdateOfferingIBM(updateOfferingIBMOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) + // Verify empty byte buffer. + Expect(result).ToNot(BeNil()) + buffer, operationErr := io.ReadAll(result) + Expect(operationErr).To(BeNil()) + Expect(buffer).ToNot(BeNil()) + Expect(len(buffer)).To(Equal(0)) }) AfterEach(func() { testServer.Close() }) }) }) - Describe(`UpdateOfferingIBM(updateOfferingIBMOptions *UpdateOfferingIBMOptions)`, func() { - updateOfferingIBMPath := "/catalogs/testString/offerings/testString/publish/pc_managed/true" + Describe(`GetOfferingSourceURL(getOfferingSourceURLOptions *GetOfferingSourceURLOptions)`, func() { + getOfferingSourceURLPath := "/offering/source/url/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateOfferingIBMPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(getOfferingSourceURLPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.Header["Accept"]).ToNot(BeNil()) + Expect(req.Header["Accept"][0]).To(Equal(fmt.Sprintf("%v", "application/yaml"))) + Expect(req.URL.Query()["catalogID"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["id"]).To(Equal([]string{"testString"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response - res.Header().Set("Content-type", "application/json") + res.Header().Set("Content-type", "application/yaml") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"allow_request": true, "ibm": false, "public": true, "changed": false}`) + fmt.Fprintf(res, "%s", `This is a mock binary response.`) })) }) - It(`Invoke UpdateOfferingIBM successfully with retries`, func() { + It(`Invoke GetOfferingSourceURL successfully with retries`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -7756,24 +14293,25 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) catalogManagementService.EnableRetries(0, 0) - // Construct an instance of the UpdateOfferingIBMOptions model - updateOfferingIBMOptionsModel := new(catalogmanagementv1.UpdateOfferingIBMOptions) - updateOfferingIBMOptionsModel.CatalogIdentifier = core.StringPtr("testString") - updateOfferingIBMOptionsModel.OfferingID = core.StringPtr("testString") - updateOfferingIBMOptionsModel.ApprovalType = core.StringPtr("pc_managed") - updateOfferingIBMOptionsModel.Approved = core.StringPtr("true") - updateOfferingIBMOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetOfferingSourceURLOptions model + getOfferingSourceURLOptionsModel := new(catalogmanagementv1.GetOfferingSourceURLOptions) + getOfferingSourceURLOptionsModel.KeyIdentifier = core.StringPtr("testString") + getOfferingSourceURLOptionsModel.Accept = core.StringPtr("application/yaml") + getOfferingSourceURLOptionsModel.CatalogID = core.StringPtr("testString") + getOfferingSourceURLOptionsModel.Name = core.StringPtr("testString") + getOfferingSourceURLOptionsModel.ID = core.StringPtr("testString") + getOfferingSourceURLOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := catalogManagementService.UpdateOfferingIBMWithContext(ctx, updateOfferingIBMOptionsModel) + _, _, operationErr := catalogManagementService.GetOfferingSourceURLWithContext(ctx, getOfferingSourceURLOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again catalogManagementService.DisableRetries() - result, response, operationErr := catalogManagementService.UpdateOfferingIBM(updateOfferingIBMOptionsModel) + result, response, operationErr := catalogManagementService.GetOfferingSourceURL(getOfferingSourceURLOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -7781,7 +14319,7 @@ var _ = Describe(`CatalogManagementV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = catalogManagementService.UpdateOfferingIBMWithContext(ctx, updateOfferingIBMOptionsModel) + _, _, operationErr = catalogManagementService.GetOfferingSourceURLWithContext(ctx, getOfferingSourceURLOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -7795,16 +14333,21 @@ var _ = Describe(`CatalogManagementV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateOfferingIBMPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(getOfferingSourceURLPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.Header["Accept"]).ToNot(BeNil()) + Expect(req.Header["Accept"][0]).To(Equal(fmt.Sprintf("%v", "application/yaml"))) + Expect(req.URL.Query()["catalogID"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["id"]).To(Equal([]string{"testString"})) // Set mock response - res.Header().Set("Content-type", "application/json") + res.Header().Set("Content-type", "application/yaml") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"allow_request": true, "ibm": false, "public": true, "changed": false}`) + fmt.Fprintf(res, "%s", `This is a mock binary response.`) })) }) - It(`Invoke UpdateOfferingIBM successfully`, func() { + It(`Invoke GetOfferingSourceURL successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -7813,27 +14356,28 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := catalogManagementService.UpdateOfferingIBM(nil) + result, response, operationErr := catalogManagementService.GetOfferingSourceURL(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the UpdateOfferingIBMOptions model - updateOfferingIBMOptionsModel := new(catalogmanagementv1.UpdateOfferingIBMOptions) - updateOfferingIBMOptionsModel.CatalogIdentifier = core.StringPtr("testString") - updateOfferingIBMOptionsModel.OfferingID = core.StringPtr("testString") - updateOfferingIBMOptionsModel.ApprovalType = core.StringPtr("pc_managed") - updateOfferingIBMOptionsModel.Approved = core.StringPtr("true") - updateOfferingIBMOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetOfferingSourceURLOptions model + getOfferingSourceURLOptionsModel := new(catalogmanagementv1.GetOfferingSourceURLOptions) + getOfferingSourceURLOptionsModel.KeyIdentifier = core.StringPtr("testString") + getOfferingSourceURLOptionsModel.Accept = core.StringPtr("application/yaml") + getOfferingSourceURLOptionsModel.CatalogID = core.StringPtr("testString") + getOfferingSourceURLOptionsModel.Name = core.StringPtr("testString") + getOfferingSourceURLOptionsModel.ID = core.StringPtr("testString") + getOfferingSourceURLOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = catalogManagementService.UpdateOfferingIBM(updateOfferingIBMOptionsModel) + result, response, operationErr = catalogManagementService.GetOfferingSourceURL(getOfferingSourceURLOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdateOfferingIBM with error: Operation validation and request error`, func() { + It(`Invoke GetOfferingSourceURL with error: Operation validation and request error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -7841,25 +14385,26 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the UpdateOfferingIBMOptions model - updateOfferingIBMOptionsModel := new(catalogmanagementv1.UpdateOfferingIBMOptions) - updateOfferingIBMOptionsModel.CatalogIdentifier = core.StringPtr("testString") - updateOfferingIBMOptionsModel.OfferingID = core.StringPtr("testString") - updateOfferingIBMOptionsModel.ApprovalType = core.StringPtr("pc_managed") - updateOfferingIBMOptionsModel.Approved = core.StringPtr("true") - updateOfferingIBMOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetOfferingSourceURLOptions model + getOfferingSourceURLOptionsModel := new(catalogmanagementv1.GetOfferingSourceURLOptions) + getOfferingSourceURLOptionsModel.KeyIdentifier = core.StringPtr("testString") + getOfferingSourceURLOptionsModel.Accept = core.StringPtr("application/yaml") + getOfferingSourceURLOptionsModel.CatalogID = core.StringPtr("testString") + getOfferingSourceURLOptionsModel.Name = core.StringPtr("testString") + getOfferingSourceURLOptionsModel.ID = core.StringPtr("testString") + getOfferingSourceURLOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := catalogManagementService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := catalogManagementService.UpdateOfferingIBM(updateOfferingIBMOptionsModel) + result, response, operationErr := catalogManagementService.GetOfferingSourceURL(getOfferingSourceURLOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the UpdateOfferingIBMOptions model with no property values - updateOfferingIBMOptionsModelNew := new(catalogmanagementv1.UpdateOfferingIBMOptions) + // Construct a second instance of the GetOfferingSourceURLOptions model with no property values + getOfferingSourceURLOptionsModelNew := new(catalogmanagementv1.GetOfferingSourceURLOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = catalogManagementService.UpdateOfferingIBM(updateOfferingIBMOptionsModelNew) + result, response, operationErr = catalogManagementService.GetOfferingSourceURL(getOfferingSourceURLOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -7877,7 +14422,7 @@ var _ = Describe(`CatalogManagementV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke UpdateOfferingIBM successfully`, func() { + It(`Invoke GetOfferingSourceURL successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -7885,58 +14430,108 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the UpdateOfferingIBMOptions model - updateOfferingIBMOptionsModel := new(catalogmanagementv1.UpdateOfferingIBMOptions) - updateOfferingIBMOptionsModel.CatalogIdentifier = core.StringPtr("testString") - updateOfferingIBMOptionsModel.OfferingID = core.StringPtr("testString") - updateOfferingIBMOptionsModel.ApprovalType = core.StringPtr("pc_managed") - updateOfferingIBMOptionsModel.Approved = core.StringPtr("true") - updateOfferingIBMOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetOfferingSourceURLOptions model + getOfferingSourceURLOptionsModel := new(catalogmanagementv1.GetOfferingSourceURLOptions) + getOfferingSourceURLOptionsModel.KeyIdentifier = core.StringPtr("testString") + getOfferingSourceURLOptionsModel.Accept = core.StringPtr("application/yaml") + getOfferingSourceURLOptionsModel.CatalogID = core.StringPtr("testString") + getOfferingSourceURLOptionsModel.Name = core.StringPtr("testString") + getOfferingSourceURLOptionsModel.ID = core.StringPtr("testString") + getOfferingSourceURLOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := catalogManagementService.UpdateOfferingIBM(updateOfferingIBMOptionsModel) + result, response, operationErr := catalogManagementService.GetOfferingSourceURL(getOfferingSourceURLOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) - // Verify a nil result - Expect(result).To(BeNil()) + + // Verify empty byte buffer. + Expect(result).ToNot(BeNil()) + buffer, operationErr := io.ReadAll(result) + Expect(operationErr).To(BeNil()) + Expect(buffer).ToNot(BeNil()) + Expect(len(buffer)).To(Equal(0)) }) AfterEach(func() { testServer.Close() }) }) }) - Describe(`DeprecateOffering(deprecateOfferingOptions *DeprecateOfferingOptions)`, func() { - deprecateOfferingPath := "/catalogs/testString/offerings/testString/deprecate/true" - Context(`Using mock server endpoint`, func() { + Describe(`GetOfferingAbout(getOfferingAboutOptions *GetOfferingAboutOptions)`, func() { + getOfferingAboutPath := "/versions/testString/about" + Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deprecateOfferingPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(getOfferingAboutPath)) + Expect(req.Method).To(Equal("GET")) - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + // Set mock response + res.Header().Set("Content-type", "text/markdown") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `"OperationResponse"`) + })) + }) + It(`Invoke GetOfferingAbout successfully with retries`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + catalogManagementService.EnableRetries(0, 0) - res.WriteHeader(202) + // Construct an instance of the GetOfferingAboutOptions model + getOfferingAboutOptionsModel := new(catalogmanagementv1.GetOfferingAboutOptions) + getOfferingAboutOptionsModel.VersionLocID = core.StringPtr("testString") + getOfferingAboutOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := catalogManagementService.GetOfferingAboutWithContext(ctx, getOfferingAboutOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + catalogManagementService.DisableRetries() + result, response, operationErr := catalogManagementService.GetOfferingAbout(getOfferingAboutOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = catalogManagementService.GetOfferingAboutWithContext(ctx, getOfferingAboutOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getOfferingAboutPath)) + Expect(req.Method).To(Equal("GET")) + + // Set mock response + res.Header().Set("Content-type", "text/markdown") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `"OperationResponse"`) })) }) - It(`Invoke DeprecateOffering successfully`, func() { + It(`Invoke GetOfferingAbout successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -7945,25 +14540,24 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - response, operationErr := catalogManagementService.DeprecateOffering(nil) + result, response, operationErr := catalogManagementService.GetOfferingAbout(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) + Expect(result).To(BeNil()) - // Construct an instance of the DeprecateOfferingOptions model - deprecateOfferingOptionsModel := new(catalogmanagementv1.DeprecateOfferingOptions) - deprecateOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") - deprecateOfferingOptionsModel.OfferingID = core.StringPtr("testString") - deprecateOfferingOptionsModel.Setting = core.StringPtr("true") - deprecateOfferingOptionsModel.Description = core.StringPtr("testString") - deprecateOfferingOptionsModel.DaysUntilDeprecate = core.Int64Ptr(int64(38)) - deprecateOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetOfferingAboutOptions model + getOfferingAboutOptionsModel := new(catalogmanagementv1.GetOfferingAboutOptions) + getOfferingAboutOptionsModel.VersionLocID = core.StringPtr("testString") + getOfferingAboutOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - response, operationErr = catalogManagementService.DeprecateOffering(deprecateOfferingOptionsModel) + result, response, operationErr = catalogManagementService.GetOfferingAbout(getOfferingAboutOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + }) - It(`Invoke DeprecateOffering with error: Operation validation and request error`, func() { + It(`Invoke GetOfferingAbout with error: Operation validation and request error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -7971,61 +14565,40 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the DeprecateOfferingOptions model - deprecateOfferingOptionsModel := new(catalogmanagementv1.DeprecateOfferingOptions) - deprecateOfferingOptionsModel.CatalogIdentifier = core.StringPtr("testString") - deprecateOfferingOptionsModel.OfferingID = core.StringPtr("testString") - deprecateOfferingOptionsModel.Setting = core.StringPtr("true") - deprecateOfferingOptionsModel.Description = core.StringPtr("testString") - deprecateOfferingOptionsModel.DaysUntilDeprecate = core.Int64Ptr(int64(38)) - deprecateOfferingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetOfferingAboutOptions model + getOfferingAboutOptionsModel := new(catalogmanagementv1.GetOfferingAboutOptions) + getOfferingAboutOptionsModel.VersionLocID = core.StringPtr("testString") + getOfferingAboutOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := catalogManagementService.SetServiceURL("") Expect(err).To(BeNil()) - response, operationErr := catalogManagementService.DeprecateOffering(deprecateOfferingOptionsModel) + result, response, operationErr := catalogManagementService.GetOfferingAbout(getOfferingAboutOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) - // Construct a second instance of the DeprecateOfferingOptions model with no property values - deprecateOfferingOptionsModelNew := new(catalogmanagementv1.DeprecateOfferingOptions) + Expect(result).To(BeNil()) + // Construct a second instance of the GetOfferingAboutOptions model with no property values + getOfferingAboutOptionsModelNew := new(catalogmanagementv1.GetOfferingAboutOptions) // Invoke operation with invalid model (negative test) - response, operationErr = catalogManagementService.DeprecateOffering(deprecateOfferingOptionsModelNew) + result, response, operationErr = catalogManagementService.GetOfferingAbout(getOfferingAboutOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) + Expect(result).To(BeNil()) }) AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetOfferingUpdates(getOfferingUpdatesOptions *GetOfferingUpdatesOptions) - Operation response error`, func() { - getOfferingUpdatesPath := "/catalogs/testString/offerings/testString/updates" - Context(`Using mock server endpoint with invalid JSON response`, func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getOfferingUpdatesPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.Header["X-Auth-Refresh-Token"]).ToNot(BeNil()) - Expect(req.Header["X-Auth-Refresh-Token"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["kind"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["target"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["cluster_id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["region"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["resource_group_id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["namespace"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["sha"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["channel"]).To(Equal([]string{"testString"})) - // TODO: Add check for all_namespaces query parameter - res.Header().Set("Content-type", "application/json") + // Set success status code with no respoonse body res.WriteHeader(200) - fmt.Fprintf(res, `} this is not valid json {`) })) }) - It(`Invoke GetOfferingUpdates with error: Operation response processing error`, func() { + It(`Invoke GetOfferingAbout successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -8033,34 +14606,17 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the GetOfferingUpdatesOptions model - getOfferingUpdatesOptionsModel := new(catalogmanagementv1.GetOfferingUpdatesOptions) - getOfferingUpdatesOptionsModel.CatalogIdentifier = core.StringPtr("testString") - getOfferingUpdatesOptionsModel.OfferingID = core.StringPtr("testString") - getOfferingUpdatesOptionsModel.Kind = core.StringPtr("testString") - getOfferingUpdatesOptionsModel.XAuthRefreshToken = core.StringPtr("testString") - getOfferingUpdatesOptionsModel.Target = core.StringPtr("testString") - getOfferingUpdatesOptionsModel.Version = core.StringPtr("testString") - getOfferingUpdatesOptionsModel.ClusterID = core.StringPtr("testString") - getOfferingUpdatesOptionsModel.Region = core.StringPtr("testString") - getOfferingUpdatesOptionsModel.ResourceGroupID = core.StringPtr("testString") - getOfferingUpdatesOptionsModel.Namespace = core.StringPtr("testString") - getOfferingUpdatesOptionsModel.Sha = core.StringPtr("testString") - getOfferingUpdatesOptionsModel.Channel = core.StringPtr("testString") - getOfferingUpdatesOptionsModel.Namespaces = []string{"testString"} - getOfferingUpdatesOptionsModel.AllNamespaces = core.BoolPtr(true) - getOfferingUpdatesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := catalogManagementService.GetOfferingUpdates(getOfferingUpdatesOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) + // Construct an instance of the GetOfferingAboutOptions model + getOfferingAboutOptionsModel := new(catalogmanagementv1.GetOfferingAboutOptions) + getOfferingAboutOptionsModel.VersionLocID = core.StringPtr("testString") + getOfferingAboutOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Enable retries and test again - catalogManagementService.EnableRetries(0, 0) - result, response, operationErr = catalogManagementService.GetOfferingUpdates(getOfferingUpdatesOptionsModel) - Expect(operationErr).ToNot(BeNil()) + // Invoke operation + result, response, operationErr := catalogManagementService.GetOfferingAbout(getOfferingAboutOptionsModel) + Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) + + // Verify a nil result Expect(result).To(BeNil()) }) AfterEach(func() { @@ -8068,39 +14624,27 @@ var _ = Describe(`CatalogManagementV1`, func() { }) }) }) - Describe(`GetOfferingUpdates(getOfferingUpdatesOptions *GetOfferingUpdatesOptions)`, func() { - getOfferingUpdatesPath := "/catalogs/testString/offerings/testString/updates" + Describe(`GetOfferingLicense(getOfferingLicenseOptions *GetOfferingLicenseOptions)`, func() { + getOfferingLicensePath := "/versions/testString/licenses/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getOfferingUpdatesPath)) + Expect(req.URL.EscapedPath()).To(Equal(getOfferingLicensePath)) Expect(req.Method).To(Equal("GET")) - Expect(req.Header["X-Auth-Refresh-Token"]).ToNot(BeNil()) - Expect(req.Header["X-Auth-Refresh-Token"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["kind"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["target"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["cluster_id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["region"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["resource_group_id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["namespace"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["sha"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["channel"]).To(Equal([]string{"testString"})) - // TODO: Add check for all_namespaces query parameter // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response - res.Header().Set("Content-type", "application/json") + res.Header().Set("Content-type", "text/plain") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `[{"version_locator": "VersionLocator", "version": "Version", "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "required_resources": [{"type": "mem", "value": "anyValue"}], "package_version": "PackageVersion", "sha": "Sha", "can_update": false, "messages": {"mapKey": "Inner"}}]`) + fmt.Fprintf(res, "%s", `"OperationResponse"`) })) }) - It(`Invoke GetOfferingUpdates successfully with retries`, func() { + It(`Invoke GetOfferingLicense successfully with retries`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -8109,34 +14653,22 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) catalogManagementService.EnableRetries(0, 0) - // Construct an instance of the GetOfferingUpdatesOptions model - getOfferingUpdatesOptionsModel := new(catalogmanagementv1.GetOfferingUpdatesOptions) - getOfferingUpdatesOptionsModel.CatalogIdentifier = core.StringPtr("testString") - getOfferingUpdatesOptionsModel.OfferingID = core.StringPtr("testString") - getOfferingUpdatesOptionsModel.Kind = core.StringPtr("testString") - getOfferingUpdatesOptionsModel.XAuthRefreshToken = core.StringPtr("testString") - getOfferingUpdatesOptionsModel.Target = core.StringPtr("testString") - getOfferingUpdatesOptionsModel.Version = core.StringPtr("testString") - getOfferingUpdatesOptionsModel.ClusterID = core.StringPtr("testString") - getOfferingUpdatesOptionsModel.Region = core.StringPtr("testString") - getOfferingUpdatesOptionsModel.ResourceGroupID = core.StringPtr("testString") - getOfferingUpdatesOptionsModel.Namespace = core.StringPtr("testString") - getOfferingUpdatesOptionsModel.Sha = core.StringPtr("testString") - getOfferingUpdatesOptionsModel.Channel = core.StringPtr("testString") - getOfferingUpdatesOptionsModel.Namespaces = []string{"testString"} - getOfferingUpdatesOptionsModel.AllNamespaces = core.BoolPtr(true) - getOfferingUpdatesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetOfferingLicenseOptions model + getOfferingLicenseOptionsModel := new(catalogmanagementv1.GetOfferingLicenseOptions) + getOfferingLicenseOptionsModel.VersionLocID = core.StringPtr("testString") + getOfferingLicenseOptionsModel.LicenseID = core.StringPtr("testString") + getOfferingLicenseOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := catalogManagementService.GetOfferingUpdatesWithContext(ctx, getOfferingUpdatesOptionsModel) + _, _, operationErr := catalogManagementService.GetOfferingLicenseWithContext(ctx, getOfferingLicenseOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again catalogManagementService.DisableRetries() - result, response, operationErr := catalogManagementService.GetOfferingUpdates(getOfferingUpdatesOptionsModel) + result, response, operationErr := catalogManagementService.GetOfferingLicense(getOfferingLicenseOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -8144,7 +14676,7 @@ var _ = Describe(`CatalogManagementV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = catalogManagementService.GetOfferingUpdatesWithContext(ctx, getOfferingUpdatesOptionsModel) + _, _, operationErr = catalogManagementService.GetOfferingLicenseWithContext(ctx, getOfferingLicenseOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -8158,28 +14690,16 @@ var _ = Describe(`CatalogManagementV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getOfferingUpdatesPath)) + Expect(req.URL.EscapedPath()).To(Equal(getOfferingLicensePath)) Expect(req.Method).To(Equal("GET")) - Expect(req.Header["X-Auth-Refresh-Token"]).ToNot(BeNil()) - Expect(req.Header["X-Auth-Refresh-Token"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["kind"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["target"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["cluster_id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["region"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["resource_group_id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["namespace"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["sha"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["channel"]).To(Equal([]string{"testString"})) - // TODO: Add check for all_namespaces query parameter // Set mock response - res.Header().Set("Content-type", "application/json") + res.Header().Set("Content-type", "text/plain") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `[{"version_locator": "VersionLocator", "version": "Version", "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "required_resources": [{"type": "mem", "value": "anyValue"}], "package_version": "PackageVersion", "sha": "Sha", "can_update": false, "messages": {"mapKey": "Inner"}}]`) + fmt.Fprintf(res, "%s", `"OperationResponse"`) })) }) - It(`Invoke GetOfferingUpdates successfully`, func() { + It(`Invoke GetOfferingLicense successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -8188,37 +14708,25 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := catalogManagementService.GetOfferingUpdates(nil) + result, response, operationErr := catalogManagementService.GetOfferingLicense(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetOfferingUpdatesOptions model - getOfferingUpdatesOptionsModel := new(catalogmanagementv1.GetOfferingUpdatesOptions) - getOfferingUpdatesOptionsModel.CatalogIdentifier = core.StringPtr("testString") - getOfferingUpdatesOptionsModel.OfferingID = core.StringPtr("testString") - getOfferingUpdatesOptionsModel.Kind = core.StringPtr("testString") - getOfferingUpdatesOptionsModel.XAuthRefreshToken = core.StringPtr("testString") - getOfferingUpdatesOptionsModel.Target = core.StringPtr("testString") - getOfferingUpdatesOptionsModel.Version = core.StringPtr("testString") - getOfferingUpdatesOptionsModel.ClusterID = core.StringPtr("testString") - getOfferingUpdatesOptionsModel.Region = core.StringPtr("testString") - getOfferingUpdatesOptionsModel.ResourceGroupID = core.StringPtr("testString") - getOfferingUpdatesOptionsModel.Namespace = core.StringPtr("testString") - getOfferingUpdatesOptionsModel.Sha = core.StringPtr("testString") - getOfferingUpdatesOptionsModel.Channel = core.StringPtr("testString") - getOfferingUpdatesOptionsModel.Namespaces = []string{"testString"} - getOfferingUpdatesOptionsModel.AllNamespaces = core.BoolPtr(true) - getOfferingUpdatesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetOfferingLicenseOptions model + getOfferingLicenseOptionsModel := new(catalogmanagementv1.GetOfferingLicenseOptions) + getOfferingLicenseOptionsModel.VersionLocID = core.StringPtr("testString") + getOfferingLicenseOptionsModel.LicenseID = core.StringPtr("testString") + getOfferingLicenseOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = catalogManagementService.GetOfferingUpdates(getOfferingUpdatesOptionsModel) + result, response, operationErr = catalogManagementService.GetOfferingLicense(getOfferingLicenseOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetOfferingUpdates with error: Operation validation and request error`, func() { + It(`Invoke GetOfferingLicense with error: Operation validation and request error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -8226,35 +14734,23 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the GetOfferingUpdatesOptions model - getOfferingUpdatesOptionsModel := new(catalogmanagementv1.GetOfferingUpdatesOptions) - getOfferingUpdatesOptionsModel.CatalogIdentifier = core.StringPtr("testString") - getOfferingUpdatesOptionsModel.OfferingID = core.StringPtr("testString") - getOfferingUpdatesOptionsModel.Kind = core.StringPtr("testString") - getOfferingUpdatesOptionsModel.XAuthRefreshToken = core.StringPtr("testString") - getOfferingUpdatesOptionsModel.Target = core.StringPtr("testString") - getOfferingUpdatesOptionsModel.Version = core.StringPtr("testString") - getOfferingUpdatesOptionsModel.ClusterID = core.StringPtr("testString") - getOfferingUpdatesOptionsModel.Region = core.StringPtr("testString") - getOfferingUpdatesOptionsModel.ResourceGroupID = core.StringPtr("testString") - getOfferingUpdatesOptionsModel.Namespace = core.StringPtr("testString") - getOfferingUpdatesOptionsModel.Sha = core.StringPtr("testString") - getOfferingUpdatesOptionsModel.Channel = core.StringPtr("testString") - getOfferingUpdatesOptionsModel.Namespaces = []string{"testString"} - getOfferingUpdatesOptionsModel.AllNamespaces = core.BoolPtr(true) - getOfferingUpdatesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetOfferingLicenseOptions model + getOfferingLicenseOptionsModel := new(catalogmanagementv1.GetOfferingLicenseOptions) + getOfferingLicenseOptionsModel.VersionLocID = core.StringPtr("testString") + getOfferingLicenseOptionsModel.LicenseID = core.StringPtr("testString") + getOfferingLicenseOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := catalogManagementService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := catalogManagementService.GetOfferingUpdates(getOfferingUpdatesOptionsModel) + result, response, operationErr := catalogManagementService.GetOfferingLicense(getOfferingLicenseOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetOfferingUpdatesOptions model with no property values - getOfferingUpdatesOptionsModelNew := new(catalogmanagementv1.GetOfferingUpdatesOptions) + // Construct a second instance of the GetOfferingLicenseOptions model with no property values + getOfferingLicenseOptionsModelNew := new(catalogmanagementv1.GetOfferingLicenseOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = catalogManagementService.GetOfferingUpdates(getOfferingUpdatesOptionsModelNew) + result, response, operationErr = catalogManagementService.GetOfferingLicense(getOfferingLicenseOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -8272,7 +14768,7 @@ var _ = Describe(`CatalogManagementV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetOfferingUpdates successfully`, func() { + It(`Invoke GetOfferingLicense successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -8280,30 +14776,63 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the GetOfferingUpdatesOptions model - getOfferingUpdatesOptionsModel := new(catalogmanagementv1.GetOfferingUpdatesOptions) - getOfferingUpdatesOptionsModel.CatalogIdentifier = core.StringPtr("testString") - getOfferingUpdatesOptionsModel.OfferingID = core.StringPtr("testString") - getOfferingUpdatesOptionsModel.Kind = core.StringPtr("testString") - getOfferingUpdatesOptionsModel.XAuthRefreshToken = core.StringPtr("testString") - getOfferingUpdatesOptionsModel.Target = core.StringPtr("testString") - getOfferingUpdatesOptionsModel.Version = core.StringPtr("testString") - getOfferingUpdatesOptionsModel.ClusterID = core.StringPtr("testString") - getOfferingUpdatesOptionsModel.Region = core.StringPtr("testString") - getOfferingUpdatesOptionsModel.ResourceGroupID = core.StringPtr("testString") - getOfferingUpdatesOptionsModel.Namespace = core.StringPtr("testString") - getOfferingUpdatesOptionsModel.Sha = core.StringPtr("testString") - getOfferingUpdatesOptionsModel.Channel = core.StringPtr("testString") - getOfferingUpdatesOptionsModel.Namespaces = []string{"testString"} - getOfferingUpdatesOptionsModel.AllNamespaces = core.BoolPtr(true) - getOfferingUpdatesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetOfferingLicenseOptions model + getOfferingLicenseOptionsModel := new(catalogmanagementv1.GetOfferingLicenseOptions) + getOfferingLicenseOptionsModel.VersionLocID = core.StringPtr("testString") + getOfferingLicenseOptionsModel.LicenseID = core.StringPtr("testString") + getOfferingLicenseOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := catalogManagementService.GetOfferingUpdates(getOfferingUpdatesOptionsModel) + result, response, operationErr := catalogManagementService.GetOfferingLicense(getOfferingLicenseOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) - - // Verify a nil result + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetOfferingContainerImages(getOfferingContainerImagesOptions *GetOfferingContainerImagesOptions) - Operation response error`, func() { + getOfferingContainerImagesPath := "/versions/testString/containerImages" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getOfferingContainerImagesPath)) + Expect(req.Method).To(Equal("GET")) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke GetOfferingContainerImages with error: Operation response processing error`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Construct an instance of the GetOfferingContainerImagesOptions model + getOfferingContainerImagesOptionsModel := new(catalogmanagementv1.GetOfferingContainerImagesOptions) + getOfferingContainerImagesOptionsModel.VersionLocID = core.StringPtr("testString") + getOfferingContainerImagesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := catalogManagementService.GetOfferingContainerImages(getOfferingContainerImagesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + catalogManagementService.EnableRetries(0, 0) + result, response, operationErr = catalogManagementService.GetOfferingContainerImages(getOfferingContainerImagesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) }) AfterEach(func() { @@ -8311,35 +14840,27 @@ var _ = Describe(`CatalogManagementV1`, func() { }) }) }) - Describe(`GetOfferingSource(getOfferingSourceOptions *GetOfferingSourceOptions)`, func() { - getOfferingSourcePath := "/offering/source" + Describe(`GetOfferingContainerImages(getOfferingContainerImagesOptions *GetOfferingContainerImagesOptions)`, func() { + getOfferingContainerImagesPath := "/versions/testString/containerImages" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getOfferingSourcePath)) + Expect(req.URL.EscapedPath()).To(Equal(getOfferingContainerImagesPath)) Expect(req.Method).To(Equal("GET")) - Expect(req.Header["Accept"]).ToNot(BeNil()) - Expect(req.Header["Accept"][0]).To(Equal(fmt.Sprintf("%v", "application/yaml"))) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["catalogID"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["kind"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["channel"]).To(Equal([]string{"testString"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response - res.Header().Set("Content-type", "application/yaml") + res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `This is a mock binary response.`) + fmt.Fprintf(res, "%s", `{"description": "Description", "images": [{"image": "Image"}]}`) })) }) - It(`Invoke GetOfferingSource successfully with retries`, func() { + It(`Invoke GetOfferingContainerImages successfully with retries`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -8348,27 +14869,21 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) catalogManagementService.EnableRetries(0, 0) - // Construct an instance of the GetOfferingSourceOptions model - getOfferingSourceOptionsModel := new(catalogmanagementv1.GetOfferingSourceOptions) - getOfferingSourceOptionsModel.Version = core.StringPtr("testString") - getOfferingSourceOptionsModel.Accept = core.StringPtr("application/yaml") - getOfferingSourceOptionsModel.CatalogID = core.StringPtr("testString") - getOfferingSourceOptionsModel.Name = core.StringPtr("testString") - getOfferingSourceOptionsModel.ID = core.StringPtr("testString") - getOfferingSourceOptionsModel.Kind = core.StringPtr("testString") - getOfferingSourceOptionsModel.Channel = core.StringPtr("testString") - getOfferingSourceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetOfferingContainerImagesOptions model + getOfferingContainerImagesOptionsModel := new(catalogmanagementv1.GetOfferingContainerImagesOptions) + getOfferingContainerImagesOptionsModel.VersionLocID = core.StringPtr("testString") + getOfferingContainerImagesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := catalogManagementService.GetOfferingSourceWithContext(ctx, getOfferingSourceOptionsModel) + _, _, operationErr := catalogManagementService.GetOfferingContainerImagesWithContext(ctx, getOfferingContainerImagesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again catalogManagementService.DisableRetries() - result, response, operationErr := catalogManagementService.GetOfferingSource(getOfferingSourceOptionsModel) + result, response, operationErr := catalogManagementService.GetOfferingContainerImages(getOfferingContainerImagesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -8376,7 +14891,7 @@ var _ = Describe(`CatalogManagementV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = catalogManagementService.GetOfferingSourceWithContext(ctx, getOfferingSourceOptionsModel) + _, _, operationErr = catalogManagementService.GetOfferingContainerImagesWithContext(ctx, getOfferingContainerImagesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -8390,24 +14905,16 @@ var _ = Describe(`CatalogManagementV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getOfferingSourcePath)) + Expect(req.URL.EscapedPath()).To(Equal(getOfferingContainerImagesPath)) Expect(req.Method).To(Equal("GET")) - Expect(req.Header["Accept"]).ToNot(BeNil()) - Expect(req.Header["Accept"][0]).To(Equal(fmt.Sprintf("%v", "application/yaml"))) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["catalogID"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["kind"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["channel"]).To(Equal([]string{"testString"})) // Set mock response - res.Header().Set("Content-type", "application/yaml") + res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `This is a mock binary response.`) + fmt.Fprintf(res, "%s", `{"description": "Description", "images": [{"image": "Image"}]}`) })) }) - It(`Invoke GetOfferingSource successfully`, func() { + It(`Invoke GetOfferingContainerImages successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -8416,30 +14923,24 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := catalogManagementService.GetOfferingSource(nil) + result, response, operationErr := catalogManagementService.GetOfferingContainerImages(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetOfferingSourceOptions model - getOfferingSourceOptionsModel := new(catalogmanagementv1.GetOfferingSourceOptions) - getOfferingSourceOptionsModel.Version = core.StringPtr("testString") - getOfferingSourceOptionsModel.Accept = core.StringPtr("application/yaml") - getOfferingSourceOptionsModel.CatalogID = core.StringPtr("testString") - getOfferingSourceOptionsModel.Name = core.StringPtr("testString") - getOfferingSourceOptionsModel.ID = core.StringPtr("testString") - getOfferingSourceOptionsModel.Kind = core.StringPtr("testString") - getOfferingSourceOptionsModel.Channel = core.StringPtr("testString") - getOfferingSourceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetOfferingContainerImagesOptions model + getOfferingContainerImagesOptionsModel := new(catalogmanagementv1.GetOfferingContainerImagesOptions) + getOfferingContainerImagesOptionsModel.VersionLocID = core.StringPtr("testString") + getOfferingContainerImagesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = catalogManagementService.GetOfferingSource(getOfferingSourceOptionsModel) + result, response, operationErr = catalogManagementService.GetOfferingContainerImages(getOfferingContainerImagesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetOfferingSource with error: Operation validation and request error`, func() { + It(`Invoke GetOfferingContainerImages with error: Operation validation and request error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -8447,28 +14948,22 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the GetOfferingSourceOptions model - getOfferingSourceOptionsModel := new(catalogmanagementv1.GetOfferingSourceOptions) - getOfferingSourceOptionsModel.Version = core.StringPtr("testString") - getOfferingSourceOptionsModel.Accept = core.StringPtr("application/yaml") - getOfferingSourceOptionsModel.CatalogID = core.StringPtr("testString") - getOfferingSourceOptionsModel.Name = core.StringPtr("testString") - getOfferingSourceOptionsModel.ID = core.StringPtr("testString") - getOfferingSourceOptionsModel.Kind = core.StringPtr("testString") - getOfferingSourceOptionsModel.Channel = core.StringPtr("testString") - getOfferingSourceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetOfferingContainerImagesOptions model + getOfferingContainerImagesOptionsModel := new(catalogmanagementv1.GetOfferingContainerImagesOptions) + getOfferingContainerImagesOptionsModel.VersionLocID = core.StringPtr("testString") + getOfferingContainerImagesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := catalogManagementService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := catalogManagementService.GetOfferingSource(getOfferingSourceOptionsModel) + result, response, operationErr := catalogManagementService.GetOfferingContainerImages(getOfferingContainerImagesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetOfferingSourceOptions model with no property values - getOfferingSourceOptionsModelNew := new(catalogmanagementv1.GetOfferingSourceOptions) + // Construct a second instance of the GetOfferingContainerImagesOptions model with no property values + getOfferingContainerImagesOptionsModelNew := new(catalogmanagementv1.GetOfferingContainerImagesOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = catalogManagementService.GetOfferingSource(getOfferingSourceOptionsModelNew) + result, response, operationErr = catalogManagementService.GetOfferingContainerImages(getOfferingContainerImagesOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -8486,7 +14981,7 @@ var _ = Describe(`CatalogManagementV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetOfferingSource successfully`, func() { + It(`Invoke GetOfferingContainerImages successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -8494,110 +14989,197 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the GetOfferingSourceOptions model - getOfferingSourceOptionsModel := new(catalogmanagementv1.GetOfferingSourceOptions) - getOfferingSourceOptionsModel.Version = core.StringPtr("testString") - getOfferingSourceOptionsModel.Accept = core.StringPtr("application/yaml") - getOfferingSourceOptionsModel.CatalogID = core.StringPtr("testString") - getOfferingSourceOptionsModel.Name = core.StringPtr("testString") - getOfferingSourceOptionsModel.ID = core.StringPtr("testString") - getOfferingSourceOptionsModel.Kind = core.StringPtr("testString") - getOfferingSourceOptionsModel.Channel = core.StringPtr("testString") - getOfferingSourceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetOfferingContainerImagesOptions model + getOfferingContainerImagesOptionsModel := new(catalogmanagementv1.GetOfferingContainerImagesOptions) + getOfferingContainerImagesOptionsModel.VersionLocID = core.StringPtr("testString") + getOfferingContainerImagesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := catalogManagementService.GetOfferingSource(getOfferingSourceOptionsModel) + result, response, operationErr := catalogManagementService.GetOfferingContainerImages(getOfferingContainerImagesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ArchiveVersion(archiveVersionOptions *ArchiveVersionOptions)`, func() { + archiveVersionPath := "/versions/testString/archive" + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(archiveVersionPath)) + Expect(req.Method).To(Equal("POST")) - // Verify empty byte buffer. - Expect(result).ToNot(BeNil()) - buffer, operationErr := io.ReadAll(result) + res.WriteHeader(202) + })) + }) + It(`Invoke ArchiveVersion successfully`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + response, operationErr := catalogManagementService.ArchiveVersion(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the ArchiveVersionOptions model + archiveVersionOptionsModel := new(catalogmanagementv1.ArchiveVersionOptions) + archiveVersionOptionsModel.VersionLocID = core.StringPtr("testString") + archiveVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = catalogManagementService.ArchiveVersion(archiveVersionOptionsModel) Expect(operationErr).To(BeNil()) - Expect(buffer).ToNot(BeNil()) - Expect(len(buffer)).To(Equal(0)) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke ArchiveVersion with error: Operation validation and request error`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Construct an instance of the ArchiveVersionOptions model + archiveVersionOptionsModel := new(catalogmanagementv1.ArchiveVersionOptions) + archiveVersionOptionsModel.VersionLocID = core.StringPtr("testString") + archiveVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := catalogManagementService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := catalogManagementService.ArchiveVersion(archiveVersionOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the ArchiveVersionOptions model with no property values + archiveVersionOptionsModelNew := new(catalogmanagementv1.ArchiveVersionOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = catalogManagementService.ArchiveVersion(archiveVersionOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) }) - Describe(`GetOfferingAbout(getOfferingAboutOptions *GetOfferingAboutOptions)`, func() { - getOfferingAboutPath := "/versions/testString/about" - Context(`Using mock server endpoint with timeout`, func() { + Describe(`SetDeprecateVersion(setDeprecateVersionOptions *SetDeprecateVersionOptions)`, func() { + setDeprecateVersionPath := "/versions/testString/deprecate/true" + Context(`Using mock server endpoint`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getOfferingAboutPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(setDeprecateVersionPath)) + Expect(req.Method).To(Equal("POST")) - // Sleep a short time to support a timeout test - time.Sleep(100 * time.Millisecond) + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - // Set mock response - res.Header().Set("Content-type", "text/markdown") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `"OperationResponse"`) + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + res.WriteHeader(202) })) }) - It(`Invoke GetOfferingAbout successfully with retries`, func() { + It(`Invoke SetDeprecateVersion successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - catalogManagementService.EnableRetries(0, 0) - // Construct an instance of the GetOfferingAboutOptions model - getOfferingAboutOptionsModel := new(catalogmanagementv1.GetOfferingAboutOptions) - getOfferingAboutOptionsModel.VersionLocID = core.StringPtr("testString") - getOfferingAboutOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with nil options model (negative test) + response, operationErr := catalogManagementService.SetDeprecateVersion(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) - // Invoke operation with a Context to test a timeout error - ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) - defer cancelFunc() - _, _, operationErr := catalogManagementService.GetOfferingAboutWithContext(ctx, getOfferingAboutOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + // Construct an instance of the SetDeprecateVersionOptions model + setDeprecateVersionOptionsModel := new(catalogmanagementv1.SetDeprecateVersionOptions) + setDeprecateVersionOptionsModel.VersionLocID = core.StringPtr("testString") + setDeprecateVersionOptionsModel.Setting = core.StringPtr("true") + setDeprecateVersionOptionsModel.Description = core.StringPtr("testString") + setDeprecateVersionOptionsModel.DaysUntilDeprecate = core.Int64Ptr(int64(38)) + setDeprecateVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Disable retries and test again - catalogManagementService.DisableRetries() - result, response, operationErr := catalogManagementService.GetOfferingAbout(getOfferingAboutOptionsModel) + // Invoke operation with valid options model (positive test) + response, operationErr = catalogManagementService.SetDeprecateVersion(setDeprecateVersionOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) + }) + It(`Invoke SetDeprecateVersion with error: Operation validation and request error`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) - // Re-test the timeout error with retries disabled - ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) - defer cancelFunc2() - _, _, operationErr = catalogManagementService.GetOfferingAboutWithContext(ctx, getOfferingAboutOptionsModel) + // Construct an instance of the SetDeprecateVersionOptions model + setDeprecateVersionOptionsModel := new(catalogmanagementv1.SetDeprecateVersionOptions) + setDeprecateVersionOptionsModel.VersionLocID = core.StringPtr("testString") + setDeprecateVersionOptionsModel.Setting = core.StringPtr("true") + setDeprecateVersionOptionsModel.Description = core.StringPtr("testString") + setDeprecateVersionOptionsModel.DaysUntilDeprecate = core.Int64Ptr(int64(38)) + setDeprecateVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := catalogManagementService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := catalogManagementService.SetDeprecateVersion(setDeprecateVersionOptionsModel) Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the SetDeprecateVersionOptions model with no property values + setDeprecateVersionOptionsModelNew := new(catalogmanagementv1.SetDeprecateVersionOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = catalogManagementService.SetDeprecateVersion(setDeprecateVersionOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) + }) + Describe(`ConsumableVersion(consumableVersionOptions *ConsumableVersionOptions)`, func() { + consumableVersionPath := "/versions/testString/consume-publish" Context(`Using mock server endpoint`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getOfferingAboutPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(consumableVersionPath)) + Expect(req.Method).To(Equal("POST")) - // Set mock response - res.Header().Set("Content-type", "text/markdown") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `"OperationResponse"`) + res.WriteHeader(202) })) }) - It(`Invoke GetOfferingAbout successfully`, func() { + It(`Invoke ConsumableVersion successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -8606,24 +15188,21 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := catalogManagementService.GetOfferingAbout(nil) + response, operationErr := catalogManagementService.ConsumableVersion(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - // Construct an instance of the GetOfferingAboutOptions model - getOfferingAboutOptionsModel := new(catalogmanagementv1.GetOfferingAboutOptions) - getOfferingAboutOptionsModel.VersionLocID = core.StringPtr("testString") - getOfferingAboutOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ConsumableVersionOptions model + consumableVersionOptionsModel := new(catalogmanagementv1.ConsumableVersionOptions) + consumableVersionOptionsModel.VersionLocID = core.StringPtr("testString") + consumableVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = catalogManagementService.GetOfferingAbout(getOfferingAboutOptionsModel) + response, operationErr = catalogManagementService.ConsumableVersion(consumableVersionOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - }) - It(`Invoke GetOfferingAbout with error: Operation validation and request error`, func() { + It(`Invoke ConsumableVersion with error: Operation validation and request error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -8631,40 +15210,44 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the GetOfferingAboutOptions model - getOfferingAboutOptionsModel := new(catalogmanagementv1.GetOfferingAboutOptions) - getOfferingAboutOptionsModel.VersionLocID = core.StringPtr("testString") - getOfferingAboutOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ConsumableVersionOptions model + consumableVersionOptionsModel := new(catalogmanagementv1.ConsumableVersionOptions) + consumableVersionOptionsModel.VersionLocID = core.StringPtr("testString") + consumableVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := catalogManagementService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := catalogManagementService.GetOfferingAbout(getOfferingAboutOptionsModel) + response, operationErr := catalogManagementService.ConsumableVersion(consumableVersionOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - // Construct a second instance of the GetOfferingAboutOptions model with no property values - getOfferingAboutOptionsModelNew := new(catalogmanagementv1.GetOfferingAboutOptions) + // Construct a second instance of the ConsumableVersionOptions model with no property values + consumableVersionOptionsModelNew := new(catalogmanagementv1.ConsumableVersionOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = catalogManagementService.GetOfferingAbout(getOfferingAboutOptionsModelNew) + response, operationErr = catalogManagementService.ConsumableVersion(consumableVersionOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) - Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) - Context(`Using mock server endpoint with missing response body`, func() { + }) + Describe(`SuspendVersion(suspendVersionOptions *SuspendVersionOptions)`, func() { + suspendVersionPath := "/versions/testString/suspend" + Context(`Using mock server endpoint`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() - // Set success status code with no respoonse body - res.WriteHeader(200) + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(suspendVersionPath)) + Expect(req.Method).To(Equal("POST")) + + res.WriteHeader(202) })) }) - It(`Invoke GetOfferingAbout successfully`, func() { + It(`Invoke SuspendVersion successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -8672,100 +15255,67 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the GetOfferingAboutOptions model - getOfferingAboutOptionsModel := new(catalogmanagementv1.GetOfferingAboutOptions) - getOfferingAboutOptionsModel.VersionLocID = core.StringPtr("testString") - getOfferingAboutOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with nil options model (negative test) + response, operationErr := catalogManagementService.SuspendVersion(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) - // Invoke operation - result, response, operationErr := catalogManagementService.GetOfferingAbout(getOfferingAboutOptionsModel) + // Construct an instance of the SuspendVersionOptions model + suspendVersionOptionsModel := new(catalogmanagementv1.SuspendVersionOptions) + suspendVersionOptionsModel.VersionLocID = core.StringPtr("testString") + suspendVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = catalogManagementService.SuspendVersion(suspendVersionOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetOfferingLicense(getOfferingLicenseOptions *GetOfferingLicenseOptions)`, func() { - getOfferingLicensePath := "/versions/testString/licenses/testString" - Context(`Using mock server endpoint with timeout`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getOfferingLicensePath)) - Expect(req.Method).To(Equal("GET")) - - // Sleep a short time to support a timeout test - time.Sleep(100 * time.Millisecond) - - // Set mock response - res.Header().Set("Content-type", "text/plain") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `"OperationResponse"`) - })) }) - It(`Invoke GetOfferingLicense successfully with retries`, func() { + It(`Invoke SuspendVersion with error: Operation validation and request error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - catalogManagementService.EnableRetries(0, 0) - - // Construct an instance of the GetOfferingLicenseOptions model - getOfferingLicenseOptionsModel := new(catalogmanagementv1.GetOfferingLicenseOptions) - getOfferingLicenseOptionsModel.VersionLocID = core.StringPtr("testString") - getOfferingLicenseOptionsModel.LicenseID = core.StringPtr("testString") - getOfferingLicenseOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with a Context to test a timeout error - ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) - defer cancelFunc() - _, _, operationErr := catalogManagementService.GetOfferingLicenseWithContext(ctx, getOfferingLicenseOptionsModel) + // Construct an instance of the SuspendVersionOptions model + suspendVersionOptionsModel := new(catalogmanagementv1.SuspendVersionOptions) + suspendVersionOptionsModel.VersionLocID = core.StringPtr("testString") + suspendVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := catalogManagementService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := catalogManagementService.SuspendVersion(suspendVersionOptionsModel) Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - catalogManagementService.DisableRetries() - result, response, operationErr := catalogManagementService.GetOfferingLicense(getOfferingLicenseOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - // Re-test the timeout error with retries disabled - ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) - defer cancelFunc2() - _, _, operationErr = catalogManagementService.GetOfferingLicenseWithContext(ctx, getOfferingLicenseOptionsModel) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the SuspendVersionOptions model with no property values + suspendVersionOptionsModelNew := new(catalogmanagementv1.SuspendVersionOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = catalogManagementService.SuspendVersion(suspendVersionOptionsModelNew) Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + Expect(response).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) + }) + Describe(`CommitVersion(commitVersionOptions *CommitVersionOptions)`, func() { + commitVersionPath := "/versions/testString/commit" Context(`Using mock server endpoint`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getOfferingLicensePath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(commitVersionPath)) + Expect(req.Method).To(Equal("POST")) - // Set mock response - res.Header().Set("Content-type", "text/plain") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `"OperationResponse"`) })) }) - It(`Invoke GetOfferingLicense successfully`, func() { + It(`Invoke CommitVersion successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -8774,25 +15324,21 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := catalogManagementService.GetOfferingLicense(nil) + response, operationErr := catalogManagementService.CommitVersion(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - // Construct an instance of the GetOfferingLicenseOptions model - getOfferingLicenseOptionsModel := new(catalogmanagementv1.GetOfferingLicenseOptions) - getOfferingLicenseOptionsModel.VersionLocID = core.StringPtr("testString") - getOfferingLicenseOptionsModel.LicenseID = core.StringPtr("testString") - getOfferingLicenseOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CommitVersionOptions model + commitVersionOptionsModel := new(catalogmanagementv1.CommitVersionOptions) + commitVersionOptionsModel.VersionLocID = core.StringPtr("testString") + commitVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = catalogManagementService.GetOfferingLicense(getOfferingLicenseOptionsModel) + response, operationErr = catalogManagementService.CommitVersion(commitVersionOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - }) - It(`Invoke GetOfferingLicense with error: Operation validation and request error`, func() { + It(`Invoke CommitVersion with error: Operation validation and request error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -8800,41 +15346,60 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the GetOfferingLicenseOptions model - getOfferingLicenseOptionsModel := new(catalogmanagementv1.GetOfferingLicenseOptions) - getOfferingLicenseOptionsModel.VersionLocID = core.StringPtr("testString") - getOfferingLicenseOptionsModel.LicenseID = core.StringPtr("testString") - getOfferingLicenseOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CommitVersionOptions model + commitVersionOptionsModel := new(catalogmanagementv1.CommitVersionOptions) + commitVersionOptionsModel.VersionLocID = core.StringPtr("testString") + commitVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := catalogManagementService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := catalogManagementService.GetOfferingLicense(getOfferingLicenseOptionsModel) + response, operationErr := catalogManagementService.CommitVersion(commitVersionOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - // Construct a second instance of the GetOfferingLicenseOptions model with no property values - getOfferingLicenseOptionsModelNew := new(catalogmanagementv1.GetOfferingLicenseOptions) + // Construct a second instance of the CommitVersionOptions model with no property values + commitVersionOptionsModelNew := new(catalogmanagementv1.CommitVersionOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = catalogManagementService.GetOfferingLicense(getOfferingLicenseOptionsModelNew) + response, operationErr = catalogManagementService.CommitVersion(commitVersionOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) - Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) - Context(`Using mock server endpoint with missing response body`, func() { + }) + Describe(`CopyVersion(copyVersionOptions *CopyVersionOptions)`, func() { + copyVersionPath := "/versions/testString/copy" + Context(`Using mock server endpoint`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() - // Set success status code with no respoonse body + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(copyVersionPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + res.WriteHeader(200) })) }) - It(`Invoke GetOfferingLicense successfully`, func() { + It(`Invoke CopyVersion successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -8842,41 +15407,94 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the GetOfferingLicenseOptions model - getOfferingLicenseOptionsModel := new(catalogmanagementv1.GetOfferingLicenseOptions) - getOfferingLicenseOptionsModel.VersionLocID = core.StringPtr("testString") - getOfferingLicenseOptionsModel.LicenseID = core.StringPtr("testString") - getOfferingLicenseOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with nil options model (negative test) + response, operationErr := catalogManagementService.CopyVersion(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) - // Invoke operation - result, response, operationErr := catalogManagementService.GetOfferingLicense(getOfferingLicenseOptionsModel) + // Construct an instance of the Flavor model + flavorModel := new(catalogmanagementv1.Flavor) + flavorModel.Name = core.StringPtr("testString") + flavorModel.Label = core.StringPtr("testString") + flavorModel.LabelI18n = make(map[string]string) + flavorModel.Index = core.Int64Ptr(int64(38)) + + // Construct an instance of the CopyVersionOptions model + copyVersionOptionsModel := new(catalogmanagementv1.CopyVersionOptions) + copyVersionOptionsModel.VersionLocID = core.StringPtr("testString") + copyVersionOptionsModel.Tags = []string{"testString"} + copyVersionOptionsModel.Content = CreateMockByteArray("This is a mock byte array value.") + copyVersionOptionsModel.TargetKinds = []string{"testString"} + copyVersionOptionsModel.FormatKind = core.StringPtr("testString") + copyVersionOptionsModel.Flavor = flavorModel + copyVersionOptionsModel.WorkingDirectory = core.StringPtr("testString") + copyVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = catalogManagementService.CopyVersion(copyVersionOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) + }) + It(`Invoke CopyVersion with error: Operation validation and request error`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) - // Verify a nil result - Expect(result).To(BeNil()) + // Construct an instance of the Flavor model + flavorModel := new(catalogmanagementv1.Flavor) + flavorModel.Name = core.StringPtr("testString") + flavorModel.Label = core.StringPtr("testString") + flavorModel.LabelI18n = make(map[string]string) + flavorModel.Index = core.Int64Ptr(int64(38)) + + // Construct an instance of the CopyVersionOptions model + copyVersionOptionsModel := new(catalogmanagementv1.CopyVersionOptions) + copyVersionOptionsModel.VersionLocID = core.StringPtr("testString") + copyVersionOptionsModel.Tags = []string{"testString"} + copyVersionOptionsModel.Content = CreateMockByteArray("This is a mock byte array value.") + copyVersionOptionsModel.TargetKinds = []string{"testString"} + copyVersionOptionsModel.FormatKind = core.StringPtr("testString") + copyVersionOptionsModel.Flavor = flavorModel + copyVersionOptionsModel.WorkingDirectory = core.StringPtr("testString") + copyVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := catalogManagementService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := catalogManagementService.CopyVersion(copyVersionOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the CopyVersionOptions model with no property values + copyVersionOptionsModelNew := new(catalogmanagementv1.CopyVersionOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = catalogManagementService.CopyVersion(copyVersionOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) }) - Describe(`GetOfferingContainerImages(getOfferingContainerImagesOptions *GetOfferingContainerImagesOptions) - Operation response error`, func() { - getOfferingContainerImagesPath := "/versions/testString/containerImages" + Describe(`GetOfferingWorkingCopy(getOfferingWorkingCopyOptions *GetOfferingWorkingCopyOptions) - Operation response error`, func() { + getOfferingWorkingCopyPath := "/versions/testString/workingcopy" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getOfferingContainerImagesPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(getOfferingWorkingCopyPath)) + Expect(req.Method).To(Equal("POST")) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, `} this is not valid json {`) + fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetOfferingContainerImages with error: Operation response processing error`, func() { + It(`Invoke GetOfferingWorkingCopy with error: Operation response processing error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -8884,19 +15502,19 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the GetOfferingContainerImagesOptions model - getOfferingContainerImagesOptionsModel := new(catalogmanagementv1.GetOfferingContainerImagesOptions) - getOfferingContainerImagesOptionsModel.VersionLocID = core.StringPtr("testString") - getOfferingContainerImagesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetOfferingWorkingCopyOptions model + getOfferingWorkingCopyOptionsModel := new(catalogmanagementv1.GetOfferingWorkingCopyOptions) + getOfferingWorkingCopyOptionsModel.VersionLocID = core.StringPtr("testString") + getOfferingWorkingCopyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := catalogManagementService.GetOfferingContainerImages(getOfferingContainerImagesOptionsModel) + result, response, operationErr := catalogManagementService.GetOfferingWorkingCopy(getOfferingWorkingCopyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again catalogManagementService.EnableRetries(0, 0) - result, response, operationErr = catalogManagementService.GetOfferingContainerImages(getOfferingContainerImagesOptionsModel) + result, response, operationErr = catalogManagementService.GetOfferingWorkingCopy(getOfferingWorkingCopyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -8906,16 +15524,16 @@ var _ = Describe(`CatalogManagementV1`, func() { }) }) }) - Describe(`GetOfferingContainerImages(getOfferingContainerImagesOptions *GetOfferingContainerImagesOptions)`, func() { - getOfferingContainerImagesPath := "/versions/testString/containerImages" + Describe(`GetOfferingWorkingCopy(getOfferingWorkingCopyOptions *GetOfferingWorkingCopyOptions)`, func() { + getOfferingWorkingCopyPath := "/versions/testString/workingcopy" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getOfferingContainerImagesPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(getOfferingWorkingCopyPath)) + Expect(req.Method).To(Equal("POST")) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) @@ -8923,10 +15541,10 @@ var _ = Describe(`CatalogManagementV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"description": "Description", "images": [{"image": "Image"}]}`) + fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "crn": "CRN", "version": "Version", "flavor": {"name": "Name", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "index": 5}, "sha": "Sha", "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "offering_id": "OfferingID", "catalog_id": "CatalogID", "kind_id": "KindID", "tags": ["Tags"], "repo_url": "RepoURL", "source_url": "SourceURL", "tgz_url": "TgzURL", "configuration": [{"key": "Key", "type": "Type", "default_value": "anyValue", "display_name": "DisplayName", "value_constraint": "ValueConstraint", "description": "Description", "required": true, "options": ["anyValue"], "hidden": true, "custom_config": {"type": "Type", "grouping": "Grouping", "original_grouping": "OriginalGrouping", "grouping_index": 13, "config_constraints": {"anyKey": "anyValue"}, "associations": {"parameters": [{"name": "Name", "optionsRefresh": true}]}}, "type_metadata": "TypeMetadata"}], "outputs": [{"key": "Key", "description": "Description"}], "iam_permissions": [{"service_name": "ServiceName", "role_crns": ["RoleCrns"], "resources": [{"name": "Name", "description": "Description", "role_crns": ["RoleCrns"]}]}], "metadata": {"mapKey": "anyValue"}, "validation": {"validated": "2019-01-01T12:00:00.000Z", "requested": "2019-01-01T12:00:00.000Z", "state": "State", "last_operation": "LastOperation", "target": {"mapKey": "anyValue"}, "message": "Message"}, "required_resources": [{"type": "mem", "value": "anyValue"}], "single_instance": true, "install": {"instructions": "Instructions", "instructions_i18n": {"mapKey": "Inner"}, "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}, "pre_install": [{"instructions": "Instructions", "instructions_i18n": {"mapKey": "Inner"}, "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}], "entitlement": {"provider_name": "ProviderName", "provider_id": "ProviderID", "product_id": "ProductID", "part_numbers": ["PartNumbers"], "image_repo_name": "ImageRepoName"}, "licenses": [{"id": "ID", "name": "Name", "type": "Type", "url": "URL", "description": "Description"}], "image_manifest_url": "ImageManifestURL", "deprecated": true, "package_version": "PackageVersion", "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "version_locator": "VersionLocator", "long_description": "LongDescription", "long_description_i18n": {"mapKey": "Inner"}, "whitelisted_accounts": ["WhitelistedAccounts"], "image_pull_key_name": "ImagePullKeyName", "deprecate_pending": {"deprecate_date": "2019-01-01T12:00:00.000Z", "deprecate_state": "DeprecateState", "description": "Description"}, "solution_info": {"architecture_diagrams": [{"diagram": {"url": "URL", "api_url": "APIURL", "url_proxy": {"url": "URL", "sha": "Sha"}, "caption": "Caption", "caption_i18n": {"mapKey": "Inner"}, "type": "Type", "thumbnail_url": "ThumbnailURL"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "cost_estimate": {"version": "Version", "currency": "Currency", "projects": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "pastBreakdown": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "breakdown": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "diff": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "summary": {"totalDetectedResources": 22, "totalSupportedResources": 23, "totalUnsupportedResources": 25, "totalUsageBasedResources": 24, "totalNoPriceResources": 21, "unsupportedResourceCounts": {"mapKey": 5}, "noPriceResourceCounts": {"mapKey": 5}}}], "summary": {"totalDetectedResources": 22, "totalSupportedResources": 23, "totalUnsupportedResources": 25, "totalUsageBasedResources": 24, "totalNoPriceResources": 21, "unsupportedResourceCounts": {"mapKey": 5}, "noPriceResourceCounts": {"mapKey": 5}}, "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z"}, "dependencies": [{"catalog_id": "CatalogID", "id": "ID", "name": "Name", "version": "Version", "flavors": ["Flavors"]}]}, "is_consumable": true}`) })) }) - It(`Invoke GetOfferingContainerImages successfully with retries`, func() { + It(`Invoke GetOfferingWorkingCopy successfully with retries`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -8935,21 +15553,21 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) catalogManagementService.EnableRetries(0, 0) - // Construct an instance of the GetOfferingContainerImagesOptions model - getOfferingContainerImagesOptionsModel := new(catalogmanagementv1.GetOfferingContainerImagesOptions) - getOfferingContainerImagesOptionsModel.VersionLocID = core.StringPtr("testString") - getOfferingContainerImagesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetOfferingWorkingCopyOptions model + getOfferingWorkingCopyOptionsModel := new(catalogmanagementv1.GetOfferingWorkingCopyOptions) + getOfferingWorkingCopyOptionsModel.VersionLocID = core.StringPtr("testString") + getOfferingWorkingCopyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := catalogManagementService.GetOfferingContainerImagesWithContext(ctx, getOfferingContainerImagesOptionsModel) + _, _, operationErr := catalogManagementService.GetOfferingWorkingCopyWithContext(ctx, getOfferingWorkingCopyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again catalogManagementService.DisableRetries() - result, response, operationErr := catalogManagementService.GetOfferingContainerImages(getOfferingContainerImagesOptionsModel) + result, response, operationErr := catalogManagementService.GetOfferingWorkingCopy(getOfferingWorkingCopyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -8957,7 +15575,7 @@ var _ = Describe(`CatalogManagementV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = catalogManagementService.GetOfferingContainerImagesWithContext(ctx, getOfferingContainerImagesOptionsModel) + _, _, operationErr = catalogManagementService.GetOfferingWorkingCopyWithContext(ctx, getOfferingWorkingCopyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -8971,16 +15589,16 @@ var _ = Describe(`CatalogManagementV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getOfferingContainerImagesPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(getOfferingWorkingCopyPath)) + Expect(req.Method).To(Equal("POST")) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"description": "Description", "images": [{"image": "Image"}]}`) + fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "crn": "CRN", "version": "Version", "flavor": {"name": "Name", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "index": 5}, "sha": "Sha", "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "offering_id": "OfferingID", "catalog_id": "CatalogID", "kind_id": "KindID", "tags": ["Tags"], "repo_url": "RepoURL", "source_url": "SourceURL", "tgz_url": "TgzURL", "configuration": [{"key": "Key", "type": "Type", "default_value": "anyValue", "display_name": "DisplayName", "value_constraint": "ValueConstraint", "description": "Description", "required": true, "options": ["anyValue"], "hidden": true, "custom_config": {"type": "Type", "grouping": "Grouping", "original_grouping": "OriginalGrouping", "grouping_index": 13, "config_constraints": {"anyKey": "anyValue"}, "associations": {"parameters": [{"name": "Name", "optionsRefresh": true}]}}, "type_metadata": "TypeMetadata"}], "outputs": [{"key": "Key", "description": "Description"}], "iam_permissions": [{"service_name": "ServiceName", "role_crns": ["RoleCrns"], "resources": [{"name": "Name", "description": "Description", "role_crns": ["RoleCrns"]}]}], "metadata": {"mapKey": "anyValue"}, "validation": {"validated": "2019-01-01T12:00:00.000Z", "requested": "2019-01-01T12:00:00.000Z", "state": "State", "last_operation": "LastOperation", "target": {"mapKey": "anyValue"}, "message": "Message"}, "required_resources": [{"type": "mem", "value": "anyValue"}], "single_instance": true, "install": {"instructions": "Instructions", "instructions_i18n": {"mapKey": "Inner"}, "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}, "pre_install": [{"instructions": "Instructions", "instructions_i18n": {"mapKey": "Inner"}, "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}], "entitlement": {"provider_name": "ProviderName", "provider_id": "ProviderID", "product_id": "ProductID", "part_numbers": ["PartNumbers"], "image_repo_name": "ImageRepoName"}, "licenses": [{"id": "ID", "name": "Name", "type": "Type", "url": "URL", "description": "Description"}], "image_manifest_url": "ImageManifestURL", "deprecated": true, "package_version": "PackageVersion", "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "version_locator": "VersionLocator", "long_description": "LongDescription", "long_description_i18n": {"mapKey": "Inner"}, "whitelisted_accounts": ["WhitelistedAccounts"], "image_pull_key_name": "ImagePullKeyName", "deprecate_pending": {"deprecate_date": "2019-01-01T12:00:00.000Z", "deprecate_state": "DeprecateState", "description": "Description"}, "solution_info": {"architecture_diagrams": [{"diagram": {"url": "URL", "api_url": "APIURL", "url_proxy": {"url": "URL", "sha": "Sha"}, "caption": "Caption", "caption_i18n": {"mapKey": "Inner"}, "type": "Type", "thumbnail_url": "ThumbnailURL"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "cost_estimate": {"version": "Version", "currency": "Currency", "projects": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "pastBreakdown": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "breakdown": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "diff": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "summary": {"totalDetectedResources": 22, "totalSupportedResources": 23, "totalUnsupportedResources": 25, "totalUsageBasedResources": 24, "totalNoPriceResources": 21, "unsupportedResourceCounts": {"mapKey": 5}, "noPriceResourceCounts": {"mapKey": 5}}}], "summary": {"totalDetectedResources": 22, "totalSupportedResources": 23, "totalUnsupportedResources": 25, "totalUsageBasedResources": 24, "totalNoPriceResources": 21, "unsupportedResourceCounts": {"mapKey": 5}, "noPriceResourceCounts": {"mapKey": 5}}, "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z"}, "dependencies": [{"catalog_id": "CatalogID", "id": "ID", "name": "Name", "version": "Version", "flavors": ["Flavors"]}]}, "is_consumable": true}`) })) }) - It(`Invoke GetOfferingContainerImages successfully`, func() { + It(`Invoke GetOfferingWorkingCopy successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -8989,24 +15607,24 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := catalogManagementService.GetOfferingContainerImages(nil) + result, response, operationErr := catalogManagementService.GetOfferingWorkingCopy(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetOfferingContainerImagesOptions model - getOfferingContainerImagesOptionsModel := new(catalogmanagementv1.GetOfferingContainerImagesOptions) - getOfferingContainerImagesOptionsModel.VersionLocID = core.StringPtr("testString") - getOfferingContainerImagesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetOfferingWorkingCopyOptions model + getOfferingWorkingCopyOptionsModel := new(catalogmanagementv1.GetOfferingWorkingCopyOptions) + getOfferingWorkingCopyOptionsModel.VersionLocID = core.StringPtr("testString") + getOfferingWorkingCopyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = catalogManagementService.GetOfferingContainerImages(getOfferingContainerImagesOptionsModel) + result, response, operationErr = catalogManagementService.GetOfferingWorkingCopy(getOfferingWorkingCopyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetOfferingContainerImages with error: Operation validation and request error`, func() { + It(`Invoke GetOfferingWorkingCopy with error: Operation validation and request error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -9014,22 +15632,22 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the GetOfferingContainerImagesOptions model - getOfferingContainerImagesOptionsModel := new(catalogmanagementv1.GetOfferingContainerImagesOptions) - getOfferingContainerImagesOptionsModel.VersionLocID = core.StringPtr("testString") - getOfferingContainerImagesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetOfferingWorkingCopyOptions model + getOfferingWorkingCopyOptionsModel := new(catalogmanagementv1.GetOfferingWorkingCopyOptions) + getOfferingWorkingCopyOptionsModel.VersionLocID = core.StringPtr("testString") + getOfferingWorkingCopyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := catalogManagementService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := catalogManagementService.GetOfferingContainerImages(getOfferingContainerImagesOptionsModel) + result, response, operationErr := catalogManagementService.GetOfferingWorkingCopy(getOfferingWorkingCopyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetOfferingContainerImagesOptions model with no property values - getOfferingContainerImagesOptionsModelNew := new(catalogmanagementv1.GetOfferingContainerImagesOptions) + // Construct a second instance of the GetOfferingWorkingCopyOptions model with no property values + getOfferingWorkingCopyOptionsModelNew := new(catalogmanagementv1.GetOfferingWorkingCopyOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = catalogManagementService.GetOfferingContainerImages(getOfferingContainerImagesOptionsModelNew) + result, response, operationErr = catalogManagementService.GetOfferingWorkingCopy(getOfferingWorkingCopyOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -9047,7 +15665,7 @@ var _ = Describe(`CatalogManagementV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetOfferingContainerImages successfully`, func() { + It(`Invoke GetOfferingWorkingCopy successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -9055,197 +15673,39 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the GetOfferingContainerImagesOptions model - getOfferingContainerImagesOptionsModel := new(catalogmanagementv1.GetOfferingContainerImagesOptions) - getOfferingContainerImagesOptionsModel.VersionLocID = core.StringPtr("testString") - getOfferingContainerImagesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetOfferingWorkingCopyOptions model + getOfferingWorkingCopyOptionsModel := new(catalogmanagementv1.GetOfferingWorkingCopyOptions) + getOfferingWorkingCopyOptionsModel.VersionLocID = core.StringPtr("testString") + getOfferingWorkingCopyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := catalogManagementService.GetOfferingContainerImages(getOfferingContainerImagesOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`DeprecateVersion(deprecateVersionOptions *DeprecateVersionOptions)`, func() { - deprecateVersionPath := "/versions/testString/deprecate" - Context(`Using mock server endpoint`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deprecateVersionPath)) - Expect(req.Method).To(Equal("POST")) - - res.WriteHeader(202) - })) - }) - It(`Invoke DeprecateVersion successfully`, func() { - catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(catalogManagementService).ToNot(BeNil()) - - // Invoke operation with nil options model (negative test) - response, operationErr := catalogManagementService.DeprecateVersion(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeprecateVersionOptions model - deprecateVersionOptionsModel := new(catalogmanagementv1.DeprecateVersionOptions) - deprecateVersionOptionsModel.VersionLocID = core.StringPtr("testString") - deprecateVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = catalogManagementService.DeprecateVersion(deprecateVersionOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeprecateVersion with error: Operation validation and request error`, func() { - catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(catalogManagementService).ToNot(BeNil()) - - // Construct an instance of the DeprecateVersionOptions model - deprecateVersionOptionsModel := new(catalogmanagementv1.DeprecateVersionOptions) - deprecateVersionOptionsModel.VersionLocID = core.StringPtr("testString") - deprecateVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := catalogManagementService.SetServiceURL("") - Expect(err).To(BeNil()) - response, operationErr := catalogManagementService.DeprecateVersion(deprecateVersionOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeprecateVersionOptions model with no property values - deprecateVersionOptionsModelNew := new(catalogmanagementv1.DeprecateVersionOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = catalogManagementService.DeprecateVersion(deprecateVersionOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`SetDeprecateVersion(setDeprecateVersionOptions *SetDeprecateVersionOptions)`, func() { - setDeprecateVersionPath := "/versions/testString/deprecate/true" - Context(`Using mock server endpoint`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(setDeprecateVersionPath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) - - res.WriteHeader(202) - })) - }) - It(`Invoke SetDeprecateVersion successfully`, func() { - catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(catalogManagementService).ToNot(BeNil()) - - // Invoke operation with nil options model (negative test) - response, operationErr := catalogManagementService.SetDeprecateVersion(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the SetDeprecateVersionOptions model - setDeprecateVersionOptionsModel := new(catalogmanagementv1.SetDeprecateVersionOptions) - setDeprecateVersionOptionsModel.VersionLocID = core.StringPtr("testString") - setDeprecateVersionOptionsModel.Setting = core.StringPtr("true") - setDeprecateVersionOptionsModel.Description = core.StringPtr("testString") - setDeprecateVersionOptionsModel.DaysUntilDeprecate = core.Int64Ptr(int64(38)) - setDeprecateVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = catalogManagementService.SetDeprecateVersion(setDeprecateVersionOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke SetDeprecateVersion with error: Operation validation and request error`, func() { - catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(catalogManagementService).ToNot(BeNil()) - - // Construct an instance of the SetDeprecateVersionOptions model - setDeprecateVersionOptionsModel := new(catalogmanagementv1.SetDeprecateVersionOptions) - setDeprecateVersionOptionsModel.VersionLocID = core.StringPtr("testString") - setDeprecateVersionOptionsModel.Setting = core.StringPtr("true") - setDeprecateVersionOptionsModel.Description = core.StringPtr("testString") - setDeprecateVersionOptionsModel.DaysUntilDeprecate = core.Int64Ptr(int64(38)) - setDeprecateVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := catalogManagementService.SetServiceURL("") - Expect(err).To(BeNil()) - response, operationErr := catalogManagementService.SetDeprecateVersion(setDeprecateVersionOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the SetDeprecateVersionOptions model with no property values - setDeprecateVersionOptionsModelNew := new(catalogmanagementv1.SetDeprecateVersionOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = catalogManagementService.SetDeprecateVersion(setDeprecateVersionOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) + result, response, operationErr := catalogManagementService.GetOfferingWorkingCopy(getOfferingWorkingCopyOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) }) - Describe(`AccountPublishVersion(accountPublishVersionOptions *AccountPublishVersionOptions)`, func() { - accountPublishVersionPath := "/versions/testString/account-publish" + Describe(`CopyFromPreviousVersion(copyFromPreviousVersionOptions *CopyFromPreviousVersionOptions)`, func() { + copyFromPreviousVersionPath := "/versions/testString/copy/testString/testString" Context(`Using mock server endpoint`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(accountPublishVersionPath)) + Expect(req.URL.EscapedPath()).To(Equal(copyFromPreviousVersionPath)) Expect(req.Method).To(Equal("POST")) - res.WriteHeader(202) + res.WriteHeader(200) })) }) - It(`Invoke AccountPublishVersion successfully`, func() { + It(`Invoke CopyFromPreviousVersion successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -9254,21 +15714,23 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - response, operationErr := catalogManagementService.AccountPublishVersion(nil) + response, operationErr := catalogManagementService.CopyFromPreviousVersion(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) - // Construct an instance of the AccountPublishVersionOptions model - accountPublishVersionOptionsModel := new(catalogmanagementv1.AccountPublishVersionOptions) - accountPublishVersionOptionsModel.VersionLocID = core.StringPtr("testString") - accountPublishVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CopyFromPreviousVersionOptions model + copyFromPreviousVersionOptionsModel := new(catalogmanagementv1.CopyFromPreviousVersionOptions) + copyFromPreviousVersionOptionsModel.VersionLocID = core.StringPtr("testString") + copyFromPreviousVersionOptionsModel.Type = core.StringPtr("testString") + copyFromPreviousVersionOptionsModel.VersionLocIDToCopyFrom = core.StringPtr("testString") + copyFromPreviousVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - response, operationErr = catalogManagementService.AccountPublishVersion(accountPublishVersionOptionsModel) + response, operationErr = catalogManagementService.CopyFromPreviousVersion(copyFromPreviousVersionOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) }) - It(`Invoke AccountPublishVersion with error: Operation validation and request error`, func() { + It(`Invoke CopyFromPreviousVersion with error: Operation validation and request error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -9276,21 +15738,23 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the AccountPublishVersionOptions model - accountPublishVersionOptionsModel := new(catalogmanagementv1.AccountPublishVersionOptions) - accountPublishVersionOptionsModel.VersionLocID = core.StringPtr("testString") - accountPublishVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CopyFromPreviousVersionOptions model + copyFromPreviousVersionOptionsModel := new(catalogmanagementv1.CopyFromPreviousVersionOptions) + copyFromPreviousVersionOptionsModel.VersionLocID = core.StringPtr("testString") + copyFromPreviousVersionOptionsModel.Type = core.StringPtr("testString") + copyFromPreviousVersionOptionsModel.VersionLocIDToCopyFrom = core.StringPtr("testString") + copyFromPreviousVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := catalogManagementService.SetServiceURL("") Expect(err).To(BeNil()) - response, operationErr := catalogManagementService.AccountPublishVersion(accountPublishVersionOptionsModel) + response, operationErr := catalogManagementService.CopyFromPreviousVersion(copyFromPreviousVersionOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) - // Construct a second instance of the AccountPublishVersionOptions model with no property values - accountPublishVersionOptionsModelNew := new(catalogmanagementv1.AccountPublishVersionOptions) + // Construct a second instance of the CopyFromPreviousVersionOptions model with no property values + copyFromPreviousVersionOptionsModelNew := new(catalogmanagementv1.CopyFromPreviousVersionOptions) // Invoke operation with invalid model (negative test) - response, operationErr = catalogManagementService.AccountPublishVersion(accountPublishVersionOptionsModelNew) + response, operationErr = catalogManagementService.CopyFromPreviousVersion(copyFromPreviousVersionOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) }) @@ -9299,21 +15763,22 @@ var _ = Describe(`CatalogManagementV1`, func() { }) }) }) - Describe(`IBMPublishVersion(ibmPublishVersionOptions *IBMPublishVersionOptions)`, func() { - ibmPublishVersionPath := "/versions/testString/ibm-publish" - Context(`Using mock server endpoint`, func() { + Describe(`GetVersion(getVersionOptions *GetVersionOptions) - Operation response error`, func() { + getVersionPath := "/versions/testString" + Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(ibmPublishVersionPath)) - Expect(req.Method).To(Equal("POST")) - - res.WriteHeader(202) + Expect(req.URL.EscapedPath()).To(Equal(getVersionPath)) + Expect(req.Method).To(Equal("GET")) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke IBMPublishVersion successfully`, func() { + It(`Invoke GetVersion with error: Operation response processing error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -9321,67 +15786,103 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Invoke operation with nil options model (negative test) - response, operationErr := catalogManagementService.IBMPublishVersion(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the IBMPublishVersionOptions model - ibmPublishVersionOptionsModel := new(catalogmanagementv1.IBMPublishVersionOptions) - ibmPublishVersionOptionsModel.VersionLocID = core.StringPtr("testString") - ibmPublishVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetVersionOptions model + getVersionOptionsModel := new(catalogmanagementv1.GetVersionOptions) + getVersionOptionsModel.VersionLocID = core.StringPtr("testString") + getVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := catalogManagementService.GetVersion(getVersionOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) - // Invoke operation with valid options model (positive test) - response, operationErr = catalogManagementService.IBMPublishVersion(ibmPublishVersionOptionsModel) - Expect(operationErr).To(BeNil()) + // Enable retries and test again + catalogManagementService.EnableRetries(0, 0) + result, response, operationErr = catalogManagementService.GetVersion(getVersionOptionsModel) + Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) }) - It(`Invoke IBMPublishVersion with error: Operation validation and request error`, func() { + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetVersion(getVersionOptions *GetVersionOptions)`, func() { + getVersionPath := "/versions/testString" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getVersionPath)) + Expect(req.Method).To(Equal("GET")) + + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "url": "URL", "crn": "CRN", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "name": "Name", "offering_icon_url": "OfferingIconURL", "offering_docs_url": "OfferingDocsURL", "offering_support_url": "OfferingSupportURL", "tags": ["Tags"], "keywords": ["Keywords"], "rating": {"one_star_count": 12, "two_star_count": 12, "three_star_count": 14, "four_star_count": 13}, "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "short_description": "ShortDescription", "short_description_i18n": {"mapKey": "Inner"}, "long_description": "LongDescription", "long_description_i18n": {"mapKey": "Inner"}, "features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "kinds": [{"id": "ID", "format_kind": "FormatKind", "install_kind": "InstallKind", "target_kind": "TargetKind", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "additional_features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "versions": [{"id": "ID", "_rev": "Rev", "crn": "CRN", "version": "Version", "flavor": {"name": "Name", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "index": 5}, "sha": "Sha", "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "offering_id": "OfferingID", "catalog_id": "CatalogID", "kind_id": "KindID", "tags": ["Tags"], "repo_url": "RepoURL", "source_url": "SourceURL", "tgz_url": "TgzURL", "configuration": [{"key": "Key", "type": "Type", "default_value": "anyValue", "display_name": "DisplayName", "value_constraint": "ValueConstraint", "description": "Description", "required": true, "options": ["anyValue"], "hidden": true, "custom_config": {"type": "Type", "grouping": "Grouping", "original_grouping": "OriginalGrouping", "grouping_index": 13, "config_constraints": {"anyKey": "anyValue"}, "associations": {"parameters": [{"name": "Name", "optionsRefresh": true}]}}, "type_metadata": "TypeMetadata"}], "outputs": [{"key": "Key", "description": "Description"}], "iam_permissions": [{"service_name": "ServiceName", "role_crns": ["RoleCrns"], "resources": [{"name": "Name", "description": "Description", "role_crns": ["RoleCrns"]}]}], "metadata": {"mapKey": "anyValue"}, "validation": {"validated": "2019-01-01T12:00:00.000Z", "requested": "2019-01-01T12:00:00.000Z", "state": "State", "last_operation": "LastOperation", "target": {"mapKey": "anyValue"}, "message": "Message"}, "required_resources": [{"type": "mem", "value": "anyValue"}], "single_instance": true, "install": {"instructions": "Instructions", "instructions_i18n": {"mapKey": "Inner"}, "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}, "pre_install": [{"instructions": "Instructions", "instructions_i18n": {"mapKey": "Inner"}, "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}], "entitlement": {"provider_name": "ProviderName", "provider_id": "ProviderID", "product_id": "ProductID", "part_numbers": ["PartNumbers"], "image_repo_name": "ImageRepoName"}, "licenses": [{"id": "ID", "name": "Name", "type": "Type", "url": "URL", "description": "Description"}], "image_manifest_url": "ImageManifestURL", "deprecated": true, "package_version": "PackageVersion", "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "version_locator": "VersionLocator", "long_description": "LongDescription", "long_description_i18n": {"mapKey": "Inner"}, "whitelisted_accounts": ["WhitelistedAccounts"], "image_pull_key_name": "ImagePullKeyName", "deprecate_pending": {"deprecate_date": "2019-01-01T12:00:00.000Z", "deprecate_state": "DeprecateState", "description": "Description"}, "solution_info": {"architecture_diagrams": [{"diagram": {"url": "URL", "api_url": "APIURL", "url_proxy": {"url": "URL", "sha": "Sha"}, "caption": "Caption", "caption_i18n": {"mapKey": "Inner"}, "type": "Type", "thumbnail_url": "ThumbnailURL"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "cost_estimate": {"version": "Version", "currency": "Currency", "projects": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "pastBreakdown": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "breakdown": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "diff": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "summary": {"totalDetectedResources": 22, "totalSupportedResources": 23, "totalUnsupportedResources": 25, "totalUsageBasedResources": 24, "totalNoPriceResources": 21, "unsupportedResourceCounts": {"mapKey": 5}, "noPriceResourceCounts": {"mapKey": 5}}}], "summary": {"totalDetectedResources": 22, "totalSupportedResources": 23, "totalUnsupportedResources": 25, "totalUsageBasedResources": 24, "totalNoPriceResources": 21, "unsupportedResourceCounts": {"mapKey": 5}, "noPriceResourceCounts": {"mapKey": 5}}, "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z"}, "dependencies": [{"catalog_id": "CatalogID", "id": "ID", "name": "Name", "version": "Version", "flavors": ["Flavors"]}]}, "is_consumable": true}], "plans": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "additional_features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "deployments": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z"}]}]}], "pc_managed": false, "publish_approved": false, "share_with_all": true, "share_with_ibm": true, "share_enabled": true, "permit_request_ibm_public_publish": false, "ibm_publish_approved": true, "public_publish_approved": false, "public_original_crn": "PublicOriginalCRN", "publish_public_crn": "PublishPublicCRN", "portal_approval_record": "PortalApprovalRecord", "portal_ui_url": "PortalUIURL", "catalog_id": "CatalogID", "catalog_name": "CatalogName", "metadata": {"mapKey": "anyValue"}, "disclaimer": "Disclaimer", "hidden": true, "provider": "Provider", "provider_info": {"id": "ID", "name": "Name"}, "repo_info": {"token": "Token", "type": "Type"}, "image_pull_keys": [{"name": "Name", "value": "Value", "description": "Description"}], "support": {"url": "URL", "process": "Process", "process_i18n": {"mapKey": "Inner"}, "locations": ["Locations"], "support_details": [{"type": "Type", "contact": "Contact", "response_wait_time": {"value": 5, "type": "Type"}, "availability": {"times": [{"day": 3, "start_time": "StartTime", "end_time": "EndTime"}], "timezone": "Timezone", "always_available": false}}], "support_escalation": {"escalation_wait_time": {"value": 5, "type": "Type"}, "response_wait_time": {"value": 5, "type": "Type"}, "contact": "Contact"}, "support_type": "SupportType"}, "media": [{"url": "URL", "api_url": "APIURL", "url_proxy": {"url": "URL", "sha": "Sha"}, "caption": "Caption", "caption_i18n": {"mapKey": "Inner"}, "type": "Type", "thumbnail_url": "ThumbnailURL"}], "deprecate_pending": {"deprecate_date": "2019-01-01T12:00:00.000Z", "deprecate_state": "DeprecateState", "description": "Description"}, "product_kind": "ProductKind", "badges": [{"id": "ID", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}, "icon": "Icon", "authority": "Authority", "tag": "Tag", "learn_more_links": {"first_party": "FirstParty", "third_party": "ThirdParty"}, "constraints": [{"type": "Type", "rule": "anyValue"}]}]}`) + })) + }) + It(`Invoke GetVersion successfully with retries`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) + catalogManagementService.EnableRetries(0, 0) - // Construct an instance of the IBMPublishVersionOptions model - ibmPublishVersionOptionsModel := new(catalogmanagementv1.IBMPublishVersionOptions) - ibmPublishVersionOptionsModel.VersionLocID = core.StringPtr("testString") - ibmPublishVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := catalogManagementService.SetServiceURL("") - Expect(err).To(BeNil()) - response, operationErr := catalogManagementService.IBMPublishVersion(ibmPublishVersionOptionsModel) + // Construct an instance of the GetVersionOptions model + getVersionOptionsModel := new(catalogmanagementv1.GetVersionOptions) + getVersionOptionsModel.VersionLocID = core.StringPtr("testString") + getVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := catalogManagementService.GetVersionWithContext(ctx, getVersionOptionsModel) Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the IBMPublishVersionOptions model with no property values - ibmPublishVersionOptionsModelNew := new(catalogmanagementv1.IBMPublishVersionOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = catalogManagementService.IBMPublishVersion(ibmPublishVersionOptionsModelNew) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + catalogManagementService.DisableRetries() + result, response, operationErr := catalogManagementService.GetVersion(getVersionOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = catalogManagementService.GetVersionWithContext(ctx, getVersionOptionsModel) Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) AfterEach(func() { testServer.Close() }) }) - }) - Describe(`PublicPublishVersion(publicPublishVersionOptions *PublicPublishVersionOptions)`, func() { - publicPublishVersionPath := "/versions/testString/public-publish" Context(`Using mock server endpoint`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(publicPublishVersionPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(getVersionPath)) + Expect(req.Method).To(Equal("GET")) - res.WriteHeader(202) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "url": "URL", "crn": "CRN", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "name": "Name", "offering_icon_url": "OfferingIconURL", "offering_docs_url": "OfferingDocsURL", "offering_support_url": "OfferingSupportURL", "tags": ["Tags"], "keywords": ["Keywords"], "rating": {"one_star_count": 12, "two_star_count": 12, "three_star_count": 14, "four_star_count": 13}, "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "short_description": "ShortDescription", "short_description_i18n": {"mapKey": "Inner"}, "long_description": "LongDescription", "long_description_i18n": {"mapKey": "Inner"}, "features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "kinds": [{"id": "ID", "format_kind": "FormatKind", "install_kind": "InstallKind", "target_kind": "TargetKind", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "additional_features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "versions": [{"id": "ID", "_rev": "Rev", "crn": "CRN", "version": "Version", "flavor": {"name": "Name", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "index": 5}, "sha": "Sha", "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "offering_id": "OfferingID", "catalog_id": "CatalogID", "kind_id": "KindID", "tags": ["Tags"], "repo_url": "RepoURL", "source_url": "SourceURL", "tgz_url": "TgzURL", "configuration": [{"key": "Key", "type": "Type", "default_value": "anyValue", "display_name": "DisplayName", "value_constraint": "ValueConstraint", "description": "Description", "required": true, "options": ["anyValue"], "hidden": true, "custom_config": {"type": "Type", "grouping": "Grouping", "original_grouping": "OriginalGrouping", "grouping_index": 13, "config_constraints": {"anyKey": "anyValue"}, "associations": {"parameters": [{"name": "Name", "optionsRefresh": true}]}}, "type_metadata": "TypeMetadata"}], "outputs": [{"key": "Key", "description": "Description"}], "iam_permissions": [{"service_name": "ServiceName", "role_crns": ["RoleCrns"], "resources": [{"name": "Name", "description": "Description", "role_crns": ["RoleCrns"]}]}], "metadata": {"mapKey": "anyValue"}, "validation": {"validated": "2019-01-01T12:00:00.000Z", "requested": "2019-01-01T12:00:00.000Z", "state": "State", "last_operation": "LastOperation", "target": {"mapKey": "anyValue"}, "message": "Message"}, "required_resources": [{"type": "mem", "value": "anyValue"}], "single_instance": true, "install": {"instructions": "Instructions", "instructions_i18n": {"mapKey": "Inner"}, "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}, "pre_install": [{"instructions": "Instructions", "instructions_i18n": {"mapKey": "Inner"}, "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}], "entitlement": {"provider_name": "ProviderName", "provider_id": "ProviderID", "product_id": "ProductID", "part_numbers": ["PartNumbers"], "image_repo_name": "ImageRepoName"}, "licenses": [{"id": "ID", "name": "Name", "type": "Type", "url": "URL", "description": "Description"}], "image_manifest_url": "ImageManifestURL", "deprecated": true, "package_version": "PackageVersion", "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "version_locator": "VersionLocator", "long_description": "LongDescription", "long_description_i18n": {"mapKey": "Inner"}, "whitelisted_accounts": ["WhitelistedAccounts"], "image_pull_key_name": "ImagePullKeyName", "deprecate_pending": {"deprecate_date": "2019-01-01T12:00:00.000Z", "deprecate_state": "DeprecateState", "description": "Description"}, "solution_info": {"architecture_diagrams": [{"diagram": {"url": "URL", "api_url": "APIURL", "url_proxy": {"url": "URL", "sha": "Sha"}, "caption": "Caption", "caption_i18n": {"mapKey": "Inner"}, "type": "Type", "thumbnail_url": "ThumbnailURL"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "cost_estimate": {"version": "Version", "currency": "Currency", "projects": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "pastBreakdown": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "breakdown": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "diff": {"totalHourlyCost": "TotalHourlyCost", "totalMonthlyCOst": "TotalMonthlyCOst", "resources": [{"name": "Name", "metadata": {"mapKey": "anyValue"}, "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost", "costComponents": [{"name": "Name", "unit": "Unit", "hourlyQuantity": "HourlyQuantity", "monthlyQuantity": "MonthlyQuantity", "price": "Price", "hourlyCost": "HourlyCost", "monthlyCost": "MonthlyCost"}]}]}, "summary": {"totalDetectedResources": 22, "totalSupportedResources": 23, "totalUnsupportedResources": 25, "totalUsageBasedResources": 24, "totalNoPriceResources": 21, "unsupportedResourceCounts": {"mapKey": 5}, "noPriceResourceCounts": {"mapKey": 5}}}], "summary": {"totalDetectedResources": 22, "totalSupportedResources": 23, "totalUnsupportedResources": 25, "totalUsageBasedResources": 24, "totalNoPriceResources": 21, "unsupportedResourceCounts": {"mapKey": 5}, "noPriceResourceCounts": {"mapKey": 5}}, "totalHourlyCost": "TotalHourlyCost", "totalMonthlyCost": "TotalMonthlyCost", "pastTotalHourlyCost": "PastTotalHourlyCost", "pastTotalMonthlyCost": "PastTotalMonthlyCost", "diffTotalHourlyCost": "DiffTotalHourlyCost", "diffTotalMonthlyCost": "DiffTotalMonthlyCost", "timeGenerated": "2019-01-01T12:00:00.000Z"}, "dependencies": [{"catalog_id": "CatalogID", "id": "ID", "name": "Name", "version": "Version", "flavors": ["Flavors"]}]}, "is_consumable": true}], "plans": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "additional_features": [{"title": "Title", "title_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "deployments": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z"}]}]}], "pc_managed": false, "publish_approved": false, "share_with_all": true, "share_with_ibm": true, "share_enabled": true, "permit_request_ibm_public_publish": false, "ibm_publish_approved": true, "public_publish_approved": false, "public_original_crn": "PublicOriginalCRN", "publish_public_crn": "PublishPublicCRN", "portal_approval_record": "PortalApprovalRecord", "portal_ui_url": "PortalUIURL", "catalog_id": "CatalogID", "catalog_name": "CatalogName", "metadata": {"mapKey": "anyValue"}, "disclaimer": "Disclaimer", "hidden": true, "provider": "Provider", "provider_info": {"id": "ID", "name": "Name"}, "repo_info": {"token": "Token", "type": "Type"}, "image_pull_keys": [{"name": "Name", "value": "Value", "description": "Description"}], "support": {"url": "URL", "process": "Process", "process_i18n": {"mapKey": "Inner"}, "locations": ["Locations"], "support_details": [{"type": "Type", "contact": "Contact", "response_wait_time": {"value": 5, "type": "Type"}, "availability": {"times": [{"day": 3, "start_time": "StartTime", "end_time": "EndTime"}], "timezone": "Timezone", "always_available": false}}], "support_escalation": {"escalation_wait_time": {"value": 5, "type": "Type"}, "response_wait_time": {"value": 5, "type": "Type"}, "contact": "Contact"}, "support_type": "SupportType"}, "media": [{"url": "URL", "api_url": "APIURL", "url_proxy": {"url": "URL", "sha": "Sha"}, "caption": "Caption", "caption_i18n": {"mapKey": "Inner"}, "type": "Type", "thumbnail_url": "ThumbnailURL"}], "deprecate_pending": {"deprecate_date": "2019-01-01T12:00:00.000Z", "deprecate_state": "DeprecateState", "description": "Description"}, "product_kind": "ProductKind", "badges": [{"id": "ID", "label": "Label", "label_i18n": {"mapKey": "Inner"}, "description": "Description", "description_i18n": {"mapKey": "Inner"}, "icon": "Icon", "authority": "Authority", "tag": "Tag", "learn_more_links": {"first_party": "FirstParty", "third_party": "ThirdParty"}, "constraints": [{"type": "Type", "rule": "anyValue"}]}]}`) })) }) - It(`Invoke PublicPublishVersion successfully`, func() { + It(`Invoke GetVersion successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -9390,21 +15891,24 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - response, operationErr := catalogManagementService.PublicPublishVersion(nil) + result, response, operationErr := catalogManagementService.GetVersion(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) + Expect(result).To(BeNil()) - // Construct an instance of the PublicPublishVersionOptions model - publicPublishVersionOptionsModel := new(catalogmanagementv1.PublicPublishVersionOptions) - publicPublishVersionOptionsModel.VersionLocID = core.StringPtr("testString") - publicPublishVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetVersionOptions model + getVersionOptionsModel := new(catalogmanagementv1.GetVersionOptions) + getVersionOptionsModel.VersionLocID = core.StringPtr("testString") + getVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - response, operationErr = catalogManagementService.PublicPublishVersion(publicPublishVersionOptionsModel) + result, response, operationErr = catalogManagementService.GetVersion(getVersionOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + }) - It(`Invoke PublicPublishVersion with error: Operation validation and request error`, func() { + It(`Invoke GetVersion with error: Operation validation and request error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -9412,44 +15916,80 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the PublicPublishVersionOptions model - publicPublishVersionOptionsModel := new(catalogmanagementv1.PublicPublishVersionOptions) - publicPublishVersionOptionsModel.VersionLocID = core.StringPtr("testString") - publicPublishVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetVersionOptions model + getVersionOptionsModel := new(catalogmanagementv1.GetVersionOptions) + getVersionOptionsModel.VersionLocID = core.StringPtr("testString") + getVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := catalogManagementService.SetServiceURL("") Expect(err).To(BeNil()) - response, operationErr := catalogManagementService.PublicPublishVersion(publicPublishVersionOptionsModel) + result, response, operationErr := catalogManagementService.GetVersion(getVersionOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) - // Construct a second instance of the PublicPublishVersionOptions model with no property values - publicPublishVersionOptionsModelNew := new(catalogmanagementv1.PublicPublishVersionOptions) + Expect(result).To(BeNil()) + // Construct a second instance of the GetVersionOptions model with no property values + getVersionOptionsModelNew := new(catalogmanagementv1.GetVersionOptions) // Invoke operation with invalid model (negative test) - response, operationErr = catalogManagementService.PublicPublishVersion(publicPublishVersionOptionsModelNew) + result, response, operationErr = catalogManagementService.GetVersion(getVersionOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke GetVersion successfully`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Construct an instance of the GetVersionOptions model + getVersionOptionsModel := new(catalogmanagementv1.GetVersionOptions) + getVersionOptionsModel.VersionLocID = core.StringPtr("testString") + getVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := catalogManagementService.GetVersion(getVersionOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) }) - Describe(`CommitVersion(commitVersionOptions *CommitVersionOptions)`, func() { - commitVersionPath := "/versions/testString/commit" + Describe(`DeleteVersion(deleteVersionOptions *DeleteVersionOptions)`, func() { + deleteVersionPath := "/versions/testString" Context(`Using mock server endpoint`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(commitVersionPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(deleteVersionPath)) + Expect(req.Method).To(Equal("DELETE")) res.WriteHeader(200) })) }) - It(`Invoke CommitVersion successfully`, func() { + It(`Invoke DeleteVersion successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -9458,21 +15998,21 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - response, operationErr := catalogManagementService.CommitVersion(nil) + response, operationErr := catalogManagementService.DeleteVersion(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) - // Construct an instance of the CommitVersionOptions model - commitVersionOptionsModel := new(catalogmanagementv1.CommitVersionOptions) - commitVersionOptionsModel.VersionLocID = core.StringPtr("testString") - commitVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteVersionOptions model + deleteVersionOptionsModel := new(catalogmanagementv1.DeleteVersionOptions) + deleteVersionOptionsModel.VersionLocID = core.StringPtr("testString") + deleteVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - response, operationErr = catalogManagementService.CommitVersion(commitVersionOptionsModel) + response, operationErr = catalogManagementService.DeleteVersion(deleteVersionOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) }) - It(`Invoke CommitVersion with error: Operation validation and request error`, func() { + It(`Invoke DeleteVersion with error: Operation validation and request error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -9480,21 +16020,21 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the CommitVersionOptions model - commitVersionOptionsModel := new(catalogmanagementv1.CommitVersionOptions) - commitVersionOptionsModel.VersionLocID = core.StringPtr("testString") - commitVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteVersionOptions model + deleteVersionOptionsModel := new(catalogmanagementv1.DeleteVersionOptions) + deleteVersionOptionsModel.VersionLocID = core.StringPtr("testString") + deleteVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := catalogManagementService.SetServiceURL("") Expect(err).To(BeNil()) - response, operationErr := catalogManagementService.CommitVersion(commitVersionOptionsModel) + response, operationErr := catalogManagementService.DeleteVersion(deleteVersionOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) - // Construct a second instance of the CommitVersionOptions model with no property values - commitVersionOptionsModelNew := new(catalogmanagementv1.CommitVersionOptions) + // Construct a second instance of the DeleteVersionOptions model with no property values + deleteVersionOptionsModelNew := new(catalogmanagementv1.DeleteVersionOptions) // Invoke operation with invalid model (negative test) - response, operationErr = catalogManagementService.CommitVersion(commitVersionOptionsModelNew) + response, operationErr = catalogManagementService.DeleteVersion(deleteVersionOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) }) @@ -9503,37 +16043,21 @@ var _ = Describe(`CatalogManagementV1`, func() { }) }) }) - Describe(`CopyVersion(copyVersionOptions *CopyVersionOptions)`, func() { - copyVersionPath := "/versions/testString/copy" + Describe(`DeprecateVersion(deprecateVersionOptions *DeprecateVersionOptions)`, func() { + deprecateVersionPath := "/versions/testString/deprecate" Context(`Using mock server endpoint`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(copyVersionPath)) + Expect(req.URL.EscapedPath()).To(Equal(deprecateVersionPath)) Expect(req.Method).To(Equal("POST")) - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) - - res.WriteHeader(200) + res.WriteHeader(202) })) }) - It(`Invoke CopyVersion successfully`, func() { + It(`Invoke DeprecateVersion successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -9542,24 +16066,21 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - response, operationErr := catalogManagementService.CopyVersion(nil) + response, operationErr := catalogManagementService.DeprecateVersion(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) - // Construct an instance of the CopyVersionOptions model - copyVersionOptionsModel := new(catalogmanagementv1.CopyVersionOptions) - copyVersionOptionsModel.VersionLocID = core.StringPtr("testString") - copyVersionOptionsModel.Tags = []string{"testString"} - copyVersionOptionsModel.TargetKinds = []string{"testString"} - copyVersionOptionsModel.Content = CreateMockByteArray("This is a mock byte array value.") - copyVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeprecateVersionOptions model + deprecateVersionOptionsModel := new(catalogmanagementv1.DeprecateVersionOptions) + deprecateVersionOptionsModel.VersionLocID = core.StringPtr("testString") + deprecateVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - response, operationErr = catalogManagementService.CopyVersion(copyVersionOptionsModel) + response, operationErr = catalogManagementService.DeprecateVersion(deprecateVersionOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) }) - It(`Invoke CopyVersion with error: Operation validation and request error`, func() { + It(`Invoke DeprecateVersion with error: Operation validation and request error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -9567,24 +16088,21 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the CopyVersionOptions model - copyVersionOptionsModel := new(catalogmanagementv1.CopyVersionOptions) - copyVersionOptionsModel.VersionLocID = core.StringPtr("testString") - copyVersionOptionsModel.Tags = []string{"testString"} - copyVersionOptionsModel.TargetKinds = []string{"testString"} - copyVersionOptionsModel.Content = CreateMockByteArray("This is a mock byte array value.") - copyVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeprecateVersionOptions model + deprecateVersionOptionsModel := new(catalogmanagementv1.DeprecateVersionOptions) + deprecateVersionOptionsModel.VersionLocID = core.StringPtr("testString") + deprecateVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := catalogManagementService.SetServiceURL("") Expect(err).To(BeNil()) - response, operationErr := catalogManagementService.CopyVersion(copyVersionOptionsModel) + response, operationErr := catalogManagementService.DeprecateVersion(deprecateVersionOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) - // Construct a second instance of the CopyVersionOptions model with no property values - copyVersionOptionsModelNew := new(catalogmanagementv1.CopyVersionOptions) + // Construct a second instance of the DeprecateVersionOptions model with no property values + deprecateVersionOptionsModelNew := new(catalogmanagementv1.DeprecateVersionOptions) // Invoke operation with invalid model (negative test) - response, operationErr = catalogManagementService.CopyVersion(copyVersionOptionsModelNew) + response, operationErr = catalogManagementService.DeprecateVersion(deprecateVersionOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) }) @@ -9593,22 +16111,21 @@ var _ = Describe(`CatalogManagementV1`, func() { }) }) }) - Describe(`GetOfferingWorkingCopy(getOfferingWorkingCopyOptions *GetOfferingWorkingCopyOptions) - Operation response error`, func() { - getOfferingWorkingCopyPath := "/versions/testString/workingcopy" - Context(`Using mock server endpoint with invalid JSON response`, func() { + Describe(`AccountPublishVersion(accountPublishVersionOptions *AccountPublishVersionOptions)`, func() { + accountPublishVersionPath := "/versions/testString/account-publish" + Context(`Using mock server endpoint`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getOfferingWorkingCopyPath)) + Expect(req.URL.EscapedPath()).To(Equal(accountPublishVersionPath)) Expect(req.Method).To(Equal("POST")) - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, `} this is not valid json {`) + + res.WriteHeader(202) })) }) - It(`Invoke GetOfferingWorkingCopy with error: Operation response processing error`, func() { + It(`Invoke AccountPublishVersion successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -9616,103 +16133,67 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the GetOfferingWorkingCopyOptions model - getOfferingWorkingCopyOptionsModel := new(catalogmanagementv1.GetOfferingWorkingCopyOptions) - getOfferingWorkingCopyOptionsModel.VersionLocID = core.StringPtr("testString") - getOfferingWorkingCopyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := catalogManagementService.GetOfferingWorkingCopy(getOfferingWorkingCopyOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - - // Enable retries and test again - catalogManagementService.EnableRetries(0, 0) - result, response, operationErr = catalogManagementService.GetOfferingWorkingCopy(getOfferingWorkingCopyOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetOfferingWorkingCopy(getOfferingWorkingCopyOptions *GetOfferingWorkingCopyOptions)`, func() { - getOfferingWorkingCopyPath := "/versions/testString/workingcopy" - Context(`Using mock server endpoint with timeout`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getOfferingWorkingCopyPath)) - Expect(req.Method).To(Equal("POST")) + // Invoke operation with nil options model (negative test) + response, operationErr := catalogManagementService.AccountPublishVersion(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) - // Sleep a short time to support a timeout test - time.Sleep(100 * time.Millisecond) + // Construct an instance of the AccountPublishVersionOptions model + accountPublishVersionOptionsModel := new(catalogmanagementv1.AccountPublishVersionOptions) + accountPublishVersionOptionsModel.VersionLocID = core.StringPtr("testString") + accountPublishVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Set mock response - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "crn": "CRN", "version": "Version", "sha": "Sha", "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "offering_id": "OfferingID", "catalog_id": "CatalogID", "kind_id": "KindID", "tags": ["Tags"], "repo_url": "RepoURL", "source_url": "SourceURL", "tgz_url": "TgzURL", "configuration": [{"key": "Key", "type": "Type", "default_value": "anyValue", "value_constraint": "ValueConstraint", "description": "Description", "required": true, "options": ["anyValue"], "hidden": true}], "metadata": {"mapKey": "anyValue"}, "validation": {"validated": "2019-01-01T12:00:00.000Z", "requested": "2019-01-01T12:00:00.000Z", "state": "State", "last_operation": "LastOperation", "target": {"mapKey": "anyValue"}}, "required_resources": [{"type": "mem", "value": "anyValue"}], "single_instance": true, "install": {"instructions": "Instructions", "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}, "pre_install": [{"instructions": "Instructions", "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}], "entitlement": {"provider_name": "ProviderName", "provider_id": "ProviderID", "product_id": "ProductID", "part_numbers": ["PartNumbers"], "image_repo_name": "ImageRepoName"}, "licenses": [{"id": "ID", "name": "Name", "type": "Type", "url": "URL", "description": "Description"}], "image_manifest_url": "ImageManifestURL", "deprecated": true, "package_version": "PackageVersion", "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "version_locator": "VersionLocator", "console_url": "ConsoleURL", "long_description": "LongDescription", "whitelisted_accounts": ["WhitelistedAccounts"]}`) - })) + // Invoke operation with valid options model (positive test) + response, operationErr = catalogManagementService.AccountPublishVersion(accountPublishVersionOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) }) - It(`Invoke GetOfferingWorkingCopy successfully with retries`, func() { + It(`Invoke AccountPublishVersion with error: Operation validation and request error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - catalogManagementService.EnableRetries(0, 0) - - // Construct an instance of the GetOfferingWorkingCopyOptions model - getOfferingWorkingCopyOptionsModel := new(catalogmanagementv1.GetOfferingWorkingCopyOptions) - getOfferingWorkingCopyOptionsModel.VersionLocID = core.StringPtr("testString") - getOfferingWorkingCopyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with a Context to test a timeout error - ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) - defer cancelFunc() - _, _, operationErr := catalogManagementService.GetOfferingWorkingCopyWithContext(ctx, getOfferingWorkingCopyOptionsModel) + // Construct an instance of the AccountPublishVersionOptions model + accountPublishVersionOptionsModel := new(catalogmanagementv1.AccountPublishVersionOptions) + accountPublishVersionOptionsModel.VersionLocID = core.StringPtr("testString") + accountPublishVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := catalogManagementService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := catalogManagementService.AccountPublishVersion(accountPublishVersionOptionsModel) Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - catalogManagementService.DisableRetries() - result, response, operationErr := catalogManagementService.GetOfferingWorkingCopy(getOfferingWorkingCopyOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - // Re-test the timeout error with retries disabled - ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) - defer cancelFunc2() - _, _, operationErr = catalogManagementService.GetOfferingWorkingCopyWithContext(ctx, getOfferingWorkingCopyOptionsModel) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the AccountPublishVersionOptions model with no property values + accountPublishVersionOptionsModelNew := new(catalogmanagementv1.AccountPublishVersionOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = catalogManagementService.AccountPublishVersion(accountPublishVersionOptionsModelNew) Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + Expect(response).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) + }) + Describe(`IBMPublishVersion(ibmPublishVersionOptions *IBMPublishVersionOptions)`, func() { + ibmPublishVersionPath := "/versions/testString/ibm-publish" Context(`Using mock server endpoint`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getOfferingWorkingCopyPath)) + Expect(req.URL.EscapedPath()).To(Equal(ibmPublishVersionPath)) Expect(req.Method).To(Equal("POST")) - // Set mock response - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "crn": "CRN", "version": "Version", "sha": "Sha", "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "offering_id": "OfferingID", "catalog_id": "CatalogID", "kind_id": "KindID", "tags": ["Tags"], "repo_url": "RepoURL", "source_url": "SourceURL", "tgz_url": "TgzURL", "configuration": [{"key": "Key", "type": "Type", "default_value": "anyValue", "value_constraint": "ValueConstraint", "description": "Description", "required": true, "options": ["anyValue"], "hidden": true}], "metadata": {"mapKey": "anyValue"}, "validation": {"validated": "2019-01-01T12:00:00.000Z", "requested": "2019-01-01T12:00:00.000Z", "state": "State", "last_operation": "LastOperation", "target": {"mapKey": "anyValue"}}, "required_resources": [{"type": "mem", "value": "anyValue"}], "single_instance": true, "install": {"instructions": "Instructions", "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}, "pre_install": [{"instructions": "Instructions", "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}], "entitlement": {"provider_name": "ProviderName", "provider_id": "ProviderID", "product_id": "ProductID", "part_numbers": ["PartNumbers"], "image_repo_name": "ImageRepoName"}, "licenses": [{"id": "ID", "name": "Name", "type": "Type", "url": "URL", "description": "Description"}], "image_manifest_url": "ImageManifestURL", "deprecated": true, "package_version": "PackageVersion", "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "version_locator": "VersionLocator", "console_url": "ConsoleURL", "long_description": "LongDescription", "whitelisted_accounts": ["WhitelistedAccounts"]}`) + res.WriteHeader(202) })) }) - It(`Invoke GetOfferingWorkingCopy successfully`, func() { + It(`Invoke IBMPublishVersion successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -9721,24 +16202,21 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := catalogManagementService.GetOfferingWorkingCopy(nil) + response, operationErr := catalogManagementService.IBMPublishVersion(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - // Construct an instance of the GetOfferingWorkingCopyOptions model - getOfferingWorkingCopyOptionsModel := new(catalogmanagementv1.GetOfferingWorkingCopyOptions) - getOfferingWorkingCopyOptionsModel.VersionLocID = core.StringPtr("testString") - getOfferingWorkingCopyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the IBMPublishVersionOptions model + ibmPublishVersionOptionsModel := new(catalogmanagementv1.IBMPublishVersionOptions) + ibmPublishVersionOptionsModel.VersionLocID = core.StringPtr("testString") + ibmPublishVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = catalogManagementService.GetOfferingWorkingCopy(getOfferingWorkingCopyOptionsModel) + response, operationErr = catalogManagementService.IBMPublishVersion(ibmPublishVersionOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - }) - It(`Invoke GetOfferingWorkingCopy with error: Operation validation and request error`, func() { + It(`Invoke IBMPublishVersion with error: Operation validation and request error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -9746,40 +16224,44 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the GetOfferingWorkingCopyOptions model - getOfferingWorkingCopyOptionsModel := new(catalogmanagementv1.GetOfferingWorkingCopyOptions) - getOfferingWorkingCopyOptionsModel.VersionLocID = core.StringPtr("testString") - getOfferingWorkingCopyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the IBMPublishVersionOptions model + ibmPublishVersionOptionsModel := new(catalogmanagementv1.IBMPublishVersionOptions) + ibmPublishVersionOptionsModel.VersionLocID = core.StringPtr("testString") + ibmPublishVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := catalogManagementService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := catalogManagementService.GetOfferingWorkingCopy(getOfferingWorkingCopyOptionsModel) + response, operationErr := catalogManagementService.IBMPublishVersion(ibmPublishVersionOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - // Construct a second instance of the GetOfferingWorkingCopyOptions model with no property values - getOfferingWorkingCopyOptionsModelNew := new(catalogmanagementv1.GetOfferingWorkingCopyOptions) + // Construct a second instance of the IBMPublishVersionOptions model with no property values + ibmPublishVersionOptionsModelNew := new(catalogmanagementv1.IBMPublishVersionOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = catalogManagementService.GetOfferingWorkingCopy(getOfferingWorkingCopyOptionsModelNew) + response, operationErr = catalogManagementService.IBMPublishVersion(ibmPublishVersionOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) - Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) - Context(`Using mock server endpoint with missing response body`, func() { + }) + Describe(`PublicPublishVersion(publicPublishVersionOptions *PublicPublishVersionOptions)`, func() { + publicPublishVersionPath := "/versions/testString/public-publish" + Context(`Using mock server endpoint`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() - // Set success status code with no respoonse body - res.WriteHeader(200) + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(publicPublishVersionPath)) + Expect(req.Method).To(Equal("POST")) + + res.WriteHeader(202) })) }) - It(`Invoke GetOfferingWorkingCopy successfully`, func() { + It(`Invoke PublicPublishVersion successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -9787,40 +16269,71 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the GetOfferingWorkingCopyOptions model - getOfferingWorkingCopyOptionsModel := new(catalogmanagementv1.GetOfferingWorkingCopyOptions) - getOfferingWorkingCopyOptionsModel.VersionLocID = core.StringPtr("testString") - getOfferingWorkingCopyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with nil options model (negative test) + response, operationErr := catalogManagementService.PublicPublishVersion(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) - // Invoke operation - result, response, operationErr := catalogManagementService.GetOfferingWorkingCopy(getOfferingWorkingCopyOptionsModel) + // Construct an instance of the PublicPublishVersionOptions model + publicPublishVersionOptionsModel := new(catalogmanagementv1.PublicPublishVersionOptions) + publicPublishVersionOptionsModel.VersionLocID = core.StringPtr("testString") + publicPublishVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = catalogManagementService.PublicPublishVersion(publicPublishVersionOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) + }) + It(`Invoke PublicPublishVersion with error: Operation validation and request error`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) - // Verify a nil result - Expect(result).To(BeNil()) + // Construct an instance of the PublicPublishVersionOptions model + publicPublishVersionOptionsModel := new(catalogmanagementv1.PublicPublishVersionOptions) + publicPublishVersionOptionsModel.VersionLocID = core.StringPtr("testString") + publicPublishVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := catalogManagementService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := catalogManagementService.PublicPublishVersion(publicPublishVersionOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the PublicPublishVersionOptions model with no property values + publicPublishVersionOptionsModelNew := new(catalogmanagementv1.PublicPublishVersionOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = catalogManagementService.PublicPublishVersion(publicPublishVersionOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) }) - Describe(`GetVersion(getVersionOptions *GetVersionOptions) - Operation response error`, func() { - getVersionPath := "/versions/testString" + Describe(`GetCluster(getClusterOptions *GetClusterOptions) - Operation response error`, func() { + getClusterPath := "/deploy/kubernetes/clusters/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getVersionPath)) + Expect(req.URL.EscapedPath()).To(Equal(getClusterPath)) Expect(req.Method).To(Equal("GET")) + Expect(req.Header["X-Auth-Refresh-Token"]).ToNot(BeNil()) + Expect(req.Header["X-Auth-Refresh-Token"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["region"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, `} this is not valid json {`) + fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetVersion with error: Operation response processing error`, func() { + It(`Invoke GetCluster with error: Operation response processing error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -9828,19 +16341,21 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the GetVersionOptions model - getVersionOptionsModel := new(catalogmanagementv1.GetVersionOptions) - getVersionOptionsModel.VersionLocID = core.StringPtr("testString") - getVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetClusterOptions model + getClusterOptionsModel := new(catalogmanagementv1.GetClusterOptions) + getClusterOptionsModel.ClusterID = core.StringPtr("testString") + getClusterOptionsModel.Region = core.StringPtr("testString") + getClusterOptionsModel.XAuthRefreshToken = core.StringPtr("testString") + getClusterOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := catalogManagementService.GetVersion(getVersionOptionsModel) + result, response, operationErr := catalogManagementService.GetCluster(getClusterOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again catalogManagementService.EnableRetries(0, 0) - result, response, operationErr = catalogManagementService.GetVersion(getVersionOptionsModel) + result, response, operationErr = catalogManagementService.GetCluster(getClusterOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -9850,27 +16365,30 @@ var _ = Describe(`CatalogManagementV1`, func() { }) }) }) - Describe(`GetVersion(getVersionOptions *GetVersionOptions)`, func() { - getVersionPath := "/versions/testString" + Describe(`GetCluster(getClusterOptions *GetClusterOptions)`, func() { + getClusterPath := "/deploy/kubernetes/clusters/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getVersionPath)) + Expect(req.URL.EscapedPath()).To(Equal(getClusterPath)) Expect(req.Method).To(Equal("GET")) + Expect(req.Header["X-Auth-Refresh-Token"]).ToNot(BeNil()) + Expect(req.Header["X-Auth-Refresh-Token"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["region"]).To(Equal([]string{"testString"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "url": "URL", "crn": "CRN", "label": "Label", "name": "Name", "offering_icon_url": "OfferingIconURL", "offering_docs_url": "OfferingDocsURL", "offering_support_url": "OfferingSupportURL", "tags": ["Tags"], "keywords": ["Keywords"], "rating": {"one_star_count": 12, "two_star_count": 12, "three_star_count": 14, "four_star_count": 13}, "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "short_description": "ShortDescription", "long_description": "LongDescription", "features": [{"title": "Title", "description": "Description"}], "kinds": [{"id": "ID", "format_kind": "FormatKind", "target_kind": "TargetKind", "metadata": {"mapKey": "anyValue"}, "install_description": "InstallDescription", "tags": ["Tags"], "additional_features": [{"title": "Title", "description": "Description"}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "versions": [{"id": "ID", "_rev": "Rev", "crn": "CRN", "version": "Version", "sha": "Sha", "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "offering_id": "OfferingID", "catalog_id": "CatalogID", "kind_id": "KindID", "tags": ["Tags"], "repo_url": "RepoURL", "source_url": "SourceURL", "tgz_url": "TgzURL", "configuration": [{"key": "Key", "type": "Type", "default_value": "anyValue", "value_constraint": "ValueConstraint", "description": "Description", "required": true, "options": ["anyValue"], "hidden": true}], "metadata": {"mapKey": "anyValue"}, "validation": {"validated": "2019-01-01T12:00:00.000Z", "requested": "2019-01-01T12:00:00.000Z", "state": "State", "last_operation": "LastOperation", "target": {"mapKey": "anyValue"}}, "required_resources": [{"type": "mem", "value": "anyValue"}], "single_instance": true, "install": {"instructions": "Instructions", "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}, "pre_install": [{"instructions": "Instructions", "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}], "entitlement": {"provider_name": "ProviderName", "provider_id": "ProviderID", "product_id": "ProductID", "part_numbers": ["PartNumbers"], "image_repo_name": "ImageRepoName"}, "licenses": [{"id": "ID", "name": "Name", "type": "Type", "url": "URL", "description": "Description"}], "image_manifest_url": "ImageManifestURL", "deprecated": true, "package_version": "PackageVersion", "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "version_locator": "VersionLocator", "console_url": "ConsoleURL", "long_description": "LongDescription", "whitelisted_accounts": ["WhitelistedAccounts"]}], "plans": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "additional_features": [{"title": "Title", "description": "Description"}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "deployments": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z"}]}]}], "permit_request_ibm_public_publish": false, "ibm_publish_approved": true, "public_publish_approved": false, "public_original_crn": "PublicOriginalCRN", "publish_public_crn": "PublishPublicCRN", "portal_approval_record": "PortalApprovalRecord", "portal_ui_url": "PortalUIURL", "catalog_id": "CatalogID", "catalog_name": "CatalogName", "metadata": {"mapKey": "anyValue"}, "disclaimer": "Disclaimer", "hidden": true, "provider": "Provider", "provider_info": {"id": "ID", "name": "Name"}, "repo_info": {"token": "Token", "type": "Type"}, "support": {"url": "URL", "process": "Process", "locations": ["Locations"]}, "media": [{"url": "URL", "caption": "Caption", "type": "Type", "thumbnail_url": "ThumbnailURL"}]}`) + fmt.Fprintf(res, "%s", `{"resource_group_id": "ResourceGroupID", "resource_group_name": "ResourceGroupName", "id": "ID", "name": "Name", "region": "Region", "ingress_hostname": "IngressHostname", "provider": "Provider", "status": "Status"}`) })) }) - It(`Invoke GetVersion successfully with retries`, func() { + It(`Invoke GetCluster successfully with retries`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -9879,21 +16397,23 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) catalogManagementService.EnableRetries(0, 0) - // Construct an instance of the GetVersionOptions model - getVersionOptionsModel := new(catalogmanagementv1.GetVersionOptions) - getVersionOptionsModel.VersionLocID = core.StringPtr("testString") - getVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetClusterOptions model + getClusterOptionsModel := new(catalogmanagementv1.GetClusterOptions) + getClusterOptionsModel.ClusterID = core.StringPtr("testString") + getClusterOptionsModel.Region = core.StringPtr("testString") + getClusterOptionsModel.XAuthRefreshToken = core.StringPtr("testString") + getClusterOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := catalogManagementService.GetVersionWithContext(ctx, getVersionOptionsModel) + _, _, operationErr := catalogManagementService.GetClusterWithContext(ctx, getClusterOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again catalogManagementService.DisableRetries() - result, response, operationErr := catalogManagementService.GetVersion(getVersionOptionsModel) + result, response, operationErr := catalogManagementService.GetCluster(getClusterOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -9901,7 +16421,7 @@ var _ = Describe(`CatalogManagementV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = catalogManagementService.GetVersionWithContext(ctx, getVersionOptionsModel) + _, _, operationErr = catalogManagementService.GetClusterWithContext(ctx, getClusterOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -9915,16 +16435,19 @@ var _ = Describe(`CatalogManagementV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getVersionPath)) + Expect(req.URL.EscapedPath()).To(Equal(getClusterPath)) Expect(req.Method).To(Equal("GET")) + Expect(req.Header["X-Auth-Refresh-Token"]).ToNot(BeNil()) + Expect(req.Header["X-Auth-Refresh-Token"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["region"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "url": "URL", "crn": "CRN", "label": "Label", "name": "Name", "offering_icon_url": "OfferingIconURL", "offering_docs_url": "OfferingDocsURL", "offering_support_url": "OfferingSupportURL", "tags": ["Tags"], "keywords": ["Keywords"], "rating": {"one_star_count": 12, "two_star_count": 12, "three_star_count": 14, "four_star_count": 13}, "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "short_description": "ShortDescription", "long_description": "LongDescription", "features": [{"title": "Title", "description": "Description"}], "kinds": [{"id": "ID", "format_kind": "FormatKind", "target_kind": "TargetKind", "metadata": {"mapKey": "anyValue"}, "install_description": "InstallDescription", "tags": ["Tags"], "additional_features": [{"title": "Title", "description": "Description"}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "versions": [{"id": "ID", "_rev": "Rev", "crn": "CRN", "version": "Version", "sha": "Sha", "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "offering_id": "OfferingID", "catalog_id": "CatalogID", "kind_id": "KindID", "tags": ["Tags"], "repo_url": "RepoURL", "source_url": "SourceURL", "tgz_url": "TgzURL", "configuration": [{"key": "Key", "type": "Type", "default_value": "anyValue", "value_constraint": "ValueConstraint", "description": "Description", "required": true, "options": ["anyValue"], "hidden": true}], "metadata": {"mapKey": "anyValue"}, "validation": {"validated": "2019-01-01T12:00:00.000Z", "requested": "2019-01-01T12:00:00.000Z", "state": "State", "last_operation": "LastOperation", "target": {"mapKey": "anyValue"}}, "required_resources": [{"type": "mem", "value": "anyValue"}], "single_instance": true, "install": {"instructions": "Instructions", "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}, "pre_install": [{"instructions": "Instructions", "script": "Script", "script_permission": "ScriptPermission", "delete_script": "DeleteScript", "scope": "Scope"}], "entitlement": {"provider_name": "ProviderName", "provider_id": "ProviderID", "product_id": "ProductID", "part_numbers": ["PartNumbers"], "image_repo_name": "ImageRepoName"}, "licenses": [{"id": "ID", "name": "Name", "type": "Type", "url": "URL", "description": "Description"}], "image_manifest_url": "ImageManifestURL", "deprecated": true, "package_version": "PackageVersion", "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "version_locator": "VersionLocator", "console_url": "ConsoleURL", "long_description": "LongDescription", "whitelisted_accounts": ["WhitelistedAccounts"]}], "plans": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "additional_features": [{"title": "Title", "description": "Description"}], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "deployments": [{"id": "ID", "label": "Label", "name": "Name", "short_description": "ShortDescription", "long_description": "LongDescription", "metadata": {"mapKey": "anyValue"}, "tags": ["Tags"], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z"}]}]}], "permit_request_ibm_public_publish": false, "ibm_publish_approved": true, "public_publish_approved": false, "public_original_crn": "PublicOriginalCRN", "publish_public_crn": "PublishPublicCRN", "portal_approval_record": "PortalApprovalRecord", "portal_ui_url": "PortalUIURL", "catalog_id": "CatalogID", "catalog_name": "CatalogName", "metadata": {"mapKey": "anyValue"}, "disclaimer": "Disclaimer", "hidden": true, "provider": "Provider", "provider_info": {"id": "ID", "name": "Name"}, "repo_info": {"token": "Token", "type": "Type"}, "support": {"url": "URL", "process": "Process", "locations": ["Locations"]}, "media": [{"url": "URL", "caption": "Caption", "type": "Type", "thumbnail_url": "ThumbnailURL"}]}`) + fmt.Fprintf(res, "%s", `{"resource_group_id": "ResourceGroupID", "resource_group_name": "ResourceGroupName", "id": "ID", "name": "Name", "region": "Region", "ingress_hostname": "IngressHostname", "provider": "Provider", "status": "Status"}`) })) }) - It(`Invoke GetVersion successfully`, func() { + It(`Invoke GetCluster successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -9933,24 +16456,26 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := catalogManagementService.GetVersion(nil) + result, response, operationErr := catalogManagementService.GetCluster(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetVersionOptions model - getVersionOptionsModel := new(catalogmanagementv1.GetVersionOptions) - getVersionOptionsModel.VersionLocID = core.StringPtr("testString") - getVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetClusterOptions model + getClusterOptionsModel := new(catalogmanagementv1.GetClusterOptions) + getClusterOptionsModel.ClusterID = core.StringPtr("testString") + getClusterOptionsModel.Region = core.StringPtr("testString") + getClusterOptionsModel.XAuthRefreshToken = core.StringPtr("testString") + getClusterOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = catalogManagementService.GetVersion(getVersionOptionsModel) + result, response, operationErr = catalogManagementService.GetCluster(getClusterOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetVersion with error: Operation validation and request error`, func() { + It(`Invoke GetCluster with error: Operation validation and request error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -9958,22 +16483,24 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the GetVersionOptions model - getVersionOptionsModel := new(catalogmanagementv1.GetVersionOptions) - getVersionOptionsModel.VersionLocID = core.StringPtr("testString") - getVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetClusterOptions model + getClusterOptionsModel := new(catalogmanagementv1.GetClusterOptions) + getClusterOptionsModel.ClusterID = core.StringPtr("testString") + getClusterOptionsModel.Region = core.StringPtr("testString") + getClusterOptionsModel.XAuthRefreshToken = core.StringPtr("testString") + getClusterOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := catalogManagementService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := catalogManagementService.GetVersion(getVersionOptionsModel) + result, response, operationErr := catalogManagementService.GetCluster(getClusterOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetVersionOptions model with no property values - getVersionOptionsModelNew := new(catalogmanagementv1.GetVersionOptions) + // Construct a second instance of the GetClusterOptions model with no property values + getClusterOptionsModelNew := new(catalogmanagementv1.GetClusterOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = catalogManagementService.GetVersion(getVersionOptionsModelNew) + result, response, operationErr = catalogManagementService.GetCluster(getClusterOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -9991,7 +16518,7 @@ var _ = Describe(`CatalogManagementV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetVersion successfully`, func() { + It(`Invoke GetCluster successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -9999,13 +16526,15 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the GetVersionOptions model - getVersionOptionsModel := new(catalogmanagementv1.GetVersionOptions) - getVersionOptionsModel.VersionLocID = core.StringPtr("testString") - getVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetClusterOptions model + getClusterOptionsModel := new(catalogmanagementv1.GetClusterOptions) + getClusterOptionsModel.ClusterID = core.StringPtr("testString") + getClusterOptionsModel.Region = core.StringPtr("testString") + getClusterOptionsModel.XAuthRefreshToken = core.StringPtr("testString") + getClusterOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := catalogManagementService.GetVersion(getVersionOptionsModel) + result, response, operationErr := catalogManagementService.GetCluster(getClusterOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -10017,93 +16546,27 @@ var _ = Describe(`CatalogManagementV1`, func() { }) }) }) - Describe(`DeleteVersion(deleteVersionOptions *DeleteVersionOptions)`, func() { - deleteVersionPath := "/versions/testString" - Context(`Using mock server endpoint`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteVersionPath)) - Expect(req.Method).To(Equal("DELETE")) - - res.WriteHeader(200) - })) - }) - It(`Invoke DeleteVersion successfully`, func() { - catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(catalogManagementService).ToNot(BeNil()) - - // Invoke operation with nil options model (negative test) - response, operationErr := catalogManagementService.DeleteVersion(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteVersionOptions model - deleteVersionOptionsModel := new(catalogmanagementv1.DeleteVersionOptions) - deleteVersionOptionsModel.VersionLocID = core.StringPtr("testString") - deleteVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = catalogManagementService.DeleteVersion(deleteVersionOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteVersion with error: Operation validation and request error`, func() { - catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(catalogManagementService).ToNot(BeNil()) - - // Construct an instance of the DeleteVersionOptions model - deleteVersionOptionsModel := new(catalogmanagementv1.DeleteVersionOptions) - deleteVersionOptionsModel.VersionLocID = core.StringPtr("testString") - deleteVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := catalogManagementService.SetServiceURL("") - Expect(err).To(BeNil()) - response, operationErr := catalogManagementService.DeleteVersion(deleteVersionOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteVersionOptions model with no property values - deleteVersionOptionsModelNew := new(catalogmanagementv1.DeleteVersionOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = catalogManagementService.DeleteVersion(deleteVersionOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetCluster(getClusterOptions *GetClusterOptions) - Operation response error`, func() { - getClusterPath := "/deploy/kubernetes/clusters/testString" + Describe(`GetNamespaces(getNamespacesOptions *GetNamespacesOptions) - Operation response error`, func() { + getNamespacesPath := "/deploy/kubernetes/clusters/testString/namespaces" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getClusterPath)) + Expect(req.URL.EscapedPath()).To(Equal(getNamespacesPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["X-Auth-Refresh-Token"]).ToNot(BeNil()) Expect(req.Header["X-Auth-Refresh-Token"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) Expect(req.URL.Query()["region"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1000))})) + Expect(req.URL.Query()["offset"]).To(Equal([]string{fmt.Sprint(int64(38))})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, `} this is not valid json {`) + fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetCluster with error: Operation response processing error`, func() { + It(`Invoke GetNamespaces with error: Operation response processing error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -10111,21 +16574,23 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the GetClusterOptions model - getClusterOptionsModel := new(catalogmanagementv1.GetClusterOptions) - getClusterOptionsModel.ClusterID = core.StringPtr("testString") - getClusterOptionsModel.Region = core.StringPtr("testString") - getClusterOptionsModel.XAuthRefreshToken = core.StringPtr("testString") - getClusterOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetNamespacesOptions model + getNamespacesOptionsModel := new(catalogmanagementv1.GetNamespacesOptions) + getNamespacesOptionsModel.ClusterID = core.StringPtr("testString") + getNamespacesOptionsModel.Region = core.StringPtr("testString") + getNamespacesOptionsModel.XAuthRefreshToken = core.StringPtr("testString") + getNamespacesOptionsModel.Limit = core.Int64Ptr(int64(1000)) + getNamespacesOptionsModel.Offset = core.Int64Ptr(int64(38)) + getNamespacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := catalogManagementService.GetCluster(getClusterOptionsModel) + result, response, operationErr := catalogManagementService.GetNamespaces(getNamespacesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again catalogManagementService.EnableRetries(0, 0) - result, response, operationErr = catalogManagementService.GetCluster(getClusterOptionsModel) + result, response, operationErr = catalogManagementService.GetNamespaces(getNamespacesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -10135,30 +16600,32 @@ var _ = Describe(`CatalogManagementV1`, func() { }) }) }) - Describe(`GetCluster(getClusterOptions *GetClusterOptions)`, func() { - getClusterPath := "/deploy/kubernetes/clusters/testString" + Describe(`GetNamespaces(getNamespacesOptions *GetNamespacesOptions)`, func() { + getNamespacesPath := "/deploy/kubernetes/clusters/testString/namespaces" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getClusterPath)) + Expect(req.URL.EscapedPath()).To(Equal(getNamespacesPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["X-Auth-Refresh-Token"]).ToNot(BeNil()) Expect(req.Header["X-Auth-Refresh-Token"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) Expect(req.URL.Query()["region"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1000))})) + Expect(req.URL.Query()["offset"]).To(Equal([]string{fmt.Sprint(int64(38))})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"resource_group_id": "ResourceGroupID", "resource_group_name": "ResourceGroupName", "id": "ID", "name": "Name", "region": "Region"}`) + fmt.Fprintf(res, "%s", `{"offset": 6, "limit": 5, "total_count": 10, "resource_count": 13, "first": "First", "last": "Last", "prev": "Prev", "next": "Next", "resources": ["Resources"]}`) })) }) - It(`Invoke GetCluster successfully with retries`, func() { + It(`Invoke GetNamespaces successfully with retries`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -10167,23 +16634,25 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) catalogManagementService.EnableRetries(0, 0) - // Construct an instance of the GetClusterOptions model - getClusterOptionsModel := new(catalogmanagementv1.GetClusterOptions) - getClusterOptionsModel.ClusterID = core.StringPtr("testString") - getClusterOptionsModel.Region = core.StringPtr("testString") - getClusterOptionsModel.XAuthRefreshToken = core.StringPtr("testString") - getClusterOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetNamespacesOptions model + getNamespacesOptionsModel := new(catalogmanagementv1.GetNamespacesOptions) + getNamespacesOptionsModel.ClusterID = core.StringPtr("testString") + getNamespacesOptionsModel.Region = core.StringPtr("testString") + getNamespacesOptionsModel.XAuthRefreshToken = core.StringPtr("testString") + getNamespacesOptionsModel.Limit = core.Int64Ptr(int64(1000)) + getNamespacesOptionsModel.Offset = core.Int64Ptr(int64(38)) + getNamespacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := catalogManagementService.GetClusterWithContext(ctx, getClusterOptionsModel) + _, _, operationErr := catalogManagementService.GetNamespacesWithContext(ctx, getNamespacesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again catalogManagementService.DisableRetries() - result, response, operationErr := catalogManagementService.GetCluster(getClusterOptionsModel) + result, response, operationErr := catalogManagementService.GetNamespaces(getNamespacesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -10191,7 +16660,7 @@ var _ = Describe(`CatalogManagementV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = catalogManagementService.GetClusterWithContext(ctx, getClusterOptionsModel) + _, _, operationErr = catalogManagementService.GetNamespacesWithContext(ctx, getNamespacesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -10205,19 +16674,21 @@ var _ = Describe(`CatalogManagementV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getClusterPath)) + Expect(req.URL.EscapedPath()).To(Equal(getNamespacesPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["X-Auth-Refresh-Token"]).ToNot(BeNil()) Expect(req.Header["X-Auth-Refresh-Token"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) Expect(req.URL.Query()["region"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1000))})) + Expect(req.URL.Query()["offset"]).To(Equal([]string{fmt.Sprint(int64(38))})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"resource_group_id": "ResourceGroupID", "resource_group_name": "ResourceGroupName", "id": "ID", "name": "Name", "region": "Region"}`) + fmt.Fprintf(res, "%s", `{"offset": 6, "limit": 5, "total_count": 10, "resource_count": 13, "first": "First", "last": "Last", "prev": "Prev", "next": "Next", "resources": ["Resources"]}`) })) }) - It(`Invoke GetCluster successfully`, func() { + It(`Invoke GetNamespaces successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -10226,26 +16697,28 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := catalogManagementService.GetCluster(nil) + result, response, operationErr := catalogManagementService.GetNamespaces(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetClusterOptions model - getClusterOptionsModel := new(catalogmanagementv1.GetClusterOptions) - getClusterOptionsModel.ClusterID = core.StringPtr("testString") - getClusterOptionsModel.Region = core.StringPtr("testString") - getClusterOptionsModel.XAuthRefreshToken = core.StringPtr("testString") - getClusterOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetNamespacesOptions model + getNamespacesOptionsModel := new(catalogmanagementv1.GetNamespacesOptions) + getNamespacesOptionsModel.ClusterID = core.StringPtr("testString") + getNamespacesOptionsModel.Region = core.StringPtr("testString") + getNamespacesOptionsModel.XAuthRefreshToken = core.StringPtr("testString") + getNamespacesOptionsModel.Limit = core.Int64Ptr(int64(1000)) + getNamespacesOptionsModel.Offset = core.Int64Ptr(int64(38)) + getNamespacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = catalogManagementService.GetCluster(getClusterOptionsModel) + result, response, operationErr = catalogManagementService.GetNamespaces(getNamespacesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetCluster with error: Operation validation and request error`, func() { + It(`Invoke GetNamespaces with error: Operation validation and request error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -10253,24 +16726,26 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the GetClusterOptions model - getClusterOptionsModel := new(catalogmanagementv1.GetClusterOptions) - getClusterOptionsModel.ClusterID = core.StringPtr("testString") - getClusterOptionsModel.Region = core.StringPtr("testString") - getClusterOptionsModel.XAuthRefreshToken = core.StringPtr("testString") - getClusterOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetNamespacesOptions model + getNamespacesOptionsModel := new(catalogmanagementv1.GetNamespacesOptions) + getNamespacesOptionsModel.ClusterID = core.StringPtr("testString") + getNamespacesOptionsModel.Region = core.StringPtr("testString") + getNamespacesOptionsModel.XAuthRefreshToken = core.StringPtr("testString") + getNamespacesOptionsModel.Limit = core.Int64Ptr(int64(1000)) + getNamespacesOptionsModel.Offset = core.Int64Ptr(int64(38)) + getNamespacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := catalogManagementService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := catalogManagementService.GetCluster(getClusterOptionsModel) + result, response, operationErr := catalogManagementService.GetNamespaces(getNamespacesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetClusterOptions model with no property values - getClusterOptionsModelNew := new(catalogmanagementv1.GetClusterOptions) + // Construct a second instance of the GetNamespacesOptions model with no property values + getNamespacesOptionsModelNew := new(catalogmanagementv1.GetNamespacesOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = catalogManagementService.GetCluster(getClusterOptionsModelNew) + result, response, operationErr = catalogManagementService.GetNamespaces(getNamespacesOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -10288,7 +16763,7 @@ var _ = Describe(`CatalogManagementV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetCluster successfully`, func() { + It(`Invoke GetNamespaces successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -10296,15 +16771,17 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the GetClusterOptions model - getClusterOptionsModel := new(catalogmanagementv1.GetClusterOptions) - getClusterOptionsModel.ClusterID = core.StringPtr("testString") - getClusterOptionsModel.Region = core.StringPtr("testString") - getClusterOptionsModel.XAuthRefreshToken = core.StringPtr("testString") - getClusterOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetNamespacesOptions model + getNamespacesOptionsModel := new(catalogmanagementv1.GetNamespacesOptions) + getNamespacesOptionsModel.ClusterID = core.StringPtr("testString") + getNamespacesOptionsModel.Region = core.StringPtr("testString") + getNamespacesOptionsModel.XAuthRefreshToken = core.StringPtr("testString") + getNamespacesOptionsModel.Limit = core.Int64Ptr(int64(1000)) + getNamespacesOptionsModel.Offset = core.Int64Ptr(int64(38)) + getNamespacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := catalogManagementService.GetCluster(getClusterOptionsModel) + result, response, operationErr := catalogManagementService.GetNamespaces(getNamespacesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -10316,27 +16793,24 @@ var _ = Describe(`CatalogManagementV1`, func() { }) }) }) - Describe(`GetNamespaces(getNamespacesOptions *GetNamespacesOptions) - Operation response error`, func() { - getNamespacesPath := "/deploy/kubernetes/clusters/testString/namespaces" + Describe(`DeployOperators(deployOperatorsOptions *DeployOperatorsOptions) - Operation response error`, func() { + deployOperatorsPath := "/deploy/kubernetes/olm/operator" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getNamespacesPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(deployOperatorsPath)) + Expect(req.Method).To(Equal("POST")) Expect(req.Header["X-Auth-Refresh-Token"]).ToNot(BeNil()) Expect(req.Header["X-Auth-Refresh-Token"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["region"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1000))})) - Expect(req.URL.Query()["offset"]).To(Equal([]string{fmt.Sprint(int64(38))})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, `} this is not valid json {`) + fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetNamespaces with error: Operation response processing error`, func() { + It(`Invoke DeployOperators with error: Operation response processing error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -10344,23 +16818,26 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the GetNamespacesOptions model - getNamespacesOptionsModel := new(catalogmanagementv1.GetNamespacesOptions) - getNamespacesOptionsModel.ClusterID = core.StringPtr("testString") - getNamespacesOptionsModel.Region = core.StringPtr("testString") - getNamespacesOptionsModel.XAuthRefreshToken = core.StringPtr("testString") - getNamespacesOptionsModel.Limit = core.Int64Ptr(int64(1000)) - getNamespacesOptionsModel.Offset = core.Int64Ptr(int64(38)) - getNamespacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeployOperatorsOptions model + deployOperatorsOptionsModel := new(catalogmanagementv1.DeployOperatorsOptions) + deployOperatorsOptionsModel.XAuthRefreshToken = core.StringPtr("testString") + deployOperatorsOptionsModel.ClusterID = core.StringPtr("testString") + deployOperatorsOptionsModel.Region = core.StringPtr("testString") + deployOperatorsOptionsModel.Namespaces = []string{"testString"} + deployOperatorsOptionsModel.AllNamespaces = core.BoolPtr(true) + deployOperatorsOptionsModel.VersionLocatorID = core.StringPtr("testString") + deployOperatorsOptionsModel.Channel = core.StringPtr("testString") + deployOperatorsOptionsModel.InstallPlan = core.StringPtr("testString") + deployOperatorsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := catalogManagementService.GetNamespaces(getNamespacesOptionsModel) + result, response, operationErr := catalogManagementService.DeployOperators(deployOperatorsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again catalogManagementService.EnableRetries(0, 0) - result, response, operationErr = catalogManagementService.GetNamespaces(getNamespacesOptionsModel) + result, response, operationErr = catalogManagementService.DeployOperators(deployOperatorsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -10370,32 +16847,45 @@ var _ = Describe(`CatalogManagementV1`, func() { }) }) }) - Describe(`GetNamespaces(getNamespacesOptions *GetNamespacesOptions)`, func() { - getNamespacesPath := "/deploy/kubernetes/clusters/testString/namespaces" + Describe(`DeployOperators(deployOperatorsOptions *DeployOperatorsOptions)`, func() { + deployOperatorsPath := "/deploy/kubernetes/olm/operator" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getNamespacesPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(deployOperatorsPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.Header["X-Auth-Refresh-Token"]).ToNot(BeNil()) Expect(req.Header["X-Auth-Refresh-Token"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["region"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1000))})) - Expect(req.URL.Query()["offset"]).To(Equal([]string{fmt.Sprint(int64(38))})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"offset": 6, "limit": 5, "total_count": 10, "resource_count": 13, "first": "First", "last": "Last", "prev": "Prev", "next": "Next", "resources": ["Resources"]}`) + fmt.Fprintf(res, "%s", `[{"phase": "Phase", "message": "Message", "link": "Link", "name": "Name", "version": "Version", "namespace": "Namespace", "package_name": "PackageName", "catalog_id": "CatalogID"}]`) })) }) - It(`Invoke GetNamespaces successfully with retries`, func() { + It(`Invoke DeployOperators successfully with retries`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -10404,25 +16894,28 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) catalogManagementService.EnableRetries(0, 0) - // Construct an instance of the GetNamespacesOptions model - getNamespacesOptionsModel := new(catalogmanagementv1.GetNamespacesOptions) - getNamespacesOptionsModel.ClusterID = core.StringPtr("testString") - getNamespacesOptionsModel.Region = core.StringPtr("testString") - getNamespacesOptionsModel.XAuthRefreshToken = core.StringPtr("testString") - getNamespacesOptionsModel.Limit = core.Int64Ptr(int64(1000)) - getNamespacesOptionsModel.Offset = core.Int64Ptr(int64(38)) - getNamespacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeployOperatorsOptions model + deployOperatorsOptionsModel := new(catalogmanagementv1.DeployOperatorsOptions) + deployOperatorsOptionsModel.XAuthRefreshToken = core.StringPtr("testString") + deployOperatorsOptionsModel.ClusterID = core.StringPtr("testString") + deployOperatorsOptionsModel.Region = core.StringPtr("testString") + deployOperatorsOptionsModel.Namespaces = []string{"testString"} + deployOperatorsOptionsModel.AllNamespaces = core.BoolPtr(true) + deployOperatorsOptionsModel.VersionLocatorID = core.StringPtr("testString") + deployOperatorsOptionsModel.Channel = core.StringPtr("testString") + deployOperatorsOptionsModel.InstallPlan = core.StringPtr("testString") + deployOperatorsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := catalogManagementService.GetNamespacesWithContext(ctx, getNamespacesOptionsModel) + _, _, operationErr := catalogManagementService.DeployOperatorsWithContext(ctx, deployOperatorsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again catalogManagementService.DisableRetries() - result, response, operationErr := catalogManagementService.GetNamespaces(getNamespacesOptionsModel) + result, response, operationErr := catalogManagementService.DeployOperators(deployOperatorsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -10430,7 +16923,7 @@ var _ = Describe(`CatalogManagementV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = catalogManagementService.GetNamespacesWithContext(ctx, getNamespacesOptionsModel) + _, _, operationErr = catalogManagementService.DeployOperatorsWithContext(ctx, deployOperatorsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -10444,21 +16937,34 @@ var _ = Describe(`CatalogManagementV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getNamespacesPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(deployOperatorsPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.Header["X-Auth-Refresh-Token"]).ToNot(BeNil()) Expect(req.Header["X-Auth-Refresh-Token"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["region"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1000))})) - Expect(req.URL.Query()["offset"]).To(Equal([]string{fmt.Sprint(int64(38))})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"offset": 6, "limit": 5, "total_count": 10, "resource_count": 13, "first": "First", "last": "Last", "prev": "Prev", "next": "Next", "resources": ["Resources"]}`) + fmt.Fprintf(res, "%s", `[{"phase": "Phase", "message": "Message", "link": "Link", "name": "Name", "version": "Version", "namespace": "Namespace", "package_name": "PackageName", "catalog_id": "CatalogID"}]`) })) }) - It(`Invoke GetNamespaces successfully`, func() { + It(`Invoke DeployOperators successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -10467,28 +16973,31 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := catalogManagementService.GetNamespaces(nil) + result, response, operationErr := catalogManagementService.DeployOperators(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetNamespacesOptions model - getNamespacesOptionsModel := new(catalogmanagementv1.GetNamespacesOptions) - getNamespacesOptionsModel.ClusterID = core.StringPtr("testString") - getNamespacesOptionsModel.Region = core.StringPtr("testString") - getNamespacesOptionsModel.XAuthRefreshToken = core.StringPtr("testString") - getNamespacesOptionsModel.Limit = core.Int64Ptr(int64(1000)) - getNamespacesOptionsModel.Offset = core.Int64Ptr(int64(38)) - getNamespacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeployOperatorsOptions model + deployOperatorsOptionsModel := new(catalogmanagementv1.DeployOperatorsOptions) + deployOperatorsOptionsModel.XAuthRefreshToken = core.StringPtr("testString") + deployOperatorsOptionsModel.ClusterID = core.StringPtr("testString") + deployOperatorsOptionsModel.Region = core.StringPtr("testString") + deployOperatorsOptionsModel.Namespaces = []string{"testString"} + deployOperatorsOptionsModel.AllNamespaces = core.BoolPtr(true) + deployOperatorsOptionsModel.VersionLocatorID = core.StringPtr("testString") + deployOperatorsOptionsModel.Channel = core.StringPtr("testString") + deployOperatorsOptionsModel.InstallPlan = core.StringPtr("testString") + deployOperatorsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = catalogManagementService.GetNamespaces(getNamespacesOptionsModel) + result, response, operationErr = catalogManagementService.DeployOperators(deployOperatorsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetNamespaces with error: Operation validation and request error`, func() { + It(`Invoke DeployOperators with error: Operation validation and request error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -10496,26 +17005,29 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the GetNamespacesOptions model - getNamespacesOptionsModel := new(catalogmanagementv1.GetNamespacesOptions) - getNamespacesOptionsModel.ClusterID = core.StringPtr("testString") - getNamespacesOptionsModel.Region = core.StringPtr("testString") - getNamespacesOptionsModel.XAuthRefreshToken = core.StringPtr("testString") - getNamespacesOptionsModel.Limit = core.Int64Ptr(int64(1000)) - getNamespacesOptionsModel.Offset = core.Int64Ptr(int64(38)) - getNamespacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeployOperatorsOptions model + deployOperatorsOptionsModel := new(catalogmanagementv1.DeployOperatorsOptions) + deployOperatorsOptionsModel.XAuthRefreshToken = core.StringPtr("testString") + deployOperatorsOptionsModel.ClusterID = core.StringPtr("testString") + deployOperatorsOptionsModel.Region = core.StringPtr("testString") + deployOperatorsOptionsModel.Namespaces = []string{"testString"} + deployOperatorsOptionsModel.AllNamespaces = core.BoolPtr(true) + deployOperatorsOptionsModel.VersionLocatorID = core.StringPtr("testString") + deployOperatorsOptionsModel.Channel = core.StringPtr("testString") + deployOperatorsOptionsModel.InstallPlan = core.StringPtr("testString") + deployOperatorsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := catalogManagementService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := catalogManagementService.GetNamespaces(getNamespacesOptionsModel) + result, response, operationErr := catalogManagementService.DeployOperators(deployOperatorsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetNamespacesOptions model with no property values - getNamespacesOptionsModelNew := new(catalogmanagementv1.GetNamespacesOptions) + // Construct a second instance of the DeployOperatorsOptions model with no property values + deployOperatorsOptionsModelNew := new(catalogmanagementv1.DeployOperatorsOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = catalogManagementService.GetNamespaces(getNamespacesOptionsModelNew) + result, response, operationErr = catalogManagementService.DeployOperators(deployOperatorsOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -10533,7 +17045,7 @@ var _ = Describe(`CatalogManagementV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetNamespaces successfully`, func() { + It(`Invoke DeployOperators successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -10541,17 +17053,20 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the GetNamespacesOptions model - getNamespacesOptionsModel := new(catalogmanagementv1.GetNamespacesOptions) - getNamespacesOptionsModel.ClusterID = core.StringPtr("testString") - getNamespacesOptionsModel.Region = core.StringPtr("testString") - getNamespacesOptionsModel.XAuthRefreshToken = core.StringPtr("testString") - getNamespacesOptionsModel.Limit = core.Int64Ptr(int64(1000)) - getNamespacesOptionsModel.Offset = core.Int64Ptr(int64(38)) - getNamespacesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeployOperatorsOptions model + deployOperatorsOptionsModel := new(catalogmanagementv1.DeployOperatorsOptions) + deployOperatorsOptionsModel.XAuthRefreshToken = core.StringPtr("testString") + deployOperatorsOptionsModel.ClusterID = core.StringPtr("testString") + deployOperatorsOptionsModel.Region = core.StringPtr("testString") + deployOperatorsOptionsModel.Namespaces = []string{"testString"} + deployOperatorsOptionsModel.AllNamespaces = core.BoolPtr(true) + deployOperatorsOptionsModel.VersionLocatorID = core.StringPtr("testString") + deployOperatorsOptionsModel.Channel = core.StringPtr("testString") + deployOperatorsOptionsModel.InstallPlan = core.StringPtr("testString") + deployOperatorsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := catalogManagementService.GetNamespaces(getNamespacesOptionsModel) + result, response, operationErr := catalogManagementService.DeployOperators(deployOperatorsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -10563,24 +17078,27 @@ var _ = Describe(`CatalogManagementV1`, func() { }) }) }) - Describe(`DeployOperators(deployOperatorsOptions *DeployOperatorsOptions) - Operation response error`, func() { - deployOperatorsPath := "/deploy/kubernetes/olm/operator" + Describe(`ListOperators(listOperatorsOptions *ListOperatorsOptions) - Operation response error`, func() { + listOperatorsPath := "/deploy/kubernetes/olm/operator" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deployOperatorsPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(listOperatorsPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["X-Auth-Refresh-Token"]).ToNot(BeNil()) Expect(req.Header["X-Auth-Refresh-Token"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["cluster_id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["region"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["version_locator_id"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, `} this is not valid json {`) + fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke DeployOperators with error: Operation response processing error`, func() { + It(`Invoke ListOperators with error: Operation response processing error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -10588,24 +17106,22 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the DeployOperatorsOptions model - deployOperatorsOptionsModel := new(catalogmanagementv1.DeployOperatorsOptions) - deployOperatorsOptionsModel.XAuthRefreshToken = core.StringPtr("testString") - deployOperatorsOptionsModel.ClusterID = core.StringPtr("testString") - deployOperatorsOptionsModel.Region = core.StringPtr("testString") - deployOperatorsOptionsModel.Namespaces = []string{"testString"} - deployOperatorsOptionsModel.AllNamespaces = core.BoolPtr(true) - deployOperatorsOptionsModel.VersionLocatorID = core.StringPtr("testString") - deployOperatorsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListOperatorsOptions model + listOperatorsOptionsModel := new(catalogmanagementv1.ListOperatorsOptions) + listOperatorsOptionsModel.XAuthRefreshToken = core.StringPtr("testString") + listOperatorsOptionsModel.ClusterID = core.StringPtr("testString") + listOperatorsOptionsModel.Region = core.StringPtr("testString") + listOperatorsOptionsModel.VersionLocatorID = core.StringPtr("testString") + listOperatorsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := catalogManagementService.DeployOperators(deployOperatorsOptionsModel) + result, response, operationErr := catalogManagementService.ListOperators(listOperatorsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again catalogManagementService.EnableRetries(0, 0) - result, response, operationErr = catalogManagementService.DeployOperators(deployOperatorsOptionsModel) + result, response, operationErr = catalogManagementService.ListOperators(listOperatorsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -10615,35 +17131,22 @@ var _ = Describe(`CatalogManagementV1`, func() { }) }) }) - Describe(`DeployOperators(deployOperatorsOptions *DeployOperatorsOptions)`, func() { - deployOperatorsPath := "/deploy/kubernetes/olm/operator" + Describe(`ListOperators(listOperatorsOptions *ListOperatorsOptions)`, func() { + listOperatorsPath := "/deploy/kubernetes/olm/operator" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deployOperatorsPath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(listOperatorsPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["X-Auth-Refresh-Token"]).ToNot(BeNil()) Expect(req.Header["X-Auth-Refresh-Token"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["cluster_id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["region"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["version_locator_id"]).To(Equal([]string{"testString"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) @@ -10653,7 +17156,7 @@ var _ = Describe(`CatalogManagementV1`, func() { fmt.Fprintf(res, "%s", `[{"phase": "Phase", "message": "Message", "link": "Link", "name": "Name", "version": "Version", "namespace": "Namespace", "package_name": "PackageName", "catalog_id": "CatalogID"}]`) })) }) - It(`Invoke DeployOperators successfully with retries`, func() { + It(`Invoke ListOperators successfully with retries`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -10662,26 +17165,24 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) catalogManagementService.EnableRetries(0, 0) - // Construct an instance of the DeployOperatorsOptions model - deployOperatorsOptionsModel := new(catalogmanagementv1.DeployOperatorsOptions) - deployOperatorsOptionsModel.XAuthRefreshToken = core.StringPtr("testString") - deployOperatorsOptionsModel.ClusterID = core.StringPtr("testString") - deployOperatorsOptionsModel.Region = core.StringPtr("testString") - deployOperatorsOptionsModel.Namespaces = []string{"testString"} - deployOperatorsOptionsModel.AllNamespaces = core.BoolPtr(true) - deployOperatorsOptionsModel.VersionLocatorID = core.StringPtr("testString") - deployOperatorsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListOperatorsOptions model + listOperatorsOptionsModel := new(catalogmanagementv1.ListOperatorsOptions) + listOperatorsOptionsModel.XAuthRefreshToken = core.StringPtr("testString") + listOperatorsOptionsModel.ClusterID = core.StringPtr("testString") + listOperatorsOptionsModel.Region = core.StringPtr("testString") + listOperatorsOptionsModel.VersionLocatorID = core.StringPtr("testString") + listOperatorsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := catalogManagementService.DeployOperatorsWithContext(ctx, deployOperatorsOptionsModel) + _, _, operationErr := catalogManagementService.ListOperatorsWithContext(ctx, listOperatorsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again catalogManagementService.DisableRetries() - result, response, operationErr := catalogManagementService.DeployOperators(deployOperatorsOptionsModel) + result, response, operationErr := catalogManagementService.ListOperators(listOperatorsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -10689,7 +17190,7 @@ var _ = Describe(`CatalogManagementV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = catalogManagementService.DeployOperatorsWithContext(ctx, deployOperatorsOptionsModel) + _, _, operationErr = catalogManagementService.ListOperatorsWithContext(ctx, listOperatorsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -10703,34 +17204,21 @@ var _ = Describe(`CatalogManagementV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deployOperatorsPath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(listOperatorsPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["X-Auth-Refresh-Token"]).ToNot(BeNil()) Expect(req.Header["X-Auth-Refresh-Token"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["cluster_id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["region"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["version_locator_id"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprintf(res, "%s", `[{"phase": "Phase", "message": "Message", "link": "Link", "name": "Name", "version": "Version", "namespace": "Namespace", "package_name": "PackageName", "catalog_id": "CatalogID"}]`) })) }) - It(`Invoke DeployOperators successfully`, func() { + It(`Invoke ListOperators successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -10739,29 +17227,27 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := catalogManagementService.DeployOperators(nil) + result, response, operationErr := catalogManagementService.ListOperators(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the DeployOperatorsOptions model - deployOperatorsOptionsModel := new(catalogmanagementv1.DeployOperatorsOptions) - deployOperatorsOptionsModel.XAuthRefreshToken = core.StringPtr("testString") - deployOperatorsOptionsModel.ClusterID = core.StringPtr("testString") - deployOperatorsOptionsModel.Region = core.StringPtr("testString") - deployOperatorsOptionsModel.Namespaces = []string{"testString"} - deployOperatorsOptionsModel.AllNamespaces = core.BoolPtr(true) - deployOperatorsOptionsModel.VersionLocatorID = core.StringPtr("testString") - deployOperatorsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListOperatorsOptions model + listOperatorsOptionsModel := new(catalogmanagementv1.ListOperatorsOptions) + listOperatorsOptionsModel.XAuthRefreshToken = core.StringPtr("testString") + listOperatorsOptionsModel.ClusterID = core.StringPtr("testString") + listOperatorsOptionsModel.Region = core.StringPtr("testString") + listOperatorsOptionsModel.VersionLocatorID = core.StringPtr("testString") + listOperatorsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = catalogManagementService.DeployOperators(deployOperatorsOptionsModel) + result, response, operationErr = catalogManagementService.ListOperators(listOperatorsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke DeployOperators with error: Operation validation and request error`, func() { + It(`Invoke ListOperators with error: Operation validation and request error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -10769,27 +17255,25 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the DeployOperatorsOptions model - deployOperatorsOptionsModel := new(catalogmanagementv1.DeployOperatorsOptions) - deployOperatorsOptionsModel.XAuthRefreshToken = core.StringPtr("testString") - deployOperatorsOptionsModel.ClusterID = core.StringPtr("testString") - deployOperatorsOptionsModel.Region = core.StringPtr("testString") - deployOperatorsOptionsModel.Namespaces = []string{"testString"} - deployOperatorsOptionsModel.AllNamespaces = core.BoolPtr(true) - deployOperatorsOptionsModel.VersionLocatorID = core.StringPtr("testString") - deployOperatorsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListOperatorsOptions model + listOperatorsOptionsModel := new(catalogmanagementv1.ListOperatorsOptions) + listOperatorsOptionsModel.XAuthRefreshToken = core.StringPtr("testString") + listOperatorsOptionsModel.ClusterID = core.StringPtr("testString") + listOperatorsOptionsModel.Region = core.StringPtr("testString") + listOperatorsOptionsModel.VersionLocatorID = core.StringPtr("testString") + listOperatorsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := catalogManagementService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := catalogManagementService.DeployOperators(deployOperatorsOptionsModel) + result, response, operationErr := catalogManagementService.ListOperators(listOperatorsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the DeployOperatorsOptions model with no property values - deployOperatorsOptionsModelNew := new(catalogmanagementv1.DeployOperatorsOptions) + // Construct a second instance of the ListOperatorsOptions model with no property values + listOperatorsOptionsModelNew := new(catalogmanagementv1.ListOperatorsOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = catalogManagementService.DeployOperators(deployOperatorsOptionsModelNew) + result, response, operationErr = catalogManagementService.ListOperators(listOperatorsOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -10807,7 +17291,7 @@ var _ = Describe(`CatalogManagementV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke DeployOperators successfully`, func() { + It(`Invoke ListOperators successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -10815,18 +17299,16 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the DeployOperatorsOptions model - deployOperatorsOptionsModel := new(catalogmanagementv1.DeployOperatorsOptions) - deployOperatorsOptionsModel.XAuthRefreshToken = core.StringPtr("testString") - deployOperatorsOptionsModel.ClusterID = core.StringPtr("testString") - deployOperatorsOptionsModel.Region = core.StringPtr("testString") - deployOperatorsOptionsModel.Namespaces = []string{"testString"} - deployOperatorsOptionsModel.AllNamespaces = core.BoolPtr(true) - deployOperatorsOptionsModel.VersionLocatorID = core.StringPtr("testString") - deployOperatorsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListOperatorsOptions model + listOperatorsOptionsModel := new(catalogmanagementv1.ListOperatorsOptions) + listOperatorsOptionsModel.XAuthRefreshToken = core.StringPtr("testString") + listOperatorsOptionsModel.ClusterID = core.StringPtr("testString") + listOperatorsOptionsModel.Region = core.StringPtr("testString") + listOperatorsOptionsModel.VersionLocatorID = core.StringPtr("testString") + listOperatorsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := catalogManagementService.DeployOperators(deployOperatorsOptionsModel) + result, response, operationErr := catalogManagementService.ListOperators(listOperatorsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -10838,27 +17320,24 @@ var _ = Describe(`CatalogManagementV1`, func() { }) }) }) - Describe(`ListOperators(listOperatorsOptions *ListOperatorsOptions) - Operation response error`, func() { - listOperatorsPath := "/deploy/kubernetes/olm/operator" + Describe(`ReplaceOperators(replaceOperatorsOptions *ReplaceOperatorsOptions) - Operation response error`, func() { + replaceOperatorsPath := "/deploy/kubernetes/olm/operator" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listOperatorsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(replaceOperatorsPath)) + Expect(req.Method).To(Equal("PUT")) Expect(req.Header["X-Auth-Refresh-Token"]).ToNot(BeNil()) Expect(req.Header["X-Auth-Refresh-Token"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["cluster_id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["region"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["version_locator_id"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, `} this is not valid json {`) + fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListOperators with error: Operation response processing error`, func() { + It(`Invoke ReplaceOperators with error: Operation response processing error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -10866,22 +17345,26 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the ListOperatorsOptions model - listOperatorsOptionsModel := new(catalogmanagementv1.ListOperatorsOptions) - listOperatorsOptionsModel.XAuthRefreshToken = core.StringPtr("testString") - listOperatorsOptionsModel.ClusterID = core.StringPtr("testString") - listOperatorsOptionsModel.Region = core.StringPtr("testString") - listOperatorsOptionsModel.VersionLocatorID = core.StringPtr("testString") - listOperatorsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ReplaceOperatorsOptions model + replaceOperatorsOptionsModel := new(catalogmanagementv1.ReplaceOperatorsOptions) + replaceOperatorsOptionsModel.XAuthRefreshToken = core.StringPtr("testString") + replaceOperatorsOptionsModel.ClusterID = core.StringPtr("testString") + replaceOperatorsOptionsModel.Region = core.StringPtr("testString") + replaceOperatorsOptionsModel.Namespaces = []string{"testString"} + replaceOperatorsOptionsModel.AllNamespaces = core.BoolPtr(true) + replaceOperatorsOptionsModel.VersionLocatorID = core.StringPtr("testString") + replaceOperatorsOptionsModel.Channel = core.StringPtr("testString") + replaceOperatorsOptionsModel.InstallPlan = core.StringPtr("testString") + replaceOperatorsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := catalogManagementService.ListOperators(listOperatorsOptionsModel) + result, response, operationErr := catalogManagementService.ReplaceOperators(replaceOperatorsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again catalogManagementService.EnableRetries(0, 0) - result, response, operationErr = catalogManagementService.ListOperators(listOperatorsOptionsModel) + result, response, operationErr = catalogManagementService.ReplaceOperators(replaceOperatorsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -10891,22 +17374,35 @@ var _ = Describe(`CatalogManagementV1`, func() { }) }) }) - Describe(`ListOperators(listOperatorsOptions *ListOperatorsOptions)`, func() { - listOperatorsPath := "/deploy/kubernetes/olm/operator" + Describe(`ReplaceOperators(replaceOperatorsOptions *ReplaceOperatorsOptions)`, func() { + replaceOperatorsPath := "/deploy/kubernetes/olm/operator" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listOperatorsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(replaceOperatorsPath)) + Expect(req.Method).To(Equal("PUT")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.Header["X-Auth-Refresh-Token"]).ToNot(BeNil()) Expect(req.Header["X-Auth-Refresh-Token"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["cluster_id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["region"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["version_locator_id"]).To(Equal([]string{"testString"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) @@ -10916,7 +17412,7 @@ var _ = Describe(`CatalogManagementV1`, func() { fmt.Fprintf(res, "%s", `[{"phase": "Phase", "message": "Message", "link": "Link", "name": "Name", "version": "Version", "namespace": "Namespace", "package_name": "PackageName", "catalog_id": "CatalogID"}]`) })) }) - It(`Invoke ListOperators successfully with retries`, func() { + It(`Invoke ReplaceOperators successfully with retries`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -10925,24 +17421,28 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) catalogManagementService.EnableRetries(0, 0) - // Construct an instance of the ListOperatorsOptions model - listOperatorsOptionsModel := new(catalogmanagementv1.ListOperatorsOptions) - listOperatorsOptionsModel.XAuthRefreshToken = core.StringPtr("testString") - listOperatorsOptionsModel.ClusterID = core.StringPtr("testString") - listOperatorsOptionsModel.Region = core.StringPtr("testString") - listOperatorsOptionsModel.VersionLocatorID = core.StringPtr("testString") - listOperatorsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ReplaceOperatorsOptions model + replaceOperatorsOptionsModel := new(catalogmanagementv1.ReplaceOperatorsOptions) + replaceOperatorsOptionsModel.XAuthRefreshToken = core.StringPtr("testString") + replaceOperatorsOptionsModel.ClusterID = core.StringPtr("testString") + replaceOperatorsOptionsModel.Region = core.StringPtr("testString") + replaceOperatorsOptionsModel.Namespaces = []string{"testString"} + replaceOperatorsOptionsModel.AllNamespaces = core.BoolPtr(true) + replaceOperatorsOptionsModel.VersionLocatorID = core.StringPtr("testString") + replaceOperatorsOptionsModel.Channel = core.StringPtr("testString") + replaceOperatorsOptionsModel.InstallPlan = core.StringPtr("testString") + replaceOperatorsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := catalogManagementService.ListOperatorsWithContext(ctx, listOperatorsOptionsModel) + _, _, operationErr := catalogManagementService.ReplaceOperatorsWithContext(ctx, replaceOperatorsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again catalogManagementService.DisableRetries() - result, response, operationErr := catalogManagementService.ListOperators(listOperatorsOptionsModel) + result, response, operationErr := catalogManagementService.ReplaceOperators(replaceOperatorsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -10950,7 +17450,7 @@ var _ = Describe(`CatalogManagementV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = catalogManagementService.ListOperatorsWithContext(ctx, listOperatorsOptionsModel) + _, _, operationErr = catalogManagementService.ReplaceOperatorsWithContext(ctx, replaceOperatorsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -10964,21 +17464,34 @@ var _ = Describe(`CatalogManagementV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listOperatorsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(replaceOperatorsPath)) + Expect(req.Method).To(Equal("PUT")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.Header["X-Auth-Refresh-Token"]).ToNot(BeNil()) Expect(req.Header["X-Auth-Refresh-Token"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["cluster_id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["region"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["version_locator_id"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprintf(res, "%s", `[{"phase": "Phase", "message": "Message", "link": "Link", "name": "Name", "version": "Version", "namespace": "Namespace", "package_name": "PackageName", "catalog_id": "CatalogID"}]`) })) }) - It(`Invoke ListOperators successfully`, func() { + It(`Invoke ReplaceOperators successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -10987,27 +17500,31 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := catalogManagementService.ListOperators(nil) + result, response, operationErr := catalogManagementService.ReplaceOperators(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListOperatorsOptions model - listOperatorsOptionsModel := new(catalogmanagementv1.ListOperatorsOptions) - listOperatorsOptionsModel.XAuthRefreshToken = core.StringPtr("testString") - listOperatorsOptionsModel.ClusterID = core.StringPtr("testString") - listOperatorsOptionsModel.Region = core.StringPtr("testString") - listOperatorsOptionsModel.VersionLocatorID = core.StringPtr("testString") - listOperatorsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ReplaceOperatorsOptions model + replaceOperatorsOptionsModel := new(catalogmanagementv1.ReplaceOperatorsOptions) + replaceOperatorsOptionsModel.XAuthRefreshToken = core.StringPtr("testString") + replaceOperatorsOptionsModel.ClusterID = core.StringPtr("testString") + replaceOperatorsOptionsModel.Region = core.StringPtr("testString") + replaceOperatorsOptionsModel.Namespaces = []string{"testString"} + replaceOperatorsOptionsModel.AllNamespaces = core.BoolPtr(true) + replaceOperatorsOptionsModel.VersionLocatorID = core.StringPtr("testString") + replaceOperatorsOptionsModel.Channel = core.StringPtr("testString") + replaceOperatorsOptionsModel.InstallPlan = core.StringPtr("testString") + replaceOperatorsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = catalogManagementService.ListOperators(listOperatorsOptionsModel) + result, response, operationErr = catalogManagementService.ReplaceOperators(replaceOperatorsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListOperators with error: Operation validation and request error`, func() { + It(`Invoke ReplaceOperators with error: Operation validation and request error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -11015,25 +17532,29 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the ListOperatorsOptions model - listOperatorsOptionsModel := new(catalogmanagementv1.ListOperatorsOptions) - listOperatorsOptionsModel.XAuthRefreshToken = core.StringPtr("testString") - listOperatorsOptionsModel.ClusterID = core.StringPtr("testString") - listOperatorsOptionsModel.Region = core.StringPtr("testString") - listOperatorsOptionsModel.VersionLocatorID = core.StringPtr("testString") - listOperatorsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ReplaceOperatorsOptions model + replaceOperatorsOptionsModel := new(catalogmanagementv1.ReplaceOperatorsOptions) + replaceOperatorsOptionsModel.XAuthRefreshToken = core.StringPtr("testString") + replaceOperatorsOptionsModel.ClusterID = core.StringPtr("testString") + replaceOperatorsOptionsModel.Region = core.StringPtr("testString") + replaceOperatorsOptionsModel.Namespaces = []string{"testString"} + replaceOperatorsOptionsModel.AllNamespaces = core.BoolPtr(true) + replaceOperatorsOptionsModel.VersionLocatorID = core.StringPtr("testString") + replaceOperatorsOptionsModel.Channel = core.StringPtr("testString") + replaceOperatorsOptionsModel.InstallPlan = core.StringPtr("testString") + replaceOperatorsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := catalogManagementService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := catalogManagementService.ListOperators(listOperatorsOptionsModel) + result, response, operationErr := catalogManagementService.ReplaceOperators(replaceOperatorsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the ListOperatorsOptions model with no property values - listOperatorsOptionsModelNew := new(catalogmanagementv1.ListOperatorsOptions) + // Construct a second instance of the ReplaceOperatorsOptions model with no property values + replaceOperatorsOptionsModelNew := new(catalogmanagementv1.ReplaceOperatorsOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = catalogManagementService.ListOperators(listOperatorsOptionsModelNew) + result, response, operationErr = catalogManagementService.ReplaceOperators(replaceOperatorsOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -11051,7 +17572,7 @@ var _ = Describe(`CatalogManagementV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListOperators successfully`, func() { + It(`Invoke ReplaceOperators successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -11059,16 +17580,20 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the ListOperatorsOptions model - listOperatorsOptionsModel := new(catalogmanagementv1.ListOperatorsOptions) - listOperatorsOptionsModel.XAuthRefreshToken = core.StringPtr("testString") - listOperatorsOptionsModel.ClusterID = core.StringPtr("testString") - listOperatorsOptionsModel.Region = core.StringPtr("testString") - listOperatorsOptionsModel.VersionLocatorID = core.StringPtr("testString") - listOperatorsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ReplaceOperatorsOptions model + replaceOperatorsOptionsModel := new(catalogmanagementv1.ReplaceOperatorsOptions) + replaceOperatorsOptionsModel.XAuthRefreshToken = core.StringPtr("testString") + replaceOperatorsOptionsModel.ClusterID = core.StringPtr("testString") + replaceOperatorsOptionsModel.Region = core.StringPtr("testString") + replaceOperatorsOptionsModel.Namespaces = []string{"testString"} + replaceOperatorsOptionsModel.AllNamespaces = core.BoolPtr(true) + replaceOperatorsOptionsModel.VersionLocatorID = core.StringPtr("testString") + replaceOperatorsOptionsModel.Channel = core.StringPtr("testString") + replaceOperatorsOptionsModel.InstallPlan = core.StringPtr("testString") + replaceOperatorsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := catalogManagementService.ListOperators(listOperatorsOptionsModel) + result, response, operationErr := catalogManagementService.ReplaceOperators(replaceOperatorsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -11080,24 +17605,26 @@ var _ = Describe(`CatalogManagementV1`, func() { }) }) }) - Describe(`ReplaceOperators(replaceOperatorsOptions *ReplaceOperatorsOptions) - Operation response error`, func() { - replaceOperatorsPath := "/deploy/kubernetes/olm/operator" - Context(`Using mock server endpoint with invalid JSON response`, func() { + Describe(`DeleteOperators(deleteOperatorsOptions *DeleteOperatorsOptions)`, func() { + deleteOperatorsPath := "/deploy/kubernetes/olm/operator" + Context(`Using mock server endpoint`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(replaceOperatorsPath)) - Expect(req.Method).To(Equal("PUT")) + Expect(req.URL.EscapedPath()).To(Equal(deleteOperatorsPath)) + Expect(req.Method).To(Equal("DELETE")) + Expect(req.Header["X-Auth-Refresh-Token"]).ToNot(BeNil()) Expect(req.Header["X-Auth-Refresh-Token"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - res.Header().Set("Content-type", "application/json") + Expect(req.URL.Query()["cluster_id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["region"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["version_locator_id"]).To(Equal([]string{"testString"})) res.WriteHeader(200) - fmt.Fprintf(res, `} this is not valid json {`) })) }) - It(`Invoke ReplaceOperators with error: Operation response processing error`, func() { + It(`Invoke DeleteOperators successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -11105,43 +17632,68 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the ReplaceOperatorsOptions model - replaceOperatorsOptionsModel := new(catalogmanagementv1.ReplaceOperatorsOptions) - replaceOperatorsOptionsModel.XAuthRefreshToken = core.StringPtr("testString") - replaceOperatorsOptionsModel.ClusterID = core.StringPtr("testString") - replaceOperatorsOptionsModel.Region = core.StringPtr("testString") - replaceOperatorsOptionsModel.Namespaces = []string{"testString"} - replaceOperatorsOptionsModel.AllNamespaces = core.BoolPtr(true) - replaceOperatorsOptionsModel.VersionLocatorID = core.StringPtr("testString") - replaceOperatorsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := catalogManagementService.ReplaceOperators(replaceOperatorsOptionsModel) - Expect(operationErr).ToNot(BeNil()) + // Invoke operation with nil options model (negative test) + response, operationErr := catalogManagementService.DeleteOperators(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteOperatorsOptions model + deleteOperatorsOptionsModel := new(catalogmanagementv1.DeleteOperatorsOptions) + deleteOperatorsOptionsModel.XAuthRefreshToken = core.StringPtr("testString") + deleteOperatorsOptionsModel.ClusterID = core.StringPtr("testString") + deleteOperatorsOptionsModel.Region = core.StringPtr("testString") + deleteOperatorsOptionsModel.VersionLocatorID = core.StringPtr("testString") + deleteOperatorsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = catalogManagementService.DeleteOperators(deleteOperatorsOptionsModel) + Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) + }) + It(`Invoke DeleteOperators with error: Operation validation and request error`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) - // Enable retries and test again - catalogManagementService.EnableRetries(0, 0) - result, response, operationErr = catalogManagementService.ReplaceOperators(replaceOperatorsOptionsModel) + // Construct an instance of the DeleteOperatorsOptions model + deleteOperatorsOptionsModel := new(catalogmanagementv1.DeleteOperatorsOptions) + deleteOperatorsOptionsModel.XAuthRefreshToken = core.StringPtr("testString") + deleteOperatorsOptionsModel.ClusterID = core.StringPtr("testString") + deleteOperatorsOptionsModel.Region = core.StringPtr("testString") + deleteOperatorsOptionsModel.VersionLocatorID = core.StringPtr("testString") + deleteOperatorsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := catalogManagementService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := catalogManagementService.DeleteOperators(deleteOperatorsOptionsModel) Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteOperatorsOptions model with no property values + deleteOperatorsOptionsModelNew := new(catalogmanagementv1.DeleteOperatorsOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = catalogManagementService.DeleteOperators(deleteOperatorsOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) }) - Describe(`ReplaceOperators(replaceOperatorsOptions *ReplaceOperatorsOptions)`, func() { - replaceOperatorsPath := "/deploy/kubernetes/olm/operator" - Context(`Using mock server endpoint with timeout`, func() { + Describe(`InstallVersion(installVersionOptions *InstallVersionOptions)`, func() { + installVersionPath := "/versions/testString/install" + Context(`Using mock server endpoint`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(replaceOperatorsPath)) - Expect(req.Method).To(Equal("PUT")) + Expect(req.URL.EscapedPath()).To(Equal(installVersionPath)) + Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) @@ -11161,67 +17713,157 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(req.Header["X-Auth-Refresh-Token"]).ToNot(BeNil()) Expect(req.Header["X-Auth-Refresh-Token"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - // Sleep a short time to support a timeout test - time.Sleep(100 * time.Millisecond) - - // Set mock response - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `[{"phase": "Phase", "message": "Message", "link": "Link", "name": "Name", "version": "Version", "namespace": "Namespace", "package_name": "PackageName", "catalog_id": "CatalogID"}]`) + res.WriteHeader(202) })) }) - It(`Invoke ReplaceOperators successfully with retries`, func() { + It(`Invoke InstallVersion successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - catalogManagementService.EnableRetries(0, 0) - // Construct an instance of the ReplaceOperatorsOptions model - replaceOperatorsOptionsModel := new(catalogmanagementv1.ReplaceOperatorsOptions) - replaceOperatorsOptionsModel.XAuthRefreshToken = core.StringPtr("testString") - replaceOperatorsOptionsModel.ClusterID = core.StringPtr("testString") - replaceOperatorsOptionsModel.Region = core.StringPtr("testString") - replaceOperatorsOptionsModel.Namespaces = []string{"testString"} - replaceOperatorsOptionsModel.AllNamespaces = core.BoolPtr(true) - replaceOperatorsOptionsModel.VersionLocatorID = core.StringPtr("testString") - replaceOperatorsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with nil options model (negative test) + response, operationErr := catalogManagementService.InstallVersion(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) - // Invoke operation with a Context to test a timeout error - ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) - defer cancelFunc() - _, _, operationErr := catalogManagementService.ReplaceOperatorsWithContext(ctx, replaceOperatorsOptionsModel) + // Construct an instance of the DeployRequestBodyOverrideValues model + deployRequestBodyOverrideValuesModel := new(catalogmanagementv1.DeployRequestBodyOverrideValues) + deployRequestBodyOverrideValuesModel.VsiInstanceName = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.VPCProfile = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.SubnetID = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.VPCID = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.SubnetZone = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.SSHKeyID = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.VPCRegion = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.SetProperty("foo", core.StringPtr("testString")) + + // Construct an instance of the DeployRequestBodyEnvironmentVariablesItem model + deployRequestBodyEnvironmentVariablesItemModel := new(catalogmanagementv1.DeployRequestBodyEnvironmentVariablesItem) + deployRequestBodyEnvironmentVariablesItemModel.Name = core.StringPtr("testString") + deployRequestBodyEnvironmentVariablesItemModel.Value = core.StringPtr("testString") + deployRequestBodyEnvironmentVariablesItemModel.Secure = core.BoolPtr(true) + + // Construct an instance of the DeployRequestBodySchematics model + deployRequestBodySchematicsModel := new(catalogmanagementv1.DeployRequestBodySchematics) + deployRequestBodySchematicsModel.Name = core.StringPtr("testString") + deployRequestBodySchematicsModel.Description = core.StringPtr("testString") + deployRequestBodySchematicsModel.Tags = []string{"testString"} + deployRequestBodySchematicsModel.ResourceGroupID = core.StringPtr("testString") + deployRequestBodySchematicsModel.TerraformVersion = core.StringPtr("testString") + deployRequestBodySchematicsModel.Region = core.StringPtr("testString") + + // Construct an instance of the InstallVersionOptions model + installVersionOptionsModel := new(catalogmanagementv1.InstallVersionOptions) + installVersionOptionsModel.VersionLocID = core.StringPtr("testString") + installVersionOptionsModel.XAuthRefreshToken = core.StringPtr("testString") + installVersionOptionsModel.ClusterID = core.StringPtr("testString") + installVersionOptionsModel.Region = core.StringPtr("testString") + installVersionOptionsModel.Namespace = core.StringPtr("testString") + installVersionOptionsModel.OverrideValues = deployRequestBodyOverrideValuesModel + installVersionOptionsModel.EnvironmentVariables = []catalogmanagementv1.DeployRequestBodyEnvironmentVariablesItem{*deployRequestBodyEnvironmentVariablesItemModel} + installVersionOptionsModel.EntitlementApikey = core.StringPtr("testString") + installVersionOptionsModel.Schematics = deployRequestBodySchematicsModel + installVersionOptionsModel.Script = core.StringPtr("testString") + installVersionOptionsModel.ScriptID = core.StringPtr("testString") + installVersionOptionsModel.VersionLocatorID = core.StringPtr("testString") + installVersionOptionsModel.VcenterID = core.StringPtr("testString") + installVersionOptionsModel.VcenterLocation = core.StringPtr("testString") + installVersionOptionsModel.VcenterUser = core.StringPtr("testString") + installVersionOptionsModel.VcenterPassword = core.StringPtr("testString") + installVersionOptionsModel.VcenterDatastore = core.StringPtr("testString") + installVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = catalogManagementService.InstallVersion(installVersionOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke InstallVersion with error: Operation validation and request error`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Construct an instance of the DeployRequestBodyOverrideValues model + deployRequestBodyOverrideValuesModel := new(catalogmanagementv1.DeployRequestBodyOverrideValues) + deployRequestBodyOverrideValuesModel.VsiInstanceName = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.VPCProfile = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.SubnetID = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.VPCID = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.SubnetZone = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.SSHKeyID = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.VPCRegion = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.SetProperty("foo", core.StringPtr("testString")) + + // Construct an instance of the DeployRequestBodyEnvironmentVariablesItem model + deployRequestBodyEnvironmentVariablesItemModel := new(catalogmanagementv1.DeployRequestBodyEnvironmentVariablesItem) + deployRequestBodyEnvironmentVariablesItemModel.Name = core.StringPtr("testString") + deployRequestBodyEnvironmentVariablesItemModel.Value = core.StringPtr("testString") + deployRequestBodyEnvironmentVariablesItemModel.Secure = core.BoolPtr(true) + + // Construct an instance of the DeployRequestBodySchematics model + deployRequestBodySchematicsModel := new(catalogmanagementv1.DeployRequestBodySchematics) + deployRequestBodySchematicsModel.Name = core.StringPtr("testString") + deployRequestBodySchematicsModel.Description = core.StringPtr("testString") + deployRequestBodySchematicsModel.Tags = []string{"testString"} + deployRequestBodySchematicsModel.ResourceGroupID = core.StringPtr("testString") + deployRequestBodySchematicsModel.TerraformVersion = core.StringPtr("testString") + deployRequestBodySchematicsModel.Region = core.StringPtr("testString") + + // Construct an instance of the InstallVersionOptions model + installVersionOptionsModel := new(catalogmanagementv1.InstallVersionOptions) + installVersionOptionsModel.VersionLocID = core.StringPtr("testString") + installVersionOptionsModel.XAuthRefreshToken = core.StringPtr("testString") + installVersionOptionsModel.ClusterID = core.StringPtr("testString") + installVersionOptionsModel.Region = core.StringPtr("testString") + installVersionOptionsModel.Namespace = core.StringPtr("testString") + installVersionOptionsModel.OverrideValues = deployRequestBodyOverrideValuesModel + installVersionOptionsModel.EnvironmentVariables = []catalogmanagementv1.DeployRequestBodyEnvironmentVariablesItem{*deployRequestBodyEnvironmentVariablesItemModel} + installVersionOptionsModel.EntitlementApikey = core.StringPtr("testString") + installVersionOptionsModel.Schematics = deployRequestBodySchematicsModel + installVersionOptionsModel.Script = core.StringPtr("testString") + installVersionOptionsModel.ScriptID = core.StringPtr("testString") + installVersionOptionsModel.VersionLocatorID = core.StringPtr("testString") + installVersionOptionsModel.VcenterID = core.StringPtr("testString") + installVersionOptionsModel.VcenterLocation = core.StringPtr("testString") + installVersionOptionsModel.VcenterUser = core.StringPtr("testString") + installVersionOptionsModel.VcenterPassword = core.StringPtr("testString") + installVersionOptionsModel.VcenterDatastore = core.StringPtr("testString") + installVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := catalogManagementService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := catalogManagementService.InstallVersion(installVersionOptionsModel) Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - catalogManagementService.DisableRetries() - result, response, operationErr := catalogManagementService.ReplaceOperators(replaceOperatorsOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - // Re-test the timeout error with retries disabled - ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) - defer cancelFunc2() - _, _, operationErr = catalogManagementService.ReplaceOperatorsWithContext(ctx, replaceOperatorsOptionsModel) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the InstallVersionOptions model with no property values + installVersionOptionsModelNew := new(catalogmanagementv1.InstallVersionOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = catalogManagementService.InstallVersion(installVersionOptionsModelNew) Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + Expect(response).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) + }) + Describe(`PreinstallVersion(preinstallVersionOptions *PreinstallVersionOptions)`, func() { + preinstallVersionPath := "/versions/testString/preinstall" Context(`Using mock server endpoint`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(replaceOperatorsPath)) - Expect(req.Method).To(Equal("PUT")) + Expect(req.URL.EscapedPath()).To(Equal(preinstallVersionPath)) + Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) @@ -11241,13 +17883,10 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(req.Header["X-Auth-Refresh-Token"]).ToNot(BeNil()) Expect(req.Header["X-Auth-Refresh-Token"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - // Set mock response - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `[{"phase": "Phase", "message": "Message", "link": "Link", "name": "Name", "version": "Version", "namespace": "Namespace", "package_name": "PackageName", "catalog_id": "CatalogID"}]`) + res.WriteHeader(202) })) }) - It(`Invoke ReplaceOperators successfully`, func() { + It(`Invoke PreinstallVersion successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -11256,29 +17895,63 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := catalogManagementService.ReplaceOperators(nil) + response, operationErr := catalogManagementService.PreinstallVersion(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - // Construct an instance of the ReplaceOperatorsOptions model - replaceOperatorsOptionsModel := new(catalogmanagementv1.ReplaceOperatorsOptions) - replaceOperatorsOptionsModel.XAuthRefreshToken = core.StringPtr("testString") - replaceOperatorsOptionsModel.ClusterID = core.StringPtr("testString") - replaceOperatorsOptionsModel.Region = core.StringPtr("testString") - replaceOperatorsOptionsModel.Namespaces = []string{"testString"} - replaceOperatorsOptionsModel.AllNamespaces = core.BoolPtr(true) - replaceOperatorsOptionsModel.VersionLocatorID = core.StringPtr("testString") - replaceOperatorsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeployRequestBodyOverrideValues model + deployRequestBodyOverrideValuesModel := new(catalogmanagementv1.DeployRequestBodyOverrideValues) + deployRequestBodyOverrideValuesModel.VsiInstanceName = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.VPCProfile = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.SubnetID = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.VPCID = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.SubnetZone = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.SSHKeyID = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.VPCRegion = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.SetProperty("foo", core.StringPtr("testString")) + + // Construct an instance of the DeployRequestBodyEnvironmentVariablesItem model + deployRequestBodyEnvironmentVariablesItemModel := new(catalogmanagementv1.DeployRequestBodyEnvironmentVariablesItem) + deployRequestBodyEnvironmentVariablesItemModel.Name = core.StringPtr("testString") + deployRequestBodyEnvironmentVariablesItemModel.Value = core.StringPtr("testString") + deployRequestBodyEnvironmentVariablesItemModel.Secure = core.BoolPtr(true) + + // Construct an instance of the DeployRequestBodySchematics model + deployRequestBodySchematicsModel := new(catalogmanagementv1.DeployRequestBodySchematics) + deployRequestBodySchematicsModel.Name = core.StringPtr("testString") + deployRequestBodySchematicsModel.Description = core.StringPtr("testString") + deployRequestBodySchematicsModel.Tags = []string{"testString"} + deployRequestBodySchematicsModel.ResourceGroupID = core.StringPtr("testString") + deployRequestBodySchematicsModel.TerraformVersion = core.StringPtr("testString") + deployRequestBodySchematicsModel.Region = core.StringPtr("testString") + + // Construct an instance of the PreinstallVersionOptions model + preinstallVersionOptionsModel := new(catalogmanagementv1.PreinstallVersionOptions) + preinstallVersionOptionsModel.VersionLocID = core.StringPtr("testString") + preinstallVersionOptionsModel.XAuthRefreshToken = core.StringPtr("testString") + preinstallVersionOptionsModel.ClusterID = core.StringPtr("testString") + preinstallVersionOptionsModel.Region = core.StringPtr("testString") + preinstallVersionOptionsModel.Namespace = core.StringPtr("testString") + preinstallVersionOptionsModel.OverrideValues = deployRequestBodyOverrideValuesModel + preinstallVersionOptionsModel.EnvironmentVariables = []catalogmanagementv1.DeployRequestBodyEnvironmentVariablesItem{*deployRequestBodyEnvironmentVariablesItemModel} + preinstallVersionOptionsModel.EntitlementApikey = core.StringPtr("testString") + preinstallVersionOptionsModel.Schematics = deployRequestBodySchematicsModel + preinstallVersionOptionsModel.Script = core.StringPtr("testString") + preinstallVersionOptionsModel.ScriptID = core.StringPtr("testString") + preinstallVersionOptionsModel.VersionLocatorID = core.StringPtr("testString") + preinstallVersionOptionsModel.VcenterID = core.StringPtr("testString") + preinstallVersionOptionsModel.VcenterLocation = core.StringPtr("testString") + preinstallVersionOptionsModel.VcenterUser = core.StringPtr("testString") + preinstallVersionOptionsModel.VcenterPassword = core.StringPtr("testString") + preinstallVersionOptionsModel.VcenterDatastore = core.StringPtr("testString") + preinstallVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = catalogManagementService.ReplaceOperators(replaceOperatorsOptionsModel) + response, operationErr = catalogManagementService.PreinstallVersion(preinstallVersionOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - }) - It(`Invoke ReplaceOperators with error: Operation validation and request error`, func() { + It(`Invoke PreinstallVersion with error: Operation validation and request error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -11286,95 +17959,214 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the ReplaceOperatorsOptions model - replaceOperatorsOptionsModel := new(catalogmanagementv1.ReplaceOperatorsOptions) - replaceOperatorsOptionsModel.XAuthRefreshToken = core.StringPtr("testString") - replaceOperatorsOptionsModel.ClusterID = core.StringPtr("testString") - replaceOperatorsOptionsModel.Region = core.StringPtr("testString") - replaceOperatorsOptionsModel.Namespaces = []string{"testString"} - replaceOperatorsOptionsModel.AllNamespaces = core.BoolPtr(true) - replaceOperatorsOptionsModel.VersionLocatorID = core.StringPtr("testString") - replaceOperatorsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeployRequestBodyOverrideValues model + deployRequestBodyOverrideValuesModel := new(catalogmanagementv1.DeployRequestBodyOverrideValues) + deployRequestBodyOverrideValuesModel.VsiInstanceName = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.VPCProfile = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.SubnetID = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.VPCID = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.SubnetZone = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.SSHKeyID = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.VPCRegion = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.SetProperty("foo", core.StringPtr("testString")) + + // Construct an instance of the DeployRequestBodyEnvironmentVariablesItem model + deployRequestBodyEnvironmentVariablesItemModel := new(catalogmanagementv1.DeployRequestBodyEnvironmentVariablesItem) + deployRequestBodyEnvironmentVariablesItemModel.Name = core.StringPtr("testString") + deployRequestBodyEnvironmentVariablesItemModel.Value = core.StringPtr("testString") + deployRequestBodyEnvironmentVariablesItemModel.Secure = core.BoolPtr(true) + + // Construct an instance of the DeployRequestBodySchematics model + deployRequestBodySchematicsModel := new(catalogmanagementv1.DeployRequestBodySchematics) + deployRequestBodySchematicsModel.Name = core.StringPtr("testString") + deployRequestBodySchematicsModel.Description = core.StringPtr("testString") + deployRequestBodySchematicsModel.Tags = []string{"testString"} + deployRequestBodySchematicsModel.ResourceGroupID = core.StringPtr("testString") + deployRequestBodySchematicsModel.TerraformVersion = core.StringPtr("testString") + deployRequestBodySchematicsModel.Region = core.StringPtr("testString") + + // Construct an instance of the PreinstallVersionOptions model + preinstallVersionOptionsModel := new(catalogmanagementv1.PreinstallVersionOptions) + preinstallVersionOptionsModel.VersionLocID = core.StringPtr("testString") + preinstallVersionOptionsModel.XAuthRefreshToken = core.StringPtr("testString") + preinstallVersionOptionsModel.ClusterID = core.StringPtr("testString") + preinstallVersionOptionsModel.Region = core.StringPtr("testString") + preinstallVersionOptionsModel.Namespace = core.StringPtr("testString") + preinstallVersionOptionsModel.OverrideValues = deployRequestBodyOverrideValuesModel + preinstallVersionOptionsModel.EnvironmentVariables = []catalogmanagementv1.DeployRequestBodyEnvironmentVariablesItem{*deployRequestBodyEnvironmentVariablesItemModel} + preinstallVersionOptionsModel.EntitlementApikey = core.StringPtr("testString") + preinstallVersionOptionsModel.Schematics = deployRequestBodySchematicsModel + preinstallVersionOptionsModel.Script = core.StringPtr("testString") + preinstallVersionOptionsModel.ScriptID = core.StringPtr("testString") + preinstallVersionOptionsModel.VersionLocatorID = core.StringPtr("testString") + preinstallVersionOptionsModel.VcenterID = core.StringPtr("testString") + preinstallVersionOptionsModel.VcenterLocation = core.StringPtr("testString") + preinstallVersionOptionsModel.VcenterUser = core.StringPtr("testString") + preinstallVersionOptionsModel.VcenterPassword = core.StringPtr("testString") + preinstallVersionOptionsModel.VcenterDatastore = core.StringPtr("testString") + preinstallVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := catalogManagementService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := catalogManagementService.ReplaceOperators(replaceOperatorsOptionsModel) + response, operationErr := catalogManagementService.PreinstallVersion(preinstallVersionOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - // Construct a second instance of the ReplaceOperatorsOptions model with no property values - replaceOperatorsOptionsModelNew := new(catalogmanagementv1.ReplaceOperatorsOptions) + // Construct a second instance of the PreinstallVersionOptions model with no property values + preinstallVersionOptionsModelNew := new(catalogmanagementv1.PreinstallVersionOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = catalogManagementService.ReplaceOperators(replaceOperatorsOptionsModelNew) + response, operationErr = catalogManagementService.PreinstallVersion(preinstallVersionOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetPreinstall(getPreinstallOptions *GetPreinstallOptions) - Operation response error`, func() { + getPreinstallPath := "/versions/testString/preinstall" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getPreinstallPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.Header["X-Auth-Refresh-Token"]).ToNot(BeNil()) + Expect(req.Header["X-Auth-Refresh-Token"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["cluster_id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["region"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["namespace"]).To(Equal([]string{"testString"})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke GetPreinstall with error: Operation response processing error`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Construct an instance of the GetPreinstallOptions model + getPreinstallOptionsModel := new(catalogmanagementv1.GetPreinstallOptions) + getPreinstallOptionsModel.VersionLocID = core.StringPtr("testString") + getPreinstallOptionsModel.XAuthRefreshToken = core.StringPtr("testString") + getPreinstallOptionsModel.ClusterID = core.StringPtr("testString") + getPreinstallOptionsModel.Region = core.StringPtr("testString") + getPreinstallOptionsModel.Namespace = core.StringPtr("testString") + getPreinstallOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := catalogManagementService.GetPreinstall(getPreinstallOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + catalogManagementService.EnableRetries(0, 0) + result, response, operationErr = catalogManagementService.GetPreinstall(getPreinstallOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) - Context(`Using mock server endpoint with missing response body`, func() { + }) + Describe(`GetPreinstall(getPreinstallOptions *GetPreinstallOptions)`, func() { + getPreinstallPath := "/versions/testString/preinstall" + Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() - // Set success status code with no respoonse body + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getPreinstallPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.Header["X-Auth-Refresh-Token"]).ToNot(BeNil()) + Expect(req.Header["X-Auth-Refresh-Token"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["cluster_id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["region"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["namespace"]).To(Equal([]string{"testString"})) + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"metadata": {"cluster_id": "ClusterID", "region": "Region", "namespace": "Namespace", "workspace_id": "WorkspaceID", "workspace_name": "WorkspaceName"}, "release": {"deployments": [{"mapKey": "anyValue"}], "replicasets": [{"mapKey": "anyValue"}], "statefulsets": [{"mapKey": "anyValue"}], "pods": [{"mapKey": "anyValue"}], "errors": [{"mapKey": "Inner"}]}, "content_mgmt": {"pods": [{"mapKey": "Inner"}], "errors": [{"mapKey": "Inner"}]}}`) })) }) - It(`Invoke ReplaceOperators successfully`, func() { + It(`Invoke GetPreinstall successfully with retries`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) + catalogManagementService.EnableRetries(0, 0) - // Construct an instance of the ReplaceOperatorsOptions model - replaceOperatorsOptionsModel := new(catalogmanagementv1.ReplaceOperatorsOptions) - replaceOperatorsOptionsModel.XAuthRefreshToken = core.StringPtr("testString") - replaceOperatorsOptionsModel.ClusterID = core.StringPtr("testString") - replaceOperatorsOptionsModel.Region = core.StringPtr("testString") - replaceOperatorsOptionsModel.Namespaces = []string{"testString"} - replaceOperatorsOptionsModel.AllNamespaces = core.BoolPtr(true) - replaceOperatorsOptionsModel.VersionLocatorID = core.StringPtr("testString") - replaceOperatorsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetPreinstallOptions model + getPreinstallOptionsModel := new(catalogmanagementv1.GetPreinstallOptions) + getPreinstallOptionsModel.VersionLocID = core.StringPtr("testString") + getPreinstallOptionsModel.XAuthRefreshToken = core.StringPtr("testString") + getPreinstallOptionsModel.ClusterID = core.StringPtr("testString") + getPreinstallOptionsModel.Region = core.StringPtr("testString") + getPreinstallOptionsModel.Namespace = core.StringPtr("testString") + getPreinstallOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation - result, response, operationErr := catalogManagementService.ReplaceOperators(replaceOperatorsOptionsModel) + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := catalogManagementService.GetPreinstallWithContext(ctx, getPreinstallOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + catalogManagementService.DisableRetries() + result, response, operationErr := catalogManagementService.GetPreinstall(getPreinstallOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) - // Verify a nil result - Expect(result).To(BeNil()) + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = catalogManagementService.GetPreinstallWithContext(ctx, getPreinstallOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) AfterEach(func() { testServer.Close() }) }) - }) - Describe(`DeleteOperators(deleteOperatorsOptions *DeleteOperatorsOptions)`, func() { - deleteOperatorsPath := "/deploy/kubernetes/olm/operator" Context(`Using mock server endpoint`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteOperatorsPath)) - Expect(req.Method).To(Equal("DELETE")) + Expect(req.URL.EscapedPath()).To(Equal(getPreinstallPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["X-Auth-Refresh-Token"]).ToNot(BeNil()) Expect(req.Header["X-Auth-Refresh-Token"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) Expect(req.URL.Query()["cluster_id"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["region"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["version_locator_id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["namespace"]).To(Equal([]string{"testString"})) + // Set mock response + res.Header().Set("Content-type", "application/json") res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"metadata": {"cluster_id": "ClusterID", "region": "Region", "namespace": "Namespace", "workspace_id": "WorkspaceID", "workspace_name": "WorkspaceName"}, "release": {"deployments": [{"mapKey": "anyValue"}], "replicasets": [{"mapKey": "anyValue"}], "statefulsets": [{"mapKey": "anyValue"}], "pods": [{"mapKey": "anyValue"}], "errors": [{"mapKey": "Inner"}]}, "content_mgmt": {"pods": [{"mapKey": "Inner"}], "errors": [{"mapKey": "Inner"}]}}`) })) }) - It(`Invoke DeleteOperators successfully`, func() { + It(`Invoke GetPreinstall successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -11383,24 +18175,28 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - response, operationErr := catalogManagementService.DeleteOperators(nil) + result, response, operationErr := catalogManagementService.GetPreinstall(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) + Expect(result).To(BeNil()) - // Construct an instance of the DeleteOperatorsOptions model - deleteOperatorsOptionsModel := new(catalogmanagementv1.DeleteOperatorsOptions) - deleteOperatorsOptionsModel.XAuthRefreshToken = core.StringPtr("testString") - deleteOperatorsOptionsModel.ClusterID = core.StringPtr("testString") - deleteOperatorsOptionsModel.Region = core.StringPtr("testString") - deleteOperatorsOptionsModel.VersionLocatorID = core.StringPtr("testString") - deleteOperatorsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetPreinstallOptions model + getPreinstallOptionsModel := new(catalogmanagementv1.GetPreinstallOptions) + getPreinstallOptionsModel.VersionLocID = core.StringPtr("testString") + getPreinstallOptionsModel.XAuthRefreshToken = core.StringPtr("testString") + getPreinstallOptionsModel.ClusterID = core.StringPtr("testString") + getPreinstallOptionsModel.Region = core.StringPtr("testString") + getPreinstallOptionsModel.Namespace = core.StringPtr("testString") + getPreinstallOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - response, operationErr = catalogManagementService.DeleteOperators(deleteOperatorsOptionsModel) + result, response, operationErr = catalogManagementService.GetPreinstall(getPreinstallOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + }) - It(`Invoke DeleteOperators with error: Operation validation and request error`, func() { + It(`Invoke GetPreinstall with error: Operation validation and request error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -11408,65 +18204,44 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the DeleteOperatorsOptions model - deleteOperatorsOptionsModel := new(catalogmanagementv1.DeleteOperatorsOptions) - deleteOperatorsOptionsModel.XAuthRefreshToken = core.StringPtr("testString") - deleteOperatorsOptionsModel.ClusterID = core.StringPtr("testString") - deleteOperatorsOptionsModel.Region = core.StringPtr("testString") - deleteOperatorsOptionsModel.VersionLocatorID = core.StringPtr("testString") - deleteOperatorsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetPreinstallOptions model + getPreinstallOptionsModel := new(catalogmanagementv1.GetPreinstallOptions) + getPreinstallOptionsModel.VersionLocID = core.StringPtr("testString") + getPreinstallOptionsModel.XAuthRefreshToken = core.StringPtr("testString") + getPreinstallOptionsModel.ClusterID = core.StringPtr("testString") + getPreinstallOptionsModel.Region = core.StringPtr("testString") + getPreinstallOptionsModel.Namespace = core.StringPtr("testString") + getPreinstallOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := catalogManagementService.SetServiceURL("") Expect(err).To(BeNil()) - response, operationErr := catalogManagementService.DeleteOperators(deleteOperatorsOptionsModel) + result, response, operationErr := catalogManagementService.GetPreinstall(getPreinstallOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) - // Construct a second instance of the DeleteOperatorsOptions model with no property values - deleteOperatorsOptionsModelNew := new(catalogmanagementv1.DeleteOperatorsOptions) + Expect(result).To(BeNil()) + // Construct a second instance of the GetPreinstallOptions model with no property values + getPreinstallOptionsModelNew := new(catalogmanagementv1.GetPreinstallOptions) // Invoke operation with invalid model (negative test) - response, operationErr = catalogManagementService.DeleteOperators(deleteOperatorsOptionsModelNew) + result, response, operationErr = catalogManagementService.GetPreinstall(getPreinstallOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) - }) - Describe(`InstallVersion(installVersionOptions *InstallVersionOptions)`, func() { - installVersionPath := "/versions/testString/install" - Context(`Using mock server endpoint`, func() { + Context(`Using mock server endpoint with missing response body`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(installVersionPath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) - - Expect(req.Header["X-Auth-Refresh-Token"]).ToNot(BeNil()) - Expect(req.Header["X-Auth-Refresh-Token"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - res.WriteHeader(202) + // Set success status code with no respoonse body + res.WriteHeader(200) })) }) - It(`Invoke InstallVersion successfully`, func() { + It(`Invoke GetPreinstall successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -11474,105 +18249,37 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Invoke operation with nil options model (negative test) - response, operationErr := catalogManagementService.InstallVersion(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeployRequestBodySchematics model - deployRequestBodySchematicsModel := new(catalogmanagementv1.DeployRequestBodySchematics) - deployRequestBodySchematicsModel.Name = core.StringPtr("testString") - deployRequestBodySchematicsModel.Description = core.StringPtr("testString") - deployRequestBodySchematicsModel.Tags = []string{"testString"} - deployRequestBodySchematicsModel.ResourceGroupID = core.StringPtr("testString") - - // Construct an instance of the InstallVersionOptions model - installVersionOptionsModel := new(catalogmanagementv1.InstallVersionOptions) - installVersionOptionsModel.VersionLocID = core.StringPtr("testString") - installVersionOptionsModel.XAuthRefreshToken = core.StringPtr("testString") - installVersionOptionsModel.ClusterID = core.StringPtr("testString") - installVersionOptionsModel.Region = core.StringPtr("testString") - installVersionOptionsModel.Namespace = core.StringPtr("testString") - installVersionOptionsModel.OverrideValues = make(map[string]interface{}) - installVersionOptionsModel.EntitlementApikey = core.StringPtr("testString") - installVersionOptionsModel.Schematics = deployRequestBodySchematicsModel - installVersionOptionsModel.Script = core.StringPtr("testString") - installVersionOptionsModel.ScriptID = core.StringPtr("testString") - installVersionOptionsModel.VersionLocatorID = core.StringPtr("testString") - installVersionOptionsModel.VcenterID = core.StringPtr("testString") - installVersionOptionsModel.VcenterUser = core.StringPtr("testString") - installVersionOptionsModel.VcenterPassword = core.StringPtr("testString") - installVersionOptionsModel.VcenterLocation = core.StringPtr("testString") - installVersionOptionsModel.VcenterDatastore = core.StringPtr("testString") - installVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetPreinstallOptions model + getPreinstallOptionsModel := new(catalogmanagementv1.GetPreinstallOptions) + getPreinstallOptionsModel.VersionLocID = core.StringPtr("testString") + getPreinstallOptionsModel.XAuthRefreshToken = core.StringPtr("testString") + getPreinstallOptionsModel.ClusterID = core.StringPtr("testString") + getPreinstallOptionsModel.Region = core.StringPtr("testString") + getPreinstallOptionsModel.Namespace = core.StringPtr("testString") + getPreinstallOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with valid options model (positive test) - response, operationErr = catalogManagementService.InstallVersion(installVersionOptionsModel) + // Invoke operation + result, response, operationErr := catalogManagementService.GetPreinstall(getPreinstallOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) - }) - It(`Invoke InstallVersion with error: Operation validation and request error`, func() { - catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(catalogManagementService).ToNot(BeNil()) - - // Construct an instance of the DeployRequestBodySchematics model - deployRequestBodySchematicsModel := new(catalogmanagementv1.DeployRequestBodySchematics) - deployRequestBodySchematicsModel.Name = core.StringPtr("testString") - deployRequestBodySchematicsModel.Description = core.StringPtr("testString") - deployRequestBodySchematicsModel.Tags = []string{"testString"} - deployRequestBodySchematicsModel.ResourceGroupID = core.StringPtr("testString") - // Construct an instance of the InstallVersionOptions model - installVersionOptionsModel := new(catalogmanagementv1.InstallVersionOptions) - installVersionOptionsModel.VersionLocID = core.StringPtr("testString") - installVersionOptionsModel.XAuthRefreshToken = core.StringPtr("testString") - installVersionOptionsModel.ClusterID = core.StringPtr("testString") - installVersionOptionsModel.Region = core.StringPtr("testString") - installVersionOptionsModel.Namespace = core.StringPtr("testString") - installVersionOptionsModel.OverrideValues = make(map[string]interface{}) - installVersionOptionsModel.EntitlementApikey = core.StringPtr("testString") - installVersionOptionsModel.Schematics = deployRequestBodySchematicsModel - installVersionOptionsModel.Script = core.StringPtr("testString") - installVersionOptionsModel.ScriptID = core.StringPtr("testString") - installVersionOptionsModel.VersionLocatorID = core.StringPtr("testString") - installVersionOptionsModel.VcenterID = core.StringPtr("testString") - installVersionOptionsModel.VcenterUser = core.StringPtr("testString") - installVersionOptionsModel.VcenterPassword = core.StringPtr("testString") - installVersionOptionsModel.VcenterLocation = core.StringPtr("testString") - installVersionOptionsModel.VcenterDatastore = core.StringPtr("testString") - installVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := catalogManagementService.SetServiceURL("") - Expect(err).To(BeNil()) - response, operationErr := catalogManagementService.InstallVersion(installVersionOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the InstallVersionOptions model with no property values - installVersionOptionsModelNew := new(catalogmanagementv1.InstallVersionOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = catalogManagementService.InstallVersion(installVersionOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) + // Verify a nil result + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) }) - Describe(`PreinstallVersion(preinstallVersionOptions *PreinstallVersionOptions)`, func() { - preinstallVersionPath := "/versions/testString/preinstall" + Describe(`ValidateInstall(validateInstallOptions *ValidateInstallOptions)`, func() { + validateInstallPath := "/versions/testString/validation/install" Context(`Using mock server endpoint`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(preinstallVersionPath)) + Expect(req.URL.EscapedPath()).To(Equal(validateInstallPath)) Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -11596,7 +18303,7 @@ var _ = Describe(`CatalogManagementV1`, func() { res.WriteHeader(202) })) }) - It(`Invoke PreinstallVersion successfully`, func() { + It(`Invoke ValidateInstall successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -11605,43 +18312,63 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - response, operationErr := catalogManagementService.PreinstallVersion(nil) + response, operationErr := catalogManagementService.ValidateInstall(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) + // Construct an instance of the DeployRequestBodyOverrideValues model + deployRequestBodyOverrideValuesModel := new(catalogmanagementv1.DeployRequestBodyOverrideValues) + deployRequestBodyOverrideValuesModel.VsiInstanceName = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.VPCProfile = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.SubnetID = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.VPCID = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.SubnetZone = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.SSHKeyID = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.VPCRegion = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.SetProperty("foo", core.StringPtr("testString")) + + // Construct an instance of the DeployRequestBodyEnvironmentVariablesItem model + deployRequestBodyEnvironmentVariablesItemModel := new(catalogmanagementv1.DeployRequestBodyEnvironmentVariablesItem) + deployRequestBodyEnvironmentVariablesItemModel.Name = core.StringPtr("testString") + deployRequestBodyEnvironmentVariablesItemModel.Value = core.StringPtr("testString") + deployRequestBodyEnvironmentVariablesItemModel.Secure = core.BoolPtr(true) + // Construct an instance of the DeployRequestBodySchematics model deployRequestBodySchematicsModel := new(catalogmanagementv1.DeployRequestBodySchematics) deployRequestBodySchematicsModel.Name = core.StringPtr("testString") deployRequestBodySchematicsModel.Description = core.StringPtr("testString") deployRequestBodySchematicsModel.Tags = []string{"testString"} deployRequestBodySchematicsModel.ResourceGroupID = core.StringPtr("testString") + deployRequestBodySchematicsModel.TerraformVersion = core.StringPtr("testString") + deployRequestBodySchematicsModel.Region = core.StringPtr("testString") - // Construct an instance of the PreinstallVersionOptions model - preinstallVersionOptionsModel := new(catalogmanagementv1.PreinstallVersionOptions) - preinstallVersionOptionsModel.VersionLocID = core.StringPtr("testString") - preinstallVersionOptionsModel.XAuthRefreshToken = core.StringPtr("testString") - preinstallVersionOptionsModel.ClusterID = core.StringPtr("testString") - preinstallVersionOptionsModel.Region = core.StringPtr("testString") - preinstallVersionOptionsModel.Namespace = core.StringPtr("testString") - preinstallVersionOptionsModel.OverrideValues = make(map[string]interface{}) - preinstallVersionOptionsModel.EntitlementApikey = core.StringPtr("testString") - preinstallVersionOptionsModel.Schematics = deployRequestBodySchematicsModel - preinstallVersionOptionsModel.Script = core.StringPtr("testString") - preinstallVersionOptionsModel.ScriptID = core.StringPtr("testString") - preinstallVersionOptionsModel.VersionLocatorID = core.StringPtr("testString") - preinstallVersionOptionsModel.VcenterID = core.StringPtr("testString") - preinstallVersionOptionsModel.VcenterUser = core.StringPtr("testString") - preinstallVersionOptionsModel.VcenterPassword = core.StringPtr("testString") - preinstallVersionOptionsModel.VcenterLocation = core.StringPtr("testString") - preinstallVersionOptionsModel.VcenterDatastore = core.StringPtr("testString") - preinstallVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ValidateInstallOptions model + validateInstallOptionsModel := new(catalogmanagementv1.ValidateInstallOptions) + validateInstallOptionsModel.VersionLocID = core.StringPtr("testString") + validateInstallOptionsModel.XAuthRefreshToken = core.StringPtr("testString") + validateInstallOptionsModel.ClusterID = core.StringPtr("testString") + validateInstallOptionsModel.Region = core.StringPtr("testString") + validateInstallOptionsModel.Namespace = core.StringPtr("testString") + validateInstallOptionsModel.OverrideValues = deployRequestBodyOverrideValuesModel + validateInstallOptionsModel.EnvironmentVariables = []catalogmanagementv1.DeployRequestBodyEnvironmentVariablesItem{*deployRequestBodyEnvironmentVariablesItemModel} + validateInstallOptionsModel.EntitlementApikey = core.StringPtr("testString") + validateInstallOptionsModel.Schematics = deployRequestBodySchematicsModel + validateInstallOptionsModel.Script = core.StringPtr("testString") + validateInstallOptionsModel.ScriptID = core.StringPtr("testString") + validateInstallOptionsModel.VersionLocatorID = core.StringPtr("testString") + validateInstallOptionsModel.VcenterID = core.StringPtr("testString") + validateInstallOptionsModel.VcenterLocation = core.StringPtr("testString") + validateInstallOptionsModel.VcenterUser = core.StringPtr("testString") + validateInstallOptionsModel.VcenterPassword = core.StringPtr("testString") + validateInstallOptionsModel.VcenterDatastore = core.StringPtr("testString") + validateInstallOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - response, operationErr = catalogManagementService.PreinstallVersion(preinstallVersionOptionsModel) + response, operationErr = catalogManagementService.ValidateInstall(validateInstallOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) }) - It(`Invoke PreinstallVersion with error: Operation validation and request error`, func() { + It(`Invoke ValidateInstall with error: Operation validation and request error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -11649,43 +18376,63 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the DeployRequestBodySchematics model - deployRequestBodySchematicsModel := new(catalogmanagementv1.DeployRequestBodySchematics) - deployRequestBodySchematicsModel.Name = core.StringPtr("testString") - deployRequestBodySchematicsModel.Description = core.StringPtr("testString") - deployRequestBodySchematicsModel.Tags = []string{"testString"} - deployRequestBodySchematicsModel.ResourceGroupID = core.StringPtr("testString") - - // Construct an instance of the PreinstallVersionOptions model - preinstallVersionOptionsModel := new(catalogmanagementv1.PreinstallVersionOptions) - preinstallVersionOptionsModel.VersionLocID = core.StringPtr("testString") - preinstallVersionOptionsModel.XAuthRefreshToken = core.StringPtr("testString") - preinstallVersionOptionsModel.ClusterID = core.StringPtr("testString") - preinstallVersionOptionsModel.Region = core.StringPtr("testString") - preinstallVersionOptionsModel.Namespace = core.StringPtr("testString") - preinstallVersionOptionsModel.OverrideValues = make(map[string]interface{}) - preinstallVersionOptionsModel.EntitlementApikey = core.StringPtr("testString") - preinstallVersionOptionsModel.Schematics = deployRequestBodySchematicsModel - preinstallVersionOptionsModel.Script = core.StringPtr("testString") - preinstallVersionOptionsModel.ScriptID = core.StringPtr("testString") - preinstallVersionOptionsModel.VersionLocatorID = core.StringPtr("testString") - preinstallVersionOptionsModel.VcenterID = core.StringPtr("testString") - preinstallVersionOptionsModel.VcenterUser = core.StringPtr("testString") - preinstallVersionOptionsModel.VcenterPassword = core.StringPtr("testString") - preinstallVersionOptionsModel.VcenterLocation = core.StringPtr("testString") - preinstallVersionOptionsModel.VcenterDatastore = core.StringPtr("testString") - preinstallVersionOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeployRequestBodyOverrideValues model + deployRequestBodyOverrideValuesModel := new(catalogmanagementv1.DeployRequestBodyOverrideValues) + deployRequestBodyOverrideValuesModel.VsiInstanceName = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.VPCProfile = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.SubnetID = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.VPCID = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.SubnetZone = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.SSHKeyID = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.VPCRegion = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.SetProperty("foo", core.StringPtr("testString")) + + // Construct an instance of the DeployRequestBodyEnvironmentVariablesItem model + deployRequestBodyEnvironmentVariablesItemModel := new(catalogmanagementv1.DeployRequestBodyEnvironmentVariablesItem) + deployRequestBodyEnvironmentVariablesItemModel.Name = core.StringPtr("testString") + deployRequestBodyEnvironmentVariablesItemModel.Value = core.StringPtr("testString") + deployRequestBodyEnvironmentVariablesItemModel.Secure = core.BoolPtr(true) + + // Construct an instance of the DeployRequestBodySchematics model + deployRequestBodySchematicsModel := new(catalogmanagementv1.DeployRequestBodySchematics) + deployRequestBodySchematicsModel.Name = core.StringPtr("testString") + deployRequestBodySchematicsModel.Description = core.StringPtr("testString") + deployRequestBodySchematicsModel.Tags = []string{"testString"} + deployRequestBodySchematicsModel.ResourceGroupID = core.StringPtr("testString") + deployRequestBodySchematicsModel.TerraformVersion = core.StringPtr("testString") + deployRequestBodySchematicsModel.Region = core.StringPtr("testString") + + // Construct an instance of the ValidateInstallOptions model + validateInstallOptionsModel := new(catalogmanagementv1.ValidateInstallOptions) + validateInstallOptionsModel.VersionLocID = core.StringPtr("testString") + validateInstallOptionsModel.XAuthRefreshToken = core.StringPtr("testString") + validateInstallOptionsModel.ClusterID = core.StringPtr("testString") + validateInstallOptionsModel.Region = core.StringPtr("testString") + validateInstallOptionsModel.Namespace = core.StringPtr("testString") + validateInstallOptionsModel.OverrideValues = deployRequestBodyOverrideValuesModel + validateInstallOptionsModel.EnvironmentVariables = []catalogmanagementv1.DeployRequestBodyEnvironmentVariablesItem{*deployRequestBodyEnvironmentVariablesItemModel} + validateInstallOptionsModel.EntitlementApikey = core.StringPtr("testString") + validateInstallOptionsModel.Schematics = deployRequestBodySchematicsModel + validateInstallOptionsModel.Script = core.StringPtr("testString") + validateInstallOptionsModel.ScriptID = core.StringPtr("testString") + validateInstallOptionsModel.VersionLocatorID = core.StringPtr("testString") + validateInstallOptionsModel.VcenterID = core.StringPtr("testString") + validateInstallOptionsModel.VcenterLocation = core.StringPtr("testString") + validateInstallOptionsModel.VcenterUser = core.StringPtr("testString") + validateInstallOptionsModel.VcenterPassword = core.StringPtr("testString") + validateInstallOptionsModel.VcenterDatastore = core.StringPtr("testString") + validateInstallOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := catalogManagementService.SetServiceURL("") Expect(err).To(BeNil()) - response, operationErr := catalogManagementService.PreinstallVersion(preinstallVersionOptionsModel) + response, operationErr := catalogManagementService.ValidateInstall(validateInstallOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) - // Construct a second instance of the PreinstallVersionOptions model with no property values - preinstallVersionOptionsModelNew := new(catalogmanagementv1.PreinstallVersionOptions) + // Construct a second instance of the ValidateInstallOptions model with no property values + validateInstallOptionsModelNew := new(catalogmanagementv1.ValidateInstallOptions) // Invoke operation with invalid model (negative test) - response, operationErr = catalogManagementService.PreinstallVersion(preinstallVersionOptionsModelNew) + response, operationErr = catalogManagementService.ValidateInstall(validateInstallOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) }) @@ -11694,27 +18441,24 @@ var _ = Describe(`CatalogManagementV1`, func() { }) }) }) - Describe(`GetPreinstall(getPreinstallOptions *GetPreinstallOptions) - Operation response error`, func() { - getPreinstallPath := "/versions/testString/preinstall" + Describe(`GetValidationStatus(getValidationStatusOptions *GetValidationStatusOptions) - Operation response error`, func() { + getValidationStatusPath := "/versions/testString/validation/install" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getPreinstallPath)) + Expect(req.URL.EscapedPath()).To(Equal(getValidationStatusPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["X-Auth-Refresh-Token"]).ToNot(BeNil()) Expect(req.Header["X-Auth-Refresh-Token"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["cluster_id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["region"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["namespace"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, `} this is not valid json {`) + fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetPreinstall with error: Operation response processing error`, func() { + It(`Invoke GetValidationStatus with error: Operation response processing error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -11722,23 +18466,20 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the GetPreinstallOptions model - getPreinstallOptionsModel := new(catalogmanagementv1.GetPreinstallOptions) - getPreinstallOptionsModel.VersionLocID = core.StringPtr("testString") - getPreinstallOptionsModel.XAuthRefreshToken = core.StringPtr("testString") - getPreinstallOptionsModel.ClusterID = core.StringPtr("testString") - getPreinstallOptionsModel.Region = core.StringPtr("testString") - getPreinstallOptionsModel.Namespace = core.StringPtr("testString") - getPreinstallOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetValidationStatusOptions model + getValidationStatusOptionsModel := new(catalogmanagementv1.GetValidationStatusOptions) + getValidationStatusOptionsModel.VersionLocID = core.StringPtr("testString") + getValidationStatusOptionsModel.XAuthRefreshToken = core.StringPtr("testString") + getValidationStatusOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := catalogManagementService.GetPreinstall(getPreinstallOptionsModel) + result, response, operationErr := catalogManagementService.GetValidationStatus(getValidationStatusOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again catalogManagementService.EnableRetries(0, 0) - result, response, operationErr = catalogManagementService.GetPreinstall(getPreinstallOptionsModel) + result, response, operationErr = catalogManagementService.GetValidationStatus(getValidationStatusOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -11748,32 +18489,29 @@ var _ = Describe(`CatalogManagementV1`, func() { }) }) }) - Describe(`GetPreinstall(getPreinstallOptions *GetPreinstallOptions)`, func() { - getPreinstallPath := "/versions/testString/preinstall" + Describe(`GetValidationStatus(getValidationStatusOptions *GetValidationStatusOptions)`, func() { + getValidationStatusPath := "/versions/testString/validation/install" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getPreinstallPath)) + Expect(req.URL.EscapedPath()).To(Equal(getValidationStatusPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["X-Auth-Refresh-Token"]).ToNot(BeNil()) Expect(req.Header["X-Auth-Refresh-Token"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["cluster_id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["region"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["namespace"]).To(Equal([]string{"testString"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"metadata": {"cluster_id": "ClusterID", "region": "Region", "namespace": "Namespace", "workspace_id": "WorkspaceID", "workspace_name": "WorkspaceName"}, "release": {"deployments": [{"mapKey": "anyValue"}], "replicasets": [{"mapKey": "anyValue"}], "statefulsets": [{"mapKey": "anyValue"}], "pods": [{"mapKey": "anyValue"}], "errors": [{"mapKey": "Inner"}]}, "content_mgmt": {"pods": [{"mapKey": "Inner"}], "errors": [{"mapKey": "Inner"}]}}`) + fmt.Fprintf(res, "%s", `{"validated": "2019-01-01T12:00:00.000Z", "requested": "2019-01-01T12:00:00.000Z", "state": "State", "last_operation": "LastOperation", "target": {"mapKey": "anyValue"}, "message": "Message"}`) })) }) - It(`Invoke GetPreinstall successfully with retries`, func() { + It(`Invoke GetValidationStatus successfully with retries`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -11782,25 +18520,22 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) catalogManagementService.EnableRetries(0, 0) - // Construct an instance of the GetPreinstallOptions model - getPreinstallOptionsModel := new(catalogmanagementv1.GetPreinstallOptions) - getPreinstallOptionsModel.VersionLocID = core.StringPtr("testString") - getPreinstallOptionsModel.XAuthRefreshToken = core.StringPtr("testString") - getPreinstallOptionsModel.ClusterID = core.StringPtr("testString") - getPreinstallOptionsModel.Region = core.StringPtr("testString") - getPreinstallOptionsModel.Namespace = core.StringPtr("testString") - getPreinstallOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetValidationStatusOptions model + getValidationStatusOptionsModel := new(catalogmanagementv1.GetValidationStatusOptions) + getValidationStatusOptionsModel.VersionLocID = core.StringPtr("testString") + getValidationStatusOptionsModel.XAuthRefreshToken = core.StringPtr("testString") + getValidationStatusOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := catalogManagementService.GetPreinstallWithContext(ctx, getPreinstallOptionsModel) + _, _, operationErr := catalogManagementService.GetValidationStatusWithContext(ctx, getValidationStatusOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again catalogManagementService.DisableRetries() - result, response, operationErr := catalogManagementService.GetPreinstall(getPreinstallOptionsModel) + result, response, operationErr := catalogManagementService.GetValidationStatus(getValidationStatusOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -11808,7 +18543,7 @@ var _ = Describe(`CatalogManagementV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = catalogManagementService.GetPreinstallWithContext(ctx, getPreinstallOptionsModel) + _, _, operationErr = catalogManagementService.GetValidationStatusWithContext(ctx, getValidationStatusOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -11822,21 +18557,18 @@ var _ = Describe(`CatalogManagementV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getPreinstallPath)) + Expect(req.URL.EscapedPath()).To(Equal(getValidationStatusPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["X-Auth-Refresh-Token"]).ToNot(BeNil()) Expect(req.Header["X-Auth-Refresh-Token"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["cluster_id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["region"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["namespace"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"metadata": {"cluster_id": "ClusterID", "region": "Region", "namespace": "Namespace", "workspace_id": "WorkspaceID", "workspace_name": "WorkspaceName"}, "release": {"deployments": [{"mapKey": "anyValue"}], "replicasets": [{"mapKey": "anyValue"}], "statefulsets": [{"mapKey": "anyValue"}], "pods": [{"mapKey": "anyValue"}], "errors": [{"mapKey": "Inner"}]}, "content_mgmt": {"pods": [{"mapKey": "Inner"}], "errors": [{"mapKey": "Inner"}]}}`) + fmt.Fprintf(res, "%s", `{"validated": "2019-01-01T12:00:00.000Z", "requested": "2019-01-01T12:00:00.000Z", "state": "State", "last_operation": "LastOperation", "target": {"mapKey": "anyValue"}, "message": "Message"}`) })) }) - It(`Invoke GetPreinstall successfully`, func() { + It(`Invoke GetValidationStatus successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -11845,28 +18577,25 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := catalogManagementService.GetPreinstall(nil) + result, response, operationErr := catalogManagementService.GetValidationStatus(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetPreinstallOptions model - getPreinstallOptionsModel := new(catalogmanagementv1.GetPreinstallOptions) - getPreinstallOptionsModel.VersionLocID = core.StringPtr("testString") - getPreinstallOptionsModel.XAuthRefreshToken = core.StringPtr("testString") - getPreinstallOptionsModel.ClusterID = core.StringPtr("testString") - getPreinstallOptionsModel.Region = core.StringPtr("testString") - getPreinstallOptionsModel.Namespace = core.StringPtr("testString") - getPreinstallOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetValidationStatusOptions model + getValidationStatusOptionsModel := new(catalogmanagementv1.GetValidationStatusOptions) + getValidationStatusOptionsModel.VersionLocID = core.StringPtr("testString") + getValidationStatusOptionsModel.XAuthRefreshToken = core.StringPtr("testString") + getValidationStatusOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = catalogManagementService.GetPreinstall(getPreinstallOptionsModel) + result, response, operationErr = catalogManagementService.GetValidationStatus(getValidationStatusOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetPreinstall with error: Operation validation and request error`, func() { + It(`Invoke GetValidationStatus with error: Operation validation and request error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -11874,26 +18603,23 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the GetPreinstallOptions model - getPreinstallOptionsModel := new(catalogmanagementv1.GetPreinstallOptions) - getPreinstallOptionsModel.VersionLocID = core.StringPtr("testString") - getPreinstallOptionsModel.XAuthRefreshToken = core.StringPtr("testString") - getPreinstallOptionsModel.ClusterID = core.StringPtr("testString") - getPreinstallOptionsModel.Region = core.StringPtr("testString") - getPreinstallOptionsModel.Namespace = core.StringPtr("testString") - getPreinstallOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetValidationStatusOptions model + getValidationStatusOptionsModel := new(catalogmanagementv1.GetValidationStatusOptions) + getValidationStatusOptionsModel.VersionLocID = core.StringPtr("testString") + getValidationStatusOptionsModel.XAuthRefreshToken = core.StringPtr("testString") + getValidationStatusOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := catalogManagementService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := catalogManagementService.GetPreinstall(getPreinstallOptionsModel) + result, response, operationErr := catalogManagementService.GetValidationStatus(getValidationStatusOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetPreinstallOptions model with no property values - getPreinstallOptionsModelNew := new(catalogmanagementv1.GetPreinstallOptions) + // Construct a second instance of the GetValidationStatusOptions model with no property values + getValidationStatusOptionsModelNew := new(catalogmanagementv1.GetValidationStatusOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = catalogManagementService.GetPreinstall(getPreinstallOptionsModelNew) + result, response, operationErr = catalogManagementService.GetValidationStatus(getValidationStatusOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -11911,7 +18637,7 @@ var _ = Describe(`CatalogManagementV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetPreinstall successfully`, func() { + It(`Invoke GetValidationStatus successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -11919,17 +18645,14 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the GetPreinstallOptions model - getPreinstallOptionsModel := new(catalogmanagementv1.GetPreinstallOptions) - getPreinstallOptionsModel.VersionLocID = core.StringPtr("testString") - getPreinstallOptionsModel.XAuthRefreshToken = core.StringPtr("testString") - getPreinstallOptionsModel.ClusterID = core.StringPtr("testString") - getPreinstallOptionsModel.Region = core.StringPtr("testString") - getPreinstallOptionsModel.Namespace = core.StringPtr("testString") - getPreinstallOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetValidationStatusOptions model + getValidationStatusOptionsModel := new(catalogmanagementv1.GetValidationStatusOptions) + getValidationStatusOptionsModel.VersionLocID = core.StringPtr("testString") + getValidationStatusOptionsModel.XAuthRefreshToken = core.StringPtr("testString") + getValidationStatusOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := catalogManagementService.GetPreinstall(getPreinstallOptionsModel) + result, response, operationErr := catalogManagementService.GetValidationStatus(getValidationStatusOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -11941,39 +18664,81 @@ var _ = Describe(`CatalogManagementV1`, func() { }) }) }) - Describe(`ValidateInstall(validateInstallOptions *ValidateInstallOptions)`, func() { - validateInstallPath := "/versions/testString/validation/install" - Context(`Using mock server endpoint`, func() { + Describe(`GetOverrideValues(getOverrideValuesOptions *GetOverrideValuesOptions)`, func() { + getOverrideValuesPath := "/versions/testString/validation/overridevalues" + Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(validateInstallPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(getOverrideValuesPath)) + Expect(req.Method).To(Equal("GET")) - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"mapKey": "anyValue"}`) + })) + }) + It(`Invoke GetOverrideValues successfully with retries`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + catalogManagementService.EnableRetries(0, 0) - Expect(req.Header["X-Auth-Refresh-Token"]).ToNot(BeNil()) - Expect(req.Header["X-Auth-Refresh-Token"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - res.WriteHeader(202) + // Construct an instance of the GetOverrideValuesOptions model + getOverrideValuesOptionsModel := new(catalogmanagementv1.GetOverrideValuesOptions) + getOverrideValuesOptionsModel.VersionLocID = core.StringPtr("testString") + getOverrideValuesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := catalogManagementService.GetOverrideValuesWithContext(ctx, getOverrideValuesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + catalogManagementService.DisableRetries() + result, response, operationErr := catalogManagementService.GetOverrideValues(getOverrideValuesOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = catalogManagementService.GetOverrideValuesWithContext(ctx, getOverrideValuesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getOverrideValuesPath)) + Expect(req.Method).To(Equal("GET")) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"mapKey": "anyValue"}`) })) }) - It(`Invoke ValidateInstall successfully`, func() { + It(`Invoke GetOverrideValues successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -11982,43 +18747,24 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - response, operationErr := catalogManagementService.ValidateInstall(nil) + result, response, operationErr := catalogManagementService.GetOverrideValues(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) + Expect(result).To(BeNil()) - // Construct an instance of the DeployRequestBodySchematics model - deployRequestBodySchematicsModel := new(catalogmanagementv1.DeployRequestBodySchematics) - deployRequestBodySchematicsModel.Name = core.StringPtr("testString") - deployRequestBodySchematicsModel.Description = core.StringPtr("testString") - deployRequestBodySchematicsModel.Tags = []string{"testString"} - deployRequestBodySchematicsModel.ResourceGroupID = core.StringPtr("testString") - - // Construct an instance of the ValidateInstallOptions model - validateInstallOptionsModel := new(catalogmanagementv1.ValidateInstallOptions) - validateInstallOptionsModel.VersionLocID = core.StringPtr("testString") - validateInstallOptionsModel.XAuthRefreshToken = core.StringPtr("testString") - validateInstallOptionsModel.ClusterID = core.StringPtr("testString") - validateInstallOptionsModel.Region = core.StringPtr("testString") - validateInstallOptionsModel.Namespace = core.StringPtr("testString") - validateInstallOptionsModel.OverrideValues = make(map[string]interface{}) - validateInstallOptionsModel.EntitlementApikey = core.StringPtr("testString") - validateInstallOptionsModel.Schematics = deployRequestBodySchematicsModel - validateInstallOptionsModel.Script = core.StringPtr("testString") - validateInstallOptionsModel.ScriptID = core.StringPtr("testString") - validateInstallOptionsModel.VersionLocatorID = core.StringPtr("testString") - validateInstallOptionsModel.VcenterID = core.StringPtr("testString") - validateInstallOptionsModel.VcenterUser = core.StringPtr("testString") - validateInstallOptionsModel.VcenterPassword = core.StringPtr("testString") - validateInstallOptionsModel.VcenterLocation = core.StringPtr("testString") - validateInstallOptionsModel.VcenterDatastore = core.StringPtr("testString") - validateInstallOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetOverrideValuesOptions model + getOverrideValuesOptionsModel := new(catalogmanagementv1.GetOverrideValuesOptions) + getOverrideValuesOptionsModel.VersionLocID = core.StringPtr("testString") + getOverrideValuesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - response, operationErr = catalogManagementService.ValidateInstall(validateInstallOptionsModel) + result, response, operationErr = catalogManagementService.GetOverrideValues(getOverrideValuesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + }) - It(`Invoke ValidateInstall with error: Operation validation and request error`, func() { + It(`Invoke GetOverrideValues with error: Operation validation and request error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -12026,69 +18772,87 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the DeployRequestBodySchematics model - deployRequestBodySchematicsModel := new(catalogmanagementv1.DeployRequestBodySchematics) - deployRequestBodySchematicsModel.Name = core.StringPtr("testString") - deployRequestBodySchematicsModel.Description = core.StringPtr("testString") - deployRequestBodySchematicsModel.Tags = []string{"testString"} - deployRequestBodySchematicsModel.ResourceGroupID = core.StringPtr("testString") - - // Construct an instance of the ValidateInstallOptions model - validateInstallOptionsModel := new(catalogmanagementv1.ValidateInstallOptions) - validateInstallOptionsModel.VersionLocID = core.StringPtr("testString") - validateInstallOptionsModel.XAuthRefreshToken = core.StringPtr("testString") - validateInstallOptionsModel.ClusterID = core.StringPtr("testString") - validateInstallOptionsModel.Region = core.StringPtr("testString") - validateInstallOptionsModel.Namespace = core.StringPtr("testString") - validateInstallOptionsModel.OverrideValues = make(map[string]interface{}) - validateInstallOptionsModel.EntitlementApikey = core.StringPtr("testString") - validateInstallOptionsModel.Schematics = deployRequestBodySchematicsModel - validateInstallOptionsModel.Script = core.StringPtr("testString") - validateInstallOptionsModel.ScriptID = core.StringPtr("testString") - validateInstallOptionsModel.VersionLocatorID = core.StringPtr("testString") - validateInstallOptionsModel.VcenterID = core.StringPtr("testString") - validateInstallOptionsModel.VcenterUser = core.StringPtr("testString") - validateInstallOptionsModel.VcenterPassword = core.StringPtr("testString") - validateInstallOptionsModel.VcenterLocation = core.StringPtr("testString") - validateInstallOptionsModel.VcenterDatastore = core.StringPtr("testString") - validateInstallOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetOverrideValuesOptions model + getOverrideValuesOptionsModel := new(catalogmanagementv1.GetOverrideValuesOptions) + getOverrideValuesOptionsModel.VersionLocID = core.StringPtr("testString") + getOverrideValuesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := catalogManagementService.SetServiceURL("") Expect(err).To(BeNil()) - response, operationErr := catalogManagementService.ValidateInstall(validateInstallOptionsModel) + result, response, operationErr := catalogManagementService.GetOverrideValues(getOverrideValuesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) - // Construct a second instance of the ValidateInstallOptions model with no property values - validateInstallOptionsModelNew := new(catalogmanagementv1.ValidateInstallOptions) + Expect(result).To(BeNil()) + // Construct a second instance of the GetOverrideValuesOptions model with no property values + getOverrideValuesOptionsModelNew := new(catalogmanagementv1.GetOverrideValuesOptions) // Invoke operation with invalid model (negative test) - response, operationErr = catalogManagementService.ValidateInstall(validateInstallOptionsModelNew) + result, response, operationErr = catalogManagementService.GetOverrideValues(getOverrideValuesOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke GetOverrideValues successfully`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Construct an instance of the GetOverrideValuesOptions model + getOverrideValuesOptionsModel := new(catalogmanagementv1.GetOverrideValuesOptions) + getOverrideValuesOptionsModel.VersionLocID = core.StringPtr("testString") + getOverrideValuesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := catalogManagementService.GetOverrideValues(getOverrideValuesOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) }) - Describe(`GetValidationStatus(getValidationStatusOptions *GetValidationStatusOptions) - Operation response error`, func() { - getValidationStatusPath := "/versions/testString/validation/install" + Describe(`SearchObjects(searchObjectsOptions *SearchObjectsOptions) - Operation response error`, func() { + searchObjectsPath := "/objects" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getValidationStatusPath)) + Expect(req.URL.EscapedPath()).To(Equal(searchObjectsPath)) Expect(req.Method).To(Equal("GET")) - Expect(req.Header["X-Auth-Refresh-Token"]).ToNot(BeNil()) - Expect(req.Header["X-Auth-Refresh-Token"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["query"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["kind"]).To(Equal([]string{"vpe"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1000))})) + Expect(req.URL.Query()["offset"]).To(Equal([]string{fmt.Sprint(int64(38))})) + // TODO: Add check for collapse query parameter + // TODO: Add check for digest query parameter res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, `} this is not valid json {`) + fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetValidationStatus with error: Operation response processing error`, func() { + It(`Invoke SearchObjects with error: Operation response processing error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -12096,20 +18860,24 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the GetValidationStatusOptions model - getValidationStatusOptionsModel := new(catalogmanagementv1.GetValidationStatusOptions) - getValidationStatusOptionsModel.VersionLocID = core.StringPtr("testString") - getValidationStatusOptionsModel.XAuthRefreshToken = core.StringPtr("testString") - getValidationStatusOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SearchObjectsOptions model + searchObjectsOptionsModel := new(catalogmanagementv1.SearchObjectsOptions) + searchObjectsOptionsModel.Query = core.StringPtr("testString") + searchObjectsOptionsModel.Kind = core.StringPtr("vpe") + searchObjectsOptionsModel.Limit = core.Int64Ptr(int64(1000)) + searchObjectsOptionsModel.Offset = core.Int64Ptr(int64(38)) + searchObjectsOptionsModel.Collapse = core.BoolPtr(true) + searchObjectsOptionsModel.Digest = core.BoolPtr(true) + searchObjectsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := catalogManagementService.GetValidationStatus(getValidationStatusOptionsModel) + result, response, operationErr := catalogManagementService.SearchObjects(searchObjectsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again catalogManagementService.EnableRetries(0, 0) - result, response, operationErr = catalogManagementService.GetValidationStatus(getValidationStatusOptionsModel) + result, response, operationErr = catalogManagementService.SearchObjects(searchObjectsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -12119,29 +18887,33 @@ var _ = Describe(`CatalogManagementV1`, func() { }) }) }) - Describe(`GetValidationStatus(getValidationStatusOptions *GetValidationStatusOptions)`, func() { - getValidationStatusPath := "/versions/testString/validation/install" + Describe(`SearchObjects(searchObjectsOptions *SearchObjectsOptions)`, func() { + searchObjectsPath := "/objects" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getValidationStatusPath)) + Expect(req.URL.EscapedPath()).To(Equal(searchObjectsPath)) Expect(req.Method).To(Equal("GET")) - Expect(req.Header["X-Auth-Refresh-Token"]).ToNot(BeNil()) - Expect(req.Header["X-Auth-Refresh-Token"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["query"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["kind"]).To(Equal([]string{"vpe"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1000))})) + Expect(req.URL.Query()["offset"]).To(Equal([]string{fmt.Sprint(int64(38))})) + // TODO: Add check for collapse query parameter + // TODO: Add check for digest query parameter // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"validated": "2019-01-01T12:00:00.000Z", "requested": "2019-01-01T12:00:00.000Z", "state": "State", "last_operation": "LastOperation", "target": {"mapKey": "anyValue"}}`) + fmt.Fprintf(res, "%s", `{"offset": 6, "limit": 5, "total_count": 10, "resource_count": 13, "first": "First", "last": "Last", "prev": "Prev", "next": "Next", "resources": [{"id": "ID", "name": "Name", "_rev": "Rev", "crn": "CRN", "url": "URL", "parent_id": "ParentID", "label_i18n": {"mapKey": "Inner"}, "label": "Label", "tags": ["Tags"], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "short_description": "ShortDescription", "short_description_i18n": {"mapKey": "Inner"}, "kind": "Kind", "publish": {"permit_ibm_public_publish": true, "ibm_approved": false, "public_approved": true, "portal_approval_record": "PortalApprovalRecord", "portal_url": "PortalURL"}, "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "catalog_id": "CatalogID", "catalog_name": "CatalogName", "data": {"mapKey": "anyValue"}}]}`) })) }) - It(`Invoke GetValidationStatus successfully with retries`, func() { + It(`Invoke SearchObjects successfully with retries`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -12150,22 +18922,26 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) catalogManagementService.EnableRetries(0, 0) - // Construct an instance of the GetValidationStatusOptions model - getValidationStatusOptionsModel := new(catalogmanagementv1.GetValidationStatusOptions) - getValidationStatusOptionsModel.VersionLocID = core.StringPtr("testString") - getValidationStatusOptionsModel.XAuthRefreshToken = core.StringPtr("testString") - getValidationStatusOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SearchObjectsOptions model + searchObjectsOptionsModel := new(catalogmanagementv1.SearchObjectsOptions) + searchObjectsOptionsModel.Query = core.StringPtr("testString") + searchObjectsOptionsModel.Kind = core.StringPtr("vpe") + searchObjectsOptionsModel.Limit = core.Int64Ptr(int64(1000)) + searchObjectsOptionsModel.Offset = core.Int64Ptr(int64(38)) + searchObjectsOptionsModel.Collapse = core.BoolPtr(true) + searchObjectsOptionsModel.Digest = core.BoolPtr(true) + searchObjectsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := catalogManagementService.GetValidationStatusWithContext(ctx, getValidationStatusOptionsModel) + _, _, operationErr := catalogManagementService.SearchObjectsWithContext(ctx, searchObjectsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again catalogManagementService.DisableRetries() - result, response, operationErr := catalogManagementService.GetValidationStatus(getValidationStatusOptionsModel) + result, response, operationErr := catalogManagementService.SearchObjects(searchObjectsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -12173,7 +18949,7 @@ var _ = Describe(`CatalogManagementV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = catalogManagementService.GetValidationStatusWithContext(ctx, getValidationStatusOptionsModel) + _, _, operationErr = catalogManagementService.SearchObjectsWithContext(ctx, searchObjectsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -12187,18 +18963,22 @@ var _ = Describe(`CatalogManagementV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getValidationStatusPath)) + Expect(req.URL.EscapedPath()).To(Equal(searchObjectsPath)) Expect(req.Method).To(Equal("GET")) - Expect(req.Header["X-Auth-Refresh-Token"]).ToNot(BeNil()) - Expect(req.Header["X-Auth-Refresh-Token"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["query"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["kind"]).To(Equal([]string{"vpe"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1000))})) + Expect(req.URL.Query()["offset"]).To(Equal([]string{fmt.Sprint(int64(38))})) + // TODO: Add check for collapse query parameter + // TODO: Add check for digest query parameter // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"validated": "2019-01-01T12:00:00.000Z", "requested": "2019-01-01T12:00:00.000Z", "state": "State", "last_operation": "LastOperation", "target": {"mapKey": "anyValue"}}`) + fmt.Fprintf(res, "%s", `{"offset": 6, "limit": 5, "total_count": 10, "resource_count": 13, "first": "First", "last": "Last", "prev": "Prev", "next": "Next", "resources": [{"id": "ID", "name": "Name", "_rev": "Rev", "crn": "CRN", "url": "URL", "parent_id": "ParentID", "label_i18n": {"mapKey": "Inner"}, "label": "Label", "tags": ["Tags"], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "short_description": "ShortDescription", "short_description_i18n": {"mapKey": "Inner"}, "kind": "Kind", "publish": {"permit_ibm_public_publish": true, "ibm_approved": false, "public_approved": true, "portal_approval_record": "PortalApprovalRecord", "portal_url": "PortalURL"}, "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "catalog_id": "CatalogID", "catalog_name": "CatalogName", "data": {"mapKey": "anyValue"}}]}`) })) }) - It(`Invoke GetValidationStatus successfully`, func() { + It(`Invoke SearchObjects successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -12207,25 +18987,29 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := catalogManagementService.GetValidationStatus(nil) + result, response, operationErr := catalogManagementService.SearchObjects(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetValidationStatusOptions model - getValidationStatusOptionsModel := new(catalogmanagementv1.GetValidationStatusOptions) - getValidationStatusOptionsModel.VersionLocID = core.StringPtr("testString") - getValidationStatusOptionsModel.XAuthRefreshToken = core.StringPtr("testString") - getValidationStatusOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SearchObjectsOptions model + searchObjectsOptionsModel := new(catalogmanagementv1.SearchObjectsOptions) + searchObjectsOptionsModel.Query = core.StringPtr("testString") + searchObjectsOptionsModel.Kind = core.StringPtr("vpe") + searchObjectsOptionsModel.Limit = core.Int64Ptr(int64(1000)) + searchObjectsOptionsModel.Offset = core.Int64Ptr(int64(38)) + searchObjectsOptionsModel.Collapse = core.BoolPtr(true) + searchObjectsOptionsModel.Digest = core.BoolPtr(true) + searchObjectsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = catalogManagementService.GetValidationStatus(getValidationStatusOptionsModel) + result, response, operationErr = catalogManagementService.SearchObjects(searchObjectsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetValidationStatus with error: Operation validation and request error`, func() { + It(`Invoke SearchObjects with error: Operation validation and request error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -12233,23 +19017,27 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the GetValidationStatusOptions model - getValidationStatusOptionsModel := new(catalogmanagementv1.GetValidationStatusOptions) - getValidationStatusOptionsModel.VersionLocID = core.StringPtr("testString") - getValidationStatusOptionsModel.XAuthRefreshToken = core.StringPtr("testString") - getValidationStatusOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SearchObjectsOptions model + searchObjectsOptionsModel := new(catalogmanagementv1.SearchObjectsOptions) + searchObjectsOptionsModel.Query = core.StringPtr("testString") + searchObjectsOptionsModel.Kind = core.StringPtr("vpe") + searchObjectsOptionsModel.Limit = core.Int64Ptr(int64(1000)) + searchObjectsOptionsModel.Offset = core.Int64Ptr(int64(38)) + searchObjectsOptionsModel.Collapse = core.BoolPtr(true) + searchObjectsOptionsModel.Digest = core.BoolPtr(true) + searchObjectsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := catalogManagementService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := catalogManagementService.GetValidationStatus(getValidationStatusOptionsModel) + result, response, operationErr := catalogManagementService.SearchObjects(searchObjectsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetValidationStatusOptions model with no property values - getValidationStatusOptionsModelNew := new(catalogmanagementv1.GetValidationStatusOptions) + // Construct a second instance of the SearchObjectsOptions model with no property values + searchObjectsOptionsModelNew := new(catalogmanagementv1.SearchObjectsOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = catalogManagementService.GetValidationStatus(getValidationStatusOptionsModelNew) + result, response, operationErr = catalogManagementService.SearchObjects(searchObjectsOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -12258,16 +19046,66 @@ var _ = Describe(`CatalogManagementV1`, func() { testServer.Close() }) }) - Context(`Using mock server endpoint with missing response body`, func() { + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke SearchObjects successfully`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Construct an instance of the SearchObjectsOptions model + searchObjectsOptionsModel := new(catalogmanagementv1.SearchObjectsOptions) + searchObjectsOptionsModel.Query = core.StringPtr("testString") + searchObjectsOptionsModel.Kind = core.StringPtr("vpe") + searchObjectsOptionsModel.Limit = core.Int64Ptr(int64(1000)) + searchObjectsOptionsModel.Offset = core.Int64Ptr(int64(38)) + searchObjectsOptionsModel.Collapse = core.BoolPtr(true) + searchObjectsOptionsModel.Digest = core.BoolPtr(true) + searchObjectsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := catalogManagementService.SearchObjects(searchObjectsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListObjects(listObjectsOptions *ListObjectsOptions) - Operation response error`, func() { + listObjectsPath := "/catalogs/testString/objects" + Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() - // Set success status code with no respoonse body + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listObjectsPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1000))})) + Expect(req.URL.Query()["offset"]).To(Equal([]string{fmt.Sprint(int64(38))})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"testString"})) + res.Header().Set("Content-type", "application/json") res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetValidationStatus successfully`, func() { + It(`Invoke ListObjects with error: Operation response processing error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -12275,18 +19113,25 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the GetValidationStatusOptions model - getValidationStatusOptionsModel := new(catalogmanagementv1.GetValidationStatusOptions) - getValidationStatusOptionsModel.VersionLocID = core.StringPtr("testString") - getValidationStatusOptionsModel.XAuthRefreshToken = core.StringPtr("testString") - getValidationStatusOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := catalogManagementService.GetValidationStatus(getValidationStatusOptionsModel) - Expect(operationErr).To(BeNil()) + // Construct an instance of the ListObjectsOptions model + listObjectsOptionsModel := new(catalogmanagementv1.ListObjectsOptions) + listObjectsOptionsModel.CatalogIdentifier = core.StringPtr("testString") + listObjectsOptionsModel.Limit = core.Int64Ptr(int64(1000)) + listObjectsOptionsModel.Offset = core.Int64Ptr(int64(38)) + listObjectsOptionsModel.Name = core.StringPtr("testString") + listObjectsOptionsModel.Sort = core.StringPtr("testString") + listObjectsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := catalogManagementService.ListObjects(listObjectsOptionsModel) + Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) - // Verify a nil result + // Enable retries and test again + catalogManagementService.EnableRetries(0, 0) + result, response, operationErr = catalogManagementService.ListObjects(listObjectsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) }) AfterEach(func() { @@ -12294,27 +19139,31 @@ var _ = Describe(`CatalogManagementV1`, func() { }) }) }) - Describe(`GetOverrideValues(getOverrideValuesOptions *GetOverrideValuesOptions)`, func() { - getOverrideValuesPath := "/versions/testString/validation/overridevalues" + Describe(`ListObjects(listObjectsOptions *ListObjectsOptions)`, func() { + listObjectsPath := "/catalogs/testString/objects" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getOverrideValuesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listObjectsPath)) Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1000))})) + Expect(req.URL.Query()["offset"]).To(Equal([]string{fmt.Sprint(int64(38))})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"testString"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"mapKey": "anyValue"}`) + fmt.Fprintf(res, "%s", `{"offset": 6, "limit": 5, "total_count": 10, "resource_count": 13, "first": "First", "last": "Last", "prev": "Prev", "next": "Next", "resources": [{"id": "ID", "name": "Name", "_rev": "Rev", "crn": "CRN", "url": "URL", "parent_id": "ParentID", "label_i18n": {"mapKey": "Inner"}, "label": "Label", "tags": ["Tags"], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "short_description": "ShortDescription", "short_description_i18n": {"mapKey": "Inner"}, "kind": "Kind", "publish": {"permit_ibm_public_publish": true, "ibm_approved": false, "public_approved": true, "portal_approval_record": "PortalApprovalRecord", "portal_url": "PortalURL"}, "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "catalog_id": "CatalogID", "catalog_name": "CatalogName", "data": {"mapKey": "anyValue"}}]}`) })) }) - It(`Invoke GetOverrideValues successfully with retries`, func() { + It(`Invoke ListObjects successfully with retries`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -12323,21 +19172,25 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) catalogManagementService.EnableRetries(0, 0) - // Construct an instance of the GetOverrideValuesOptions model - getOverrideValuesOptionsModel := new(catalogmanagementv1.GetOverrideValuesOptions) - getOverrideValuesOptionsModel.VersionLocID = core.StringPtr("testString") - getOverrideValuesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListObjectsOptions model + listObjectsOptionsModel := new(catalogmanagementv1.ListObjectsOptions) + listObjectsOptionsModel.CatalogIdentifier = core.StringPtr("testString") + listObjectsOptionsModel.Limit = core.Int64Ptr(int64(1000)) + listObjectsOptionsModel.Offset = core.Int64Ptr(int64(38)) + listObjectsOptionsModel.Name = core.StringPtr("testString") + listObjectsOptionsModel.Sort = core.StringPtr("testString") + listObjectsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := catalogManagementService.GetOverrideValuesWithContext(ctx, getOverrideValuesOptionsModel) + _, _, operationErr := catalogManagementService.ListObjectsWithContext(ctx, listObjectsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again catalogManagementService.DisableRetries() - result, response, operationErr := catalogManagementService.GetOverrideValues(getOverrideValuesOptionsModel) + result, response, operationErr := catalogManagementService.ListObjects(listObjectsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -12345,7 +19198,7 @@ var _ = Describe(`CatalogManagementV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = catalogManagementService.GetOverrideValuesWithContext(ctx, getOverrideValuesOptionsModel) + _, _, operationErr = catalogManagementService.ListObjectsWithContext(ctx, listObjectsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -12359,16 +19212,20 @@ var _ = Describe(`CatalogManagementV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getOverrideValuesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listObjectsPath)) Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1000))})) + Expect(req.URL.Query()["offset"]).To(Equal([]string{fmt.Sprint(int64(38))})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"mapKey": "anyValue"}`) + fmt.Fprintf(res, "%s", `{"offset": 6, "limit": 5, "total_count": 10, "resource_count": 13, "first": "First", "last": "Last", "prev": "Prev", "next": "Next", "resources": [{"id": "ID", "name": "Name", "_rev": "Rev", "crn": "CRN", "url": "URL", "parent_id": "ParentID", "label_i18n": {"mapKey": "Inner"}, "label": "Label", "tags": ["Tags"], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "short_description": "ShortDescription", "short_description_i18n": {"mapKey": "Inner"}, "kind": "Kind", "publish": {"permit_ibm_public_publish": true, "ibm_approved": false, "public_approved": true, "portal_approval_record": "PortalApprovalRecord", "portal_url": "PortalURL"}, "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "catalog_id": "CatalogID", "catalog_name": "CatalogName", "data": {"mapKey": "anyValue"}}]}`) })) }) - It(`Invoke GetOverrideValues successfully`, func() { + It(`Invoke ListObjects successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -12377,24 +19234,28 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := catalogManagementService.GetOverrideValues(nil) + result, response, operationErr := catalogManagementService.ListObjects(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetOverrideValuesOptions model - getOverrideValuesOptionsModel := new(catalogmanagementv1.GetOverrideValuesOptions) - getOverrideValuesOptionsModel.VersionLocID = core.StringPtr("testString") - getOverrideValuesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListObjectsOptions model + listObjectsOptionsModel := new(catalogmanagementv1.ListObjectsOptions) + listObjectsOptionsModel.CatalogIdentifier = core.StringPtr("testString") + listObjectsOptionsModel.Limit = core.Int64Ptr(int64(1000)) + listObjectsOptionsModel.Offset = core.Int64Ptr(int64(38)) + listObjectsOptionsModel.Name = core.StringPtr("testString") + listObjectsOptionsModel.Sort = core.StringPtr("testString") + listObjectsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = catalogManagementService.GetOverrideValues(getOverrideValuesOptionsModel) + result, response, operationErr = catalogManagementService.ListObjects(listObjectsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetOverrideValues with error: Operation validation and request error`, func() { + It(`Invoke ListObjects with error: Operation validation and request error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -12402,22 +19263,26 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the GetOverrideValuesOptions model - getOverrideValuesOptionsModel := new(catalogmanagementv1.GetOverrideValuesOptions) - getOverrideValuesOptionsModel.VersionLocID = core.StringPtr("testString") - getOverrideValuesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListObjectsOptions model + listObjectsOptionsModel := new(catalogmanagementv1.ListObjectsOptions) + listObjectsOptionsModel.CatalogIdentifier = core.StringPtr("testString") + listObjectsOptionsModel.Limit = core.Int64Ptr(int64(1000)) + listObjectsOptionsModel.Offset = core.Int64Ptr(int64(38)) + listObjectsOptionsModel.Name = core.StringPtr("testString") + listObjectsOptionsModel.Sort = core.StringPtr("testString") + listObjectsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := catalogManagementService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := catalogManagementService.GetOverrideValues(getOverrideValuesOptionsModel) + result, response, operationErr := catalogManagementService.ListObjects(listObjectsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetOverrideValuesOptions model with no property values - getOverrideValuesOptionsModelNew := new(catalogmanagementv1.GetOverrideValuesOptions) + // Construct a second instance of the ListObjectsOptions model with no property values + listObjectsOptionsModelNew := new(catalogmanagementv1.ListObjectsOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = catalogManagementService.GetOverrideValues(getOverrideValuesOptionsModelNew) + result, response, operationErr = catalogManagementService.ListObjects(listObjectsOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -12435,7 +19300,7 @@ var _ = Describe(`CatalogManagementV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetOverrideValues successfully`, func() { + It(`Invoke ListObjects successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -12443,13 +19308,17 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the GetOverrideValuesOptions model - getOverrideValuesOptionsModel := new(catalogmanagementv1.GetOverrideValuesOptions) - getOverrideValuesOptionsModel.VersionLocID = core.StringPtr("testString") - getOverrideValuesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListObjectsOptions model + listObjectsOptionsModel := new(catalogmanagementv1.ListObjectsOptions) + listObjectsOptionsModel.CatalogIdentifier = core.StringPtr("testString") + listObjectsOptionsModel.Limit = core.Int64Ptr(int64(1000)) + listObjectsOptionsModel.Offset = core.Int64Ptr(int64(38)) + listObjectsOptionsModel.Name = core.StringPtr("testString") + listObjectsOptionsModel.Sort = core.StringPtr("testString") + listObjectsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := catalogManagementService.GetOverrideValues(getOverrideValuesOptionsModel) + result, response, operationErr := catalogManagementService.ListObjects(listObjectsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -12461,27 +19330,22 @@ var _ = Describe(`CatalogManagementV1`, func() { }) }) }) - Describe(`SearchObjects(searchObjectsOptions *SearchObjectsOptions) - Operation response error`, func() { - searchObjectsPath := "/objects" + Describe(`CreateObject(createObjectOptions *CreateObjectOptions) - Operation response error`, func() { + createObjectPath := "/catalogs/testString/objects" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(searchObjectsPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["query"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1000))})) - Expect(req.URL.Query()["offset"]).To(Equal([]string{fmt.Sprint(int64(38))})) - // TODO: Add check for collapse query parameter - // TODO: Add check for digest query parameter + Expect(req.URL.EscapedPath()).To(Equal(createObjectPath)) + Expect(req.Method).To(Equal("POST")) res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, `} this is not valid json {`) + res.WriteHeader(201) + fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke SearchObjects with error: Operation response processing error`, func() { + It(`Invoke CreateObject with error: Operation response processing error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -12489,23 +19353,54 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the SearchObjectsOptions model - searchObjectsOptionsModel := new(catalogmanagementv1.SearchObjectsOptions) - searchObjectsOptionsModel.Query = core.StringPtr("testString") - searchObjectsOptionsModel.Limit = core.Int64Ptr(int64(1000)) - searchObjectsOptionsModel.Offset = core.Int64Ptr(int64(38)) - searchObjectsOptionsModel.Collapse = core.BoolPtr(true) - searchObjectsOptionsModel.Digest = core.BoolPtr(true) - searchObjectsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the PublishObject model + publishObjectModel := new(catalogmanagementv1.PublishObject) + publishObjectModel.PermitIBMPublicPublish = core.BoolPtr(true) + publishObjectModel.IBMApproved = core.BoolPtr(true) + publishObjectModel.PublicApproved = core.BoolPtr(true) + publishObjectModel.PortalApprovalRecord = core.StringPtr("testString") + publishObjectModel.PortalURL = core.StringPtr("testString") + + // Construct an instance of the State model + stateModel := new(catalogmanagementv1.State) + stateModel.Current = core.StringPtr("testString") + stateModel.CurrentEntered = CreateMockDateTime("2019-01-01T12:00:00.000Z") + stateModel.Pending = core.StringPtr("testString") + stateModel.PendingRequested = CreateMockDateTime("2019-01-01T12:00:00.000Z") + stateModel.Previous = core.StringPtr("testString") + + // Construct an instance of the CreateObjectOptions model + createObjectOptionsModel := new(catalogmanagementv1.CreateObjectOptions) + createObjectOptionsModel.CatalogIdentifier = core.StringPtr("testString") + createObjectOptionsModel.ID = core.StringPtr("testString") + createObjectOptionsModel.Name = core.StringPtr("testString") + createObjectOptionsModel.Rev = core.StringPtr("testString") + createObjectOptionsModel.CRN = core.StringPtr("testString") + createObjectOptionsModel.URL = core.StringPtr("testString") + createObjectOptionsModel.ParentID = core.StringPtr("testString") + createObjectOptionsModel.LabelI18n = make(map[string]string) + createObjectOptionsModel.Label = core.StringPtr("testString") + createObjectOptionsModel.Tags = []string{"testString"} + createObjectOptionsModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + createObjectOptionsModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + createObjectOptionsModel.ShortDescription = core.StringPtr("testString") + createObjectOptionsModel.ShortDescriptionI18n = make(map[string]string) + createObjectOptionsModel.Kind = core.StringPtr("testString") + createObjectOptionsModel.Publish = publishObjectModel + createObjectOptionsModel.State = stateModel + createObjectOptionsModel.CatalogID = core.StringPtr("testString") + createObjectOptionsModel.CatalogName = core.StringPtr("testString") + createObjectOptionsModel.Data = make(map[string]interface{}) + createObjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := catalogManagementService.SearchObjects(searchObjectsOptionsModel) + result, response, operationErr := catalogManagementService.CreateObject(createObjectOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again catalogManagementService.EnableRetries(0, 0) - result, response, operationErr = catalogManagementService.SearchObjects(searchObjectsOptionsModel) + result, response, operationErr = catalogManagementService.CreateObject(createObjectOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -12515,32 +19410,43 @@ var _ = Describe(`CatalogManagementV1`, func() { }) }) }) - Describe(`SearchObjects(searchObjectsOptions *SearchObjectsOptions)`, func() { - searchObjectsPath := "/objects" + Describe(`CreateObject(createObjectOptions *CreateObjectOptions)`, func() { + createObjectPath := "/catalogs/testString/objects" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(searchObjectsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createObjectPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) - Expect(req.URL.Query()["query"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1000))})) - Expect(req.URL.Query()["offset"]).To(Equal([]string{fmt.Sprint(int64(38))})) - // TODO: Add check for collapse query parameter - // TODO: Add check for digest query parameter // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"offset": 6, "limit": 5, "total_count": 10, "resource_count": 13, "first": "First", "last": "Last", "prev": "Prev", "next": "Next", "resources": [{"id": "ID", "name": "Name", "_rev": "Rev", "crn": "CRN", "url": "URL", "parent_id": "ParentID", "label_i18n": "LabelI18n", "label": "Label", "tags": ["Tags"], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "short_description": "ShortDescription", "short_description_i18n": "ShortDescriptionI18n", "kind": "Kind", "publish": {"permit_ibm_public_publish": true, "ibm_approved": false, "public_approved": true, "portal_approval_record": "PortalApprovalRecord", "portal_url": "PortalURL"}, "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "catalog_id": "CatalogID", "catalog_name": "CatalogName", "data": {"mapKey": "anyValue"}}]}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"id": "ID", "name": "Name", "_rev": "Rev", "crn": "CRN", "url": "URL", "parent_id": "ParentID", "label_i18n": {"mapKey": "Inner"}, "label": "Label", "tags": ["Tags"], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "short_description": "ShortDescription", "short_description_i18n": {"mapKey": "Inner"}, "kind": "Kind", "publish": {"permit_ibm_public_publish": true, "ibm_approved": false, "public_approved": true, "portal_approval_record": "PortalApprovalRecord", "portal_url": "PortalURL"}, "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "catalog_id": "CatalogID", "catalog_name": "CatalogName", "data": {"mapKey": "anyValue"}}`) })) }) - It(`Invoke SearchObjects successfully with retries`, func() { + It(`Invoke CreateObject successfully with retries`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -12549,25 +19455,56 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) catalogManagementService.EnableRetries(0, 0) - // Construct an instance of the SearchObjectsOptions model - searchObjectsOptionsModel := new(catalogmanagementv1.SearchObjectsOptions) - searchObjectsOptionsModel.Query = core.StringPtr("testString") - searchObjectsOptionsModel.Limit = core.Int64Ptr(int64(1000)) - searchObjectsOptionsModel.Offset = core.Int64Ptr(int64(38)) - searchObjectsOptionsModel.Collapse = core.BoolPtr(true) - searchObjectsOptionsModel.Digest = core.BoolPtr(true) - searchObjectsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the PublishObject model + publishObjectModel := new(catalogmanagementv1.PublishObject) + publishObjectModel.PermitIBMPublicPublish = core.BoolPtr(true) + publishObjectModel.IBMApproved = core.BoolPtr(true) + publishObjectModel.PublicApproved = core.BoolPtr(true) + publishObjectModel.PortalApprovalRecord = core.StringPtr("testString") + publishObjectModel.PortalURL = core.StringPtr("testString") + + // Construct an instance of the State model + stateModel := new(catalogmanagementv1.State) + stateModel.Current = core.StringPtr("testString") + stateModel.CurrentEntered = CreateMockDateTime("2019-01-01T12:00:00.000Z") + stateModel.Pending = core.StringPtr("testString") + stateModel.PendingRequested = CreateMockDateTime("2019-01-01T12:00:00.000Z") + stateModel.Previous = core.StringPtr("testString") + + // Construct an instance of the CreateObjectOptions model + createObjectOptionsModel := new(catalogmanagementv1.CreateObjectOptions) + createObjectOptionsModel.CatalogIdentifier = core.StringPtr("testString") + createObjectOptionsModel.ID = core.StringPtr("testString") + createObjectOptionsModel.Name = core.StringPtr("testString") + createObjectOptionsModel.Rev = core.StringPtr("testString") + createObjectOptionsModel.CRN = core.StringPtr("testString") + createObjectOptionsModel.URL = core.StringPtr("testString") + createObjectOptionsModel.ParentID = core.StringPtr("testString") + createObjectOptionsModel.LabelI18n = make(map[string]string) + createObjectOptionsModel.Label = core.StringPtr("testString") + createObjectOptionsModel.Tags = []string{"testString"} + createObjectOptionsModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + createObjectOptionsModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + createObjectOptionsModel.ShortDescription = core.StringPtr("testString") + createObjectOptionsModel.ShortDescriptionI18n = make(map[string]string) + createObjectOptionsModel.Kind = core.StringPtr("testString") + createObjectOptionsModel.Publish = publishObjectModel + createObjectOptionsModel.State = stateModel + createObjectOptionsModel.CatalogID = core.StringPtr("testString") + createObjectOptionsModel.CatalogName = core.StringPtr("testString") + createObjectOptionsModel.Data = make(map[string]interface{}) + createObjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := catalogManagementService.SearchObjectsWithContext(ctx, searchObjectsOptionsModel) + _, _, operationErr := catalogManagementService.CreateObjectWithContext(ctx, createObjectOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again catalogManagementService.DisableRetries() - result, response, operationErr := catalogManagementService.SearchObjects(searchObjectsOptionsModel) + result, response, operationErr := catalogManagementService.CreateObject(createObjectOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -12575,7 +19512,7 @@ var _ = Describe(`CatalogManagementV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = catalogManagementService.SearchObjectsWithContext(ctx, searchObjectsOptionsModel) + _, _, operationErr = catalogManagementService.CreateObjectWithContext(ctx, createObjectOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -12589,21 +19526,32 @@ var _ = Describe(`CatalogManagementV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(searchObjectsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createObjectPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) - Expect(req.URL.Query()["query"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1000))})) - Expect(req.URL.Query()["offset"]).To(Equal([]string{fmt.Sprint(int64(38))})) - // TODO: Add check for collapse query parameter - // TODO: Add check for digest query parameter // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"offset": 6, "limit": 5, "total_count": 10, "resource_count": 13, "first": "First", "last": "Last", "prev": "Prev", "next": "Next", "resources": [{"id": "ID", "name": "Name", "_rev": "Rev", "crn": "CRN", "url": "URL", "parent_id": "ParentID", "label_i18n": "LabelI18n", "label": "Label", "tags": ["Tags"], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "short_description": "ShortDescription", "short_description_i18n": "ShortDescriptionI18n", "kind": "Kind", "publish": {"permit_ibm_public_publish": true, "ibm_approved": false, "public_approved": true, "portal_approval_record": "PortalApprovalRecord", "portal_url": "PortalURL"}, "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "catalog_id": "CatalogID", "catalog_name": "CatalogName", "data": {"mapKey": "anyValue"}}]}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"id": "ID", "name": "Name", "_rev": "Rev", "crn": "CRN", "url": "URL", "parent_id": "ParentID", "label_i18n": {"mapKey": "Inner"}, "label": "Label", "tags": ["Tags"], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "short_description": "ShortDescription", "short_description_i18n": {"mapKey": "Inner"}, "kind": "Kind", "publish": {"permit_ibm_public_publish": true, "ibm_approved": false, "public_approved": true, "portal_approval_record": "PortalApprovalRecord", "portal_url": "PortalURL"}, "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "catalog_id": "CatalogID", "catalog_name": "CatalogName", "data": {"mapKey": "anyValue"}}`) })) }) - It(`Invoke SearchObjects successfully`, func() { + It(`Invoke CreateObject successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -12612,28 +19560,59 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := catalogManagementService.SearchObjects(nil) + result, response, operationErr := catalogManagementService.CreateObject(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the SearchObjectsOptions model - searchObjectsOptionsModel := new(catalogmanagementv1.SearchObjectsOptions) - searchObjectsOptionsModel.Query = core.StringPtr("testString") - searchObjectsOptionsModel.Limit = core.Int64Ptr(int64(1000)) - searchObjectsOptionsModel.Offset = core.Int64Ptr(int64(38)) - searchObjectsOptionsModel.Collapse = core.BoolPtr(true) - searchObjectsOptionsModel.Digest = core.BoolPtr(true) - searchObjectsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the PublishObject model + publishObjectModel := new(catalogmanagementv1.PublishObject) + publishObjectModel.PermitIBMPublicPublish = core.BoolPtr(true) + publishObjectModel.IBMApproved = core.BoolPtr(true) + publishObjectModel.PublicApproved = core.BoolPtr(true) + publishObjectModel.PortalApprovalRecord = core.StringPtr("testString") + publishObjectModel.PortalURL = core.StringPtr("testString") + + // Construct an instance of the State model + stateModel := new(catalogmanagementv1.State) + stateModel.Current = core.StringPtr("testString") + stateModel.CurrentEntered = CreateMockDateTime("2019-01-01T12:00:00.000Z") + stateModel.Pending = core.StringPtr("testString") + stateModel.PendingRequested = CreateMockDateTime("2019-01-01T12:00:00.000Z") + stateModel.Previous = core.StringPtr("testString") + + // Construct an instance of the CreateObjectOptions model + createObjectOptionsModel := new(catalogmanagementv1.CreateObjectOptions) + createObjectOptionsModel.CatalogIdentifier = core.StringPtr("testString") + createObjectOptionsModel.ID = core.StringPtr("testString") + createObjectOptionsModel.Name = core.StringPtr("testString") + createObjectOptionsModel.Rev = core.StringPtr("testString") + createObjectOptionsModel.CRN = core.StringPtr("testString") + createObjectOptionsModel.URL = core.StringPtr("testString") + createObjectOptionsModel.ParentID = core.StringPtr("testString") + createObjectOptionsModel.LabelI18n = make(map[string]string) + createObjectOptionsModel.Label = core.StringPtr("testString") + createObjectOptionsModel.Tags = []string{"testString"} + createObjectOptionsModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + createObjectOptionsModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + createObjectOptionsModel.ShortDescription = core.StringPtr("testString") + createObjectOptionsModel.ShortDescriptionI18n = make(map[string]string) + createObjectOptionsModel.Kind = core.StringPtr("testString") + createObjectOptionsModel.Publish = publishObjectModel + createObjectOptionsModel.State = stateModel + createObjectOptionsModel.CatalogID = core.StringPtr("testString") + createObjectOptionsModel.CatalogName = core.StringPtr("testString") + createObjectOptionsModel.Data = make(map[string]interface{}) + createObjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = catalogManagementService.SearchObjects(searchObjectsOptionsModel) + result, response, operationErr = catalogManagementService.CreateObject(createObjectOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke SearchObjects with error: Operation validation and request error`, func() { + It(`Invoke CreateObject with error: Operation validation and request error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -12641,26 +19620,57 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the SearchObjectsOptions model - searchObjectsOptionsModel := new(catalogmanagementv1.SearchObjectsOptions) - searchObjectsOptionsModel.Query = core.StringPtr("testString") - searchObjectsOptionsModel.Limit = core.Int64Ptr(int64(1000)) - searchObjectsOptionsModel.Offset = core.Int64Ptr(int64(38)) - searchObjectsOptionsModel.Collapse = core.BoolPtr(true) - searchObjectsOptionsModel.Digest = core.BoolPtr(true) - searchObjectsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the PublishObject model + publishObjectModel := new(catalogmanagementv1.PublishObject) + publishObjectModel.PermitIBMPublicPublish = core.BoolPtr(true) + publishObjectModel.IBMApproved = core.BoolPtr(true) + publishObjectModel.PublicApproved = core.BoolPtr(true) + publishObjectModel.PortalApprovalRecord = core.StringPtr("testString") + publishObjectModel.PortalURL = core.StringPtr("testString") + + // Construct an instance of the State model + stateModel := new(catalogmanagementv1.State) + stateModel.Current = core.StringPtr("testString") + stateModel.CurrentEntered = CreateMockDateTime("2019-01-01T12:00:00.000Z") + stateModel.Pending = core.StringPtr("testString") + stateModel.PendingRequested = CreateMockDateTime("2019-01-01T12:00:00.000Z") + stateModel.Previous = core.StringPtr("testString") + + // Construct an instance of the CreateObjectOptions model + createObjectOptionsModel := new(catalogmanagementv1.CreateObjectOptions) + createObjectOptionsModel.CatalogIdentifier = core.StringPtr("testString") + createObjectOptionsModel.ID = core.StringPtr("testString") + createObjectOptionsModel.Name = core.StringPtr("testString") + createObjectOptionsModel.Rev = core.StringPtr("testString") + createObjectOptionsModel.CRN = core.StringPtr("testString") + createObjectOptionsModel.URL = core.StringPtr("testString") + createObjectOptionsModel.ParentID = core.StringPtr("testString") + createObjectOptionsModel.LabelI18n = make(map[string]string) + createObjectOptionsModel.Label = core.StringPtr("testString") + createObjectOptionsModel.Tags = []string{"testString"} + createObjectOptionsModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + createObjectOptionsModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + createObjectOptionsModel.ShortDescription = core.StringPtr("testString") + createObjectOptionsModel.ShortDescriptionI18n = make(map[string]string) + createObjectOptionsModel.Kind = core.StringPtr("testString") + createObjectOptionsModel.Publish = publishObjectModel + createObjectOptionsModel.State = stateModel + createObjectOptionsModel.CatalogID = core.StringPtr("testString") + createObjectOptionsModel.CatalogName = core.StringPtr("testString") + createObjectOptionsModel.Data = make(map[string]interface{}) + createObjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := catalogManagementService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := catalogManagementService.SearchObjects(searchObjectsOptionsModel) + result, response, operationErr := catalogManagementService.CreateObject(createObjectOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the SearchObjectsOptions model with no property values - searchObjectsOptionsModelNew := new(catalogmanagementv1.SearchObjectsOptions) + // Construct a second instance of the CreateObjectOptions model with no property values + createObjectOptionsModelNew := new(catalogmanagementv1.CreateObjectOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = catalogManagementService.SearchObjects(searchObjectsOptionsModelNew) + result, response, operationErr = catalogManagementService.CreateObject(createObjectOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -12675,10 +19685,10 @@ var _ = Describe(`CatalogManagementV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(201) })) }) - It(`Invoke SearchObjects successfully`, func() { + It(`Invoke CreateObject successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -12686,17 +19696,48 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the SearchObjectsOptions model - searchObjectsOptionsModel := new(catalogmanagementv1.SearchObjectsOptions) - searchObjectsOptionsModel.Query = core.StringPtr("testString") - searchObjectsOptionsModel.Limit = core.Int64Ptr(int64(1000)) - searchObjectsOptionsModel.Offset = core.Int64Ptr(int64(38)) - searchObjectsOptionsModel.Collapse = core.BoolPtr(true) - searchObjectsOptionsModel.Digest = core.BoolPtr(true) - searchObjectsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the PublishObject model + publishObjectModel := new(catalogmanagementv1.PublishObject) + publishObjectModel.PermitIBMPublicPublish = core.BoolPtr(true) + publishObjectModel.IBMApproved = core.BoolPtr(true) + publishObjectModel.PublicApproved = core.BoolPtr(true) + publishObjectModel.PortalApprovalRecord = core.StringPtr("testString") + publishObjectModel.PortalURL = core.StringPtr("testString") + + // Construct an instance of the State model + stateModel := new(catalogmanagementv1.State) + stateModel.Current = core.StringPtr("testString") + stateModel.CurrentEntered = CreateMockDateTime("2019-01-01T12:00:00.000Z") + stateModel.Pending = core.StringPtr("testString") + stateModel.PendingRequested = CreateMockDateTime("2019-01-01T12:00:00.000Z") + stateModel.Previous = core.StringPtr("testString") + + // Construct an instance of the CreateObjectOptions model + createObjectOptionsModel := new(catalogmanagementv1.CreateObjectOptions) + createObjectOptionsModel.CatalogIdentifier = core.StringPtr("testString") + createObjectOptionsModel.ID = core.StringPtr("testString") + createObjectOptionsModel.Name = core.StringPtr("testString") + createObjectOptionsModel.Rev = core.StringPtr("testString") + createObjectOptionsModel.CRN = core.StringPtr("testString") + createObjectOptionsModel.URL = core.StringPtr("testString") + createObjectOptionsModel.ParentID = core.StringPtr("testString") + createObjectOptionsModel.LabelI18n = make(map[string]string) + createObjectOptionsModel.Label = core.StringPtr("testString") + createObjectOptionsModel.Tags = []string{"testString"} + createObjectOptionsModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + createObjectOptionsModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + createObjectOptionsModel.ShortDescription = core.StringPtr("testString") + createObjectOptionsModel.ShortDescriptionI18n = make(map[string]string) + createObjectOptionsModel.Kind = core.StringPtr("testString") + createObjectOptionsModel.Publish = publishObjectModel + createObjectOptionsModel.State = stateModel + createObjectOptionsModel.CatalogID = core.StringPtr("testString") + createObjectOptionsModel.CatalogName = core.StringPtr("testString") + createObjectOptionsModel.Data = make(map[string]interface{}) + createObjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := catalogManagementService.SearchObjects(searchObjectsOptionsModel) + result, response, operationErr := catalogManagementService.CreateObject(createObjectOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -12708,26 +19749,22 @@ var _ = Describe(`CatalogManagementV1`, func() { }) }) }) - Describe(`ListObjects(listObjectsOptions *ListObjectsOptions) - Operation response error`, func() { - listObjectsPath := "/catalogs/testString/objects" + Describe(`GetObject(getObjectOptions *GetObjectOptions) - Operation response error`, func() { + getObjectPath := "/catalogs/testString/objects/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listObjectsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getObjectPath)) Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1000))})) - Expect(req.URL.Query()["offset"]).To(Equal([]string{fmt.Sprint(int64(38))})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["sort"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, `} this is not valid json {`) + fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListObjects with error: Operation response processing error`, func() { + It(`Invoke GetObject with error: Operation response processing error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -12735,23 +19772,20 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the ListObjectsOptions model - listObjectsOptionsModel := new(catalogmanagementv1.ListObjectsOptions) - listObjectsOptionsModel.CatalogIdentifier = core.StringPtr("testString") - listObjectsOptionsModel.Limit = core.Int64Ptr(int64(1000)) - listObjectsOptionsModel.Offset = core.Int64Ptr(int64(38)) - listObjectsOptionsModel.Name = core.StringPtr("testString") - listObjectsOptionsModel.Sort = core.StringPtr("testString") - listObjectsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetObjectOptions model + getObjectOptionsModel := new(catalogmanagementv1.GetObjectOptions) + getObjectOptionsModel.CatalogIdentifier = core.StringPtr("testString") + getObjectOptionsModel.ObjectIdentifier = core.StringPtr("testString") + getObjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := catalogManagementService.ListObjects(listObjectsOptionsModel) + result, response, operationErr := catalogManagementService.GetObject(getObjectOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again catalogManagementService.EnableRetries(0, 0) - result, response, operationErr = catalogManagementService.ListObjects(listObjectsOptionsModel) + result, response, operationErr = catalogManagementService.GetObject(getObjectOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -12761,31 +19795,27 @@ var _ = Describe(`CatalogManagementV1`, func() { }) }) }) - Describe(`ListObjects(listObjectsOptions *ListObjectsOptions)`, func() { - listObjectsPath := "/catalogs/testString/objects" + Describe(`GetObject(getObjectOptions *GetObjectOptions)`, func() { + getObjectPath := "/catalogs/testString/objects/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listObjectsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getObjectPath)) Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1000))})) - Expect(req.URL.Query()["offset"]).To(Equal([]string{fmt.Sprint(int64(38))})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["sort"]).To(Equal([]string{"testString"})) + // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"offset": 6, "limit": 5, "total_count": 10, "resource_count": 13, "first": "First", "last": "Last", "prev": "Prev", "next": "Next", "resources": [{"id": "ID", "name": "Name", "_rev": "Rev", "crn": "CRN", "url": "URL", "parent_id": "ParentID", "label_i18n": "LabelI18n", "label": "Label", "tags": ["Tags"], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "short_description": "ShortDescription", "short_description_i18n": "ShortDescriptionI18n", "kind": "Kind", "publish": {"permit_ibm_public_publish": true, "ibm_approved": false, "public_approved": true, "portal_approval_record": "PortalApprovalRecord", "portal_url": "PortalURL"}, "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "catalog_id": "CatalogID", "catalog_name": "CatalogName", "data": {"mapKey": "anyValue"}}]}`) + fmt.Fprintf(res, "%s", `{"id": "ID", "name": "Name", "_rev": "Rev", "crn": "CRN", "url": "URL", "parent_id": "ParentID", "label_i18n": {"mapKey": "Inner"}, "label": "Label", "tags": ["Tags"], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "short_description": "ShortDescription", "short_description_i18n": {"mapKey": "Inner"}, "kind": "Kind", "publish": {"permit_ibm_public_publish": true, "ibm_approved": false, "public_approved": true, "portal_approval_record": "PortalApprovalRecord", "portal_url": "PortalURL"}, "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "catalog_id": "CatalogID", "catalog_name": "CatalogName", "data": {"mapKey": "anyValue"}}`) })) }) - It(`Invoke ListObjects successfully with retries`, func() { + It(`Invoke GetObject successfully with retries`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -12794,25 +19824,22 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) catalogManagementService.EnableRetries(0, 0) - // Construct an instance of the ListObjectsOptions model - listObjectsOptionsModel := new(catalogmanagementv1.ListObjectsOptions) - listObjectsOptionsModel.CatalogIdentifier = core.StringPtr("testString") - listObjectsOptionsModel.Limit = core.Int64Ptr(int64(1000)) - listObjectsOptionsModel.Offset = core.Int64Ptr(int64(38)) - listObjectsOptionsModel.Name = core.StringPtr("testString") - listObjectsOptionsModel.Sort = core.StringPtr("testString") - listObjectsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetObjectOptions model + getObjectOptionsModel := new(catalogmanagementv1.GetObjectOptions) + getObjectOptionsModel.CatalogIdentifier = core.StringPtr("testString") + getObjectOptionsModel.ObjectIdentifier = core.StringPtr("testString") + getObjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := catalogManagementService.ListObjectsWithContext(ctx, listObjectsOptionsModel) + _, _, operationErr := catalogManagementService.GetObjectWithContext(ctx, getObjectOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again catalogManagementService.DisableRetries() - result, response, operationErr := catalogManagementService.ListObjects(listObjectsOptionsModel) + result, response, operationErr := catalogManagementService.GetObject(getObjectOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -12820,7 +19847,7 @@ var _ = Describe(`CatalogManagementV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = catalogManagementService.ListObjectsWithContext(ctx, listObjectsOptionsModel) + _, _, operationErr = catalogManagementService.GetObjectWithContext(ctx, getObjectOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -12834,20 +19861,16 @@ var _ = Describe(`CatalogManagementV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listObjectsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getObjectPath)) Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1000))})) - Expect(req.URL.Query()["offset"]).To(Equal([]string{fmt.Sprint(int64(38))})) - Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["sort"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"offset": 6, "limit": 5, "total_count": 10, "resource_count": 13, "first": "First", "last": "Last", "prev": "Prev", "next": "Next", "resources": [{"id": "ID", "name": "Name", "_rev": "Rev", "crn": "CRN", "url": "URL", "parent_id": "ParentID", "label_i18n": "LabelI18n", "label": "Label", "tags": ["Tags"], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "short_description": "ShortDescription", "short_description_i18n": "ShortDescriptionI18n", "kind": "Kind", "publish": {"permit_ibm_public_publish": true, "ibm_approved": false, "public_approved": true, "portal_approval_record": "PortalApprovalRecord", "portal_url": "PortalURL"}, "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "catalog_id": "CatalogID", "catalog_name": "CatalogName", "data": {"mapKey": "anyValue"}}]}`) + fmt.Fprintf(res, "%s", `{"id": "ID", "name": "Name", "_rev": "Rev", "crn": "CRN", "url": "URL", "parent_id": "ParentID", "label_i18n": {"mapKey": "Inner"}, "label": "Label", "tags": ["Tags"], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "short_description": "ShortDescription", "short_description_i18n": {"mapKey": "Inner"}, "kind": "Kind", "publish": {"permit_ibm_public_publish": true, "ibm_approved": false, "public_approved": true, "portal_approval_record": "PortalApprovalRecord", "portal_url": "PortalURL"}, "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "catalog_id": "CatalogID", "catalog_name": "CatalogName", "data": {"mapKey": "anyValue"}}`) })) }) - It(`Invoke ListObjects successfully`, func() { + It(`Invoke GetObject successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -12856,28 +19879,25 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := catalogManagementService.ListObjects(nil) + result, response, operationErr := catalogManagementService.GetObject(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListObjectsOptions model - listObjectsOptionsModel := new(catalogmanagementv1.ListObjectsOptions) - listObjectsOptionsModel.CatalogIdentifier = core.StringPtr("testString") - listObjectsOptionsModel.Limit = core.Int64Ptr(int64(1000)) - listObjectsOptionsModel.Offset = core.Int64Ptr(int64(38)) - listObjectsOptionsModel.Name = core.StringPtr("testString") - listObjectsOptionsModel.Sort = core.StringPtr("testString") - listObjectsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetObjectOptions model + getObjectOptionsModel := new(catalogmanagementv1.GetObjectOptions) + getObjectOptionsModel.CatalogIdentifier = core.StringPtr("testString") + getObjectOptionsModel.ObjectIdentifier = core.StringPtr("testString") + getObjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = catalogManagementService.ListObjects(listObjectsOptionsModel) + result, response, operationErr = catalogManagementService.GetObject(getObjectOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListObjects with error: Operation validation and request error`, func() { + It(`Invoke GetObject with error: Operation validation and request error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -12885,26 +19905,23 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the ListObjectsOptions model - listObjectsOptionsModel := new(catalogmanagementv1.ListObjectsOptions) - listObjectsOptionsModel.CatalogIdentifier = core.StringPtr("testString") - listObjectsOptionsModel.Limit = core.Int64Ptr(int64(1000)) - listObjectsOptionsModel.Offset = core.Int64Ptr(int64(38)) - listObjectsOptionsModel.Name = core.StringPtr("testString") - listObjectsOptionsModel.Sort = core.StringPtr("testString") - listObjectsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetObjectOptions model + getObjectOptionsModel := new(catalogmanagementv1.GetObjectOptions) + getObjectOptionsModel.CatalogIdentifier = core.StringPtr("testString") + getObjectOptionsModel.ObjectIdentifier = core.StringPtr("testString") + getObjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := catalogManagementService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := catalogManagementService.ListObjects(listObjectsOptionsModel) + result, response, operationErr := catalogManagementService.GetObject(getObjectOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the ListObjectsOptions model with no property values - listObjectsOptionsModelNew := new(catalogmanagementv1.ListObjectsOptions) + // Construct a second instance of the GetObjectOptions model with no property values + getObjectOptionsModelNew := new(catalogmanagementv1.GetObjectOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = catalogManagementService.ListObjects(listObjectsOptionsModelNew) + result, response, operationErr = catalogManagementService.GetObject(getObjectOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -12922,7 +19939,7 @@ var _ = Describe(`CatalogManagementV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListObjects successfully`, func() { + It(`Invoke GetObject successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -12930,17 +19947,14 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the ListObjectsOptions model - listObjectsOptionsModel := new(catalogmanagementv1.ListObjectsOptions) - listObjectsOptionsModel.CatalogIdentifier = core.StringPtr("testString") - listObjectsOptionsModel.Limit = core.Int64Ptr(int64(1000)) - listObjectsOptionsModel.Offset = core.Int64Ptr(int64(38)) - listObjectsOptionsModel.Name = core.StringPtr("testString") - listObjectsOptionsModel.Sort = core.StringPtr("testString") - listObjectsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetObjectOptions model + getObjectOptionsModel := new(catalogmanagementv1.GetObjectOptions) + getObjectOptionsModel.CatalogIdentifier = core.StringPtr("testString") + getObjectOptionsModel.ObjectIdentifier = core.StringPtr("testString") + getObjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := catalogManagementService.ListObjects(listObjectsOptionsModel) + result, response, operationErr := catalogManagementService.GetObject(getObjectOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -12952,22 +19966,22 @@ var _ = Describe(`CatalogManagementV1`, func() { }) }) }) - Describe(`CreateObject(createObjectOptions *CreateObjectOptions) - Operation response error`, func() { - createObjectPath := "/catalogs/testString/objects" + Describe(`ReplaceObject(replaceObjectOptions *ReplaceObjectOptions) - Operation response error`, func() { + replaceObjectPath := "/catalogs/testString/objects/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createObjectPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(replaceObjectPath)) + Expect(req.Method).To(Equal("PUT")) res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, `} this is not valid json {`) + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateObject with error: Operation response processing error`, func() { + It(`Invoke ReplaceObject with error: Operation response processing error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -12991,38 +20005,39 @@ var _ = Describe(`CatalogManagementV1`, func() { stateModel.PendingRequested = CreateMockDateTime("2019-01-01T12:00:00.000Z") stateModel.Previous = core.StringPtr("testString") - // Construct an instance of the CreateObjectOptions model - createObjectOptionsModel := new(catalogmanagementv1.CreateObjectOptions) - createObjectOptionsModel.CatalogIdentifier = core.StringPtr("testString") - createObjectOptionsModel.ID = core.StringPtr("testString") - createObjectOptionsModel.Name = core.StringPtr("testString") - createObjectOptionsModel.Rev = core.StringPtr("testString") - createObjectOptionsModel.CRN = core.StringPtr("testString") - createObjectOptionsModel.URL = core.StringPtr("testString") - createObjectOptionsModel.ParentID = core.StringPtr("testString") - createObjectOptionsModel.LabelI18n = core.StringPtr("testString") - createObjectOptionsModel.Label = core.StringPtr("testString") - createObjectOptionsModel.Tags = []string{"testString"} - createObjectOptionsModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") - createObjectOptionsModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - createObjectOptionsModel.ShortDescription = core.StringPtr("testString") - createObjectOptionsModel.ShortDescriptionI18n = core.StringPtr("testString") - createObjectOptionsModel.Kind = core.StringPtr("testString") - createObjectOptionsModel.Publish = publishObjectModel - createObjectOptionsModel.State = stateModel - createObjectOptionsModel.CatalogID = core.StringPtr("testString") - createObjectOptionsModel.CatalogName = core.StringPtr("testString") - createObjectOptionsModel.Data = make(map[string]interface{}) - createObjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ReplaceObjectOptions model + replaceObjectOptionsModel := new(catalogmanagementv1.ReplaceObjectOptions) + replaceObjectOptionsModel.CatalogIdentifier = core.StringPtr("testString") + replaceObjectOptionsModel.ObjectIdentifier = core.StringPtr("testString") + replaceObjectOptionsModel.ID = core.StringPtr("testString") + replaceObjectOptionsModel.Name = core.StringPtr("testString") + replaceObjectOptionsModel.Rev = core.StringPtr("testString") + replaceObjectOptionsModel.CRN = core.StringPtr("testString") + replaceObjectOptionsModel.URL = core.StringPtr("testString") + replaceObjectOptionsModel.ParentID = core.StringPtr("testString") + replaceObjectOptionsModel.LabelI18n = make(map[string]string) + replaceObjectOptionsModel.Label = core.StringPtr("testString") + replaceObjectOptionsModel.Tags = []string{"testString"} + replaceObjectOptionsModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + replaceObjectOptionsModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + replaceObjectOptionsModel.ShortDescription = core.StringPtr("testString") + replaceObjectOptionsModel.ShortDescriptionI18n = make(map[string]string) + replaceObjectOptionsModel.Kind = core.StringPtr("testString") + replaceObjectOptionsModel.Publish = publishObjectModel + replaceObjectOptionsModel.State = stateModel + replaceObjectOptionsModel.CatalogID = core.StringPtr("testString") + replaceObjectOptionsModel.CatalogName = core.StringPtr("testString") + replaceObjectOptionsModel.Data = make(map[string]interface{}) + replaceObjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := catalogManagementService.CreateObject(createObjectOptionsModel) + result, response, operationErr := catalogManagementService.ReplaceObject(replaceObjectOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again catalogManagementService.EnableRetries(0, 0) - result, response, operationErr = catalogManagementService.CreateObject(createObjectOptionsModel) + result, response, operationErr = catalogManagementService.ReplaceObject(replaceObjectOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -13032,16 +20047,16 @@ var _ = Describe(`CatalogManagementV1`, func() { }) }) }) - Describe(`CreateObject(createObjectOptions *CreateObjectOptions)`, func() { - createObjectPath := "/catalogs/testString/objects" + Describe(`ReplaceObject(replaceObjectOptions *ReplaceObjectOptions)`, func() { + replaceObjectPath := "/catalogs/testString/objects/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createObjectPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(replaceObjectPath)) + Expect(req.Method).To(Equal("PUT")) // For gzip-disabled operation, verify Content-Encoding is not set. Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) @@ -13064,11 +20079,11 @@ var _ = Describe(`CatalogManagementV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"id": "ID", "name": "Name", "_rev": "Rev", "crn": "CRN", "url": "URL", "parent_id": "ParentID", "label_i18n": "LabelI18n", "label": "Label", "tags": ["Tags"], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "short_description": "ShortDescription", "short_description_i18n": "ShortDescriptionI18n", "kind": "Kind", "publish": {"permit_ibm_public_publish": true, "ibm_approved": false, "public_approved": true, "portal_approval_record": "PortalApprovalRecord", "portal_url": "PortalURL"}, "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "catalog_id": "CatalogID", "catalog_name": "CatalogName", "data": {"mapKey": "anyValue"}}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"id": "ID", "name": "Name", "_rev": "Rev", "crn": "CRN", "url": "URL", "parent_id": "ParentID", "label_i18n": {"mapKey": "Inner"}, "label": "Label", "tags": ["Tags"], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "short_description": "ShortDescription", "short_description_i18n": {"mapKey": "Inner"}, "kind": "Kind", "publish": {"permit_ibm_public_publish": true, "ibm_approved": false, "public_approved": true, "portal_approval_record": "PortalApprovalRecord", "portal_url": "PortalURL"}, "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "catalog_id": "CatalogID", "catalog_name": "CatalogName", "data": {"mapKey": "anyValue"}}`) })) }) - It(`Invoke CreateObject successfully with retries`, func() { + It(`Invoke ReplaceObject successfully with retries`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -13093,40 +20108,41 @@ var _ = Describe(`CatalogManagementV1`, func() { stateModel.PendingRequested = CreateMockDateTime("2019-01-01T12:00:00.000Z") stateModel.Previous = core.StringPtr("testString") - // Construct an instance of the CreateObjectOptions model - createObjectOptionsModel := new(catalogmanagementv1.CreateObjectOptions) - createObjectOptionsModel.CatalogIdentifier = core.StringPtr("testString") - createObjectOptionsModel.ID = core.StringPtr("testString") - createObjectOptionsModel.Name = core.StringPtr("testString") - createObjectOptionsModel.Rev = core.StringPtr("testString") - createObjectOptionsModel.CRN = core.StringPtr("testString") - createObjectOptionsModel.URL = core.StringPtr("testString") - createObjectOptionsModel.ParentID = core.StringPtr("testString") - createObjectOptionsModel.LabelI18n = core.StringPtr("testString") - createObjectOptionsModel.Label = core.StringPtr("testString") - createObjectOptionsModel.Tags = []string{"testString"} - createObjectOptionsModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") - createObjectOptionsModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - createObjectOptionsModel.ShortDescription = core.StringPtr("testString") - createObjectOptionsModel.ShortDescriptionI18n = core.StringPtr("testString") - createObjectOptionsModel.Kind = core.StringPtr("testString") - createObjectOptionsModel.Publish = publishObjectModel - createObjectOptionsModel.State = stateModel - createObjectOptionsModel.CatalogID = core.StringPtr("testString") - createObjectOptionsModel.CatalogName = core.StringPtr("testString") - createObjectOptionsModel.Data = make(map[string]interface{}) - createObjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ReplaceObjectOptions model + replaceObjectOptionsModel := new(catalogmanagementv1.ReplaceObjectOptions) + replaceObjectOptionsModel.CatalogIdentifier = core.StringPtr("testString") + replaceObjectOptionsModel.ObjectIdentifier = core.StringPtr("testString") + replaceObjectOptionsModel.ID = core.StringPtr("testString") + replaceObjectOptionsModel.Name = core.StringPtr("testString") + replaceObjectOptionsModel.Rev = core.StringPtr("testString") + replaceObjectOptionsModel.CRN = core.StringPtr("testString") + replaceObjectOptionsModel.URL = core.StringPtr("testString") + replaceObjectOptionsModel.ParentID = core.StringPtr("testString") + replaceObjectOptionsModel.LabelI18n = make(map[string]string) + replaceObjectOptionsModel.Label = core.StringPtr("testString") + replaceObjectOptionsModel.Tags = []string{"testString"} + replaceObjectOptionsModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + replaceObjectOptionsModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + replaceObjectOptionsModel.ShortDescription = core.StringPtr("testString") + replaceObjectOptionsModel.ShortDescriptionI18n = make(map[string]string) + replaceObjectOptionsModel.Kind = core.StringPtr("testString") + replaceObjectOptionsModel.Publish = publishObjectModel + replaceObjectOptionsModel.State = stateModel + replaceObjectOptionsModel.CatalogID = core.StringPtr("testString") + replaceObjectOptionsModel.CatalogName = core.StringPtr("testString") + replaceObjectOptionsModel.Data = make(map[string]interface{}) + replaceObjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := catalogManagementService.CreateObjectWithContext(ctx, createObjectOptionsModel) + _, _, operationErr := catalogManagementService.ReplaceObjectWithContext(ctx, replaceObjectOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again catalogManagementService.DisableRetries() - result, response, operationErr := catalogManagementService.CreateObject(createObjectOptionsModel) + result, response, operationErr := catalogManagementService.ReplaceObject(replaceObjectOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -13134,7 +20150,7 @@ var _ = Describe(`CatalogManagementV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = catalogManagementService.CreateObjectWithContext(ctx, createObjectOptionsModel) + _, _, operationErr = catalogManagementService.ReplaceObjectWithContext(ctx, replaceObjectOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -13148,8 +20164,8 @@ var _ = Describe(`CatalogManagementV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createObjectPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(replaceObjectPath)) + Expect(req.Method).To(Equal("PUT")) // For gzip-disabled operation, verify Content-Encoding is not set. Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) @@ -13169,11 +20185,11 @@ var _ = Describe(`CatalogManagementV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"id": "ID", "name": "Name", "_rev": "Rev", "crn": "CRN", "url": "URL", "parent_id": "ParentID", "label_i18n": "LabelI18n", "label": "Label", "tags": ["Tags"], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "short_description": "ShortDescription", "short_description_i18n": "ShortDescriptionI18n", "kind": "Kind", "publish": {"permit_ibm_public_publish": true, "ibm_approved": false, "public_approved": true, "portal_approval_record": "PortalApprovalRecord", "portal_url": "PortalURL"}, "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "catalog_id": "CatalogID", "catalog_name": "CatalogName", "data": {"mapKey": "anyValue"}}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"id": "ID", "name": "Name", "_rev": "Rev", "crn": "CRN", "url": "URL", "parent_id": "ParentID", "label_i18n": {"mapKey": "Inner"}, "label": "Label", "tags": ["Tags"], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "short_description": "ShortDescription", "short_description_i18n": {"mapKey": "Inner"}, "kind": "Kind", "publish": {"permit_ibm_public_publish": true, "ibm_approved": false, "public_approved": true, "portal_approval_record": "PortalApprovalRecord", "portal_url": "PortalURL"}, "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "catalog_id": "CatalogID", "catalog_name": "CatalogName", "data": {"mapKey": "anyValue"}}`) })) }) - It(`Invoke CreateObject successfully`, func() { + It(`Invoke ReplaceObject successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -13182,59 +20198,60 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := catalogManagementService.CreateObject(nil) + result, response, operationErr := catalogManagementService.ReplaceObject(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the PublishObject model - publishObjectModel := new(catalogmanagementv1.PublishObject) - publishObjectModel.PermitIBMPublicPublish = core.BoolPtr(true) - publishObjectModel.IBMApproved = core.BoolPtr(true) - publishObjectModel.PublicApproved = core.BoolPtr(true) - publishObjectModel.PortalApprovalRecord = core.StringPtr("testString") - publishObjectModel.PortalURL = core.StringPtr("testString") - - // Construct an instance of the State model - stateModel := new(catalogmanagementv1.State) - stateModel.Current = core.StringPtr("testString") - stateModel.CurrentEntered = CreateMockDateTime("2019-01-01T12:00:00.000Z") - stateModel.Pending = core.StringPtr("testString") - stateModel.PendingRequested = CreateMockDateTime("2019-01-01T12:00:00.000Z") - stateModel.Previous = core.StringPtr("testString") - - // Construct an instance of the CreateObjectOptions model - createObjectOptionsModel := new(catalogmanagementv1.CreateObjectOptions) - createObjectOptionsModel.CatalogIdentifier = core.StringPtr("testString") - createObjectOptionsModel.ID = core.StringPtr("testString") - createObjectOptionsModel.Name = core.StringPtr("testString") - createObjectOptionsModel.Rev = core.StringPtr("testString") - createObjectOptionsModel.CRN = core.StringPtr("testString") - createObjectOptionsModel.URL = core.StringPtr("testString") - createObjectOptionsModel.ParentID = core.StringPtr("testString") - createObjectOptionsModel.LabelI18n = core.StringPtr("testString") - createObjectOptionsModel.Label = core.StringPtr("testString") - createObjectOptionsModel.Tags = []string{"testString"} - createObjectOptionsModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") - createObjectOptionsModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - createObjectOptionsModel.ShortDescription = core.StringPtr("testString") - createObjectOptionsModel.ShortDescriptionI18n = core.StringPtr("testString") - createObjectOptionsModel.Kind = core.StringPtr("testString") - createObjectOptionsModel.Publish = publishObjectModel - createObjectOptionsModel.State = stateModel - createObjectOptionsModel.CatalogID = core.StringPtr("testString") - createObjectOptionsModel.CatalogName = core.StringPtr("testString") - createObjectOptionsModel.Data = make(map[string]interface{}) - createObjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + Expect(result).To(BeNil()) + + // Construct an instance of the PublishObject model + publishObjectModel := new(catalogmanagementv1.PublishObject) + publishObjectModel.PermitIBMPublicPublish = core.BoolPtr(true) + publishObjectModel.IBMApproved = core.BoolPtr(true) + publishObjectModel.PublicApproved = core.BoolPtr(true) + publishObjectModel.PortalApprovalRecord = core.StringPtr("testString") + publishObjectModel.PortalURL = core.StringPtr("testString") + + // Construct an instance of the State model + stateModel := new(catalogmanagementv1.State) + stateModel.Current = core.StringPtr("testString") + stateModel.CurrentEntered = CreateMockDateTime("2019-01-01T12:00:00.000Z") + stateModel.Pending = core.StringPtr("testString") + stateModel.PendingRequested = CreateMockDateTime("2019-01-01T12:00:00.000Z") + stateModel.Previous = core.StringPtr("testString") + + // Construct an instance of the ReplaceObjectOptions model + replaceObjectOptionsModel := new(catalogmanagementv1.ReplaceObjectOptions) + replaceObjectOptionsModel.CatalogIdentifier = core.StringPtr("testString") + replaceObjectOptionsModel.ObjectIdentifier = core.StringPtr("testString") + replaceObjectOptionsModel.ID = core.StringPtr("testString") + replaceObjectOptionsModel.Name = core.StringPtr("testString") + replaceObjectOptionsModel.Rev = core.StringPtr("testString") + replaceObjectOptionsModel.CRN = core.StringPtr("testString") + replaceObjectOptionsModel.URL = core.StringPtr("testString") + replaceObjectOptionsModel.ParentID = core.StringPtr("testString") + replaceObjectOptionsModel.LabelI18n = make(map[string]string) + replaceObjectOptionsModel.Label = core.StringPtr("testString") + replaceObjectOptionsModel.Tags = []string{"testString"} + replaceObjectOptionsModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + replaceObjectOptionsModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + replaceObjectOptionsModel.ShortDescription = core.StringPtr("testString") + replaceObjectOptionsModel.ShortDescriptionI18n = make(map[string]string) + replaceObjectOptionsModel.Kind = core.StringPtr("testString") + replaceObjectOptionsModel.Publish = publishObjectModel + replaceObjectOptionsModel.State = stateModel + replaceObjectOptionsModel.CatalogID = core.StringPtr("testString") + replaceObjectOptionsModel.CatalogName = core.StringPtr("testString") + replaceObjectOptionsModel.Data = make(map[string]interface{}) + replaceObjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = catalogManagementService.CreateObject(createObjectOptionsModel) + result, response, operationErr = catalogManagementService.ReplaceObject(replaceObjectOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateObject with error: Operation validation and request error`, func() { + It(`Invoke ReplaceObject with error: Operation validation and request error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -13258,41 +20275,42 @@ var _ = Describe(`CatalogManagementV1`, func() { stateModel.PendingRequested = CreateMockDateTime("2019-01-01T12:00:00.000Z") stateModel.Previous = core.StringPtr("testString") - // Construct an instance of the CreateObjectOptions model - createObjectOptionsModel := new(catalogmanagementv1.CreateObjectOptions) - createObjectOptionsModel.CatalogIdentifier = core.StringPtr("testString") - createObjectOptionsModel.ID = core.StringPtr("testString") - createObjectOptionsModel.Name = core.StringPtr("testString") - createObjectOptionsModel.Rev = core.StringPtr("testString") - createObjectOptionsModel.CRN = core.StringPtr("testString") - createObjectOptionsModel.URL = core.StringPtr("testString") - createObjectOptionsModel.ParentID = core.StringPtr("testString") - createObjectOptionsModel.LabelI18n = core.StringPtr("testString") - createObjectOptionsModel.Label = core.StringPtr("testString") - createObjectOptionsModel.Tags = []string{"testString"} - createObjectOptionsModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") - createObjectOptionsModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - createObjectOptionsModel.ShortDescription = core.StringPtr("testString") - createObjectOptionsModel.ShortDescriptionI18n = core.StringPtr("testString") - createObjectOptionsModel.Kind = core.StringPtr("testString") - createObjectOptionsModel.Publish = publishObjectModel - createObjectOptionsModel.State = stateModel - createObjectOptionsModel.CatalogID = core.StringPtr("testString") - createObjectOptionsModel.CatalogName = core.StringPtr("testString") - createObjectOptionsModel.Data = make(map[string]interface{}) - createObjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ReplaceObjectOptions model + replaceObjectOptionsModel := new(catalogmanagementv1.ReplaceObjectOptions) + replaceObjectOptionsModel.CatalogIdentifier = core.StringPtr("testString") + replaceObjectOptionsModel.ObjectIdentifier = core.StringPtr("testString") + replaceObjectOptionsModel.ID = core.StringPtr("testString") + replaceObjectOptionsModel.Name = core.StringPtr("testString") + replaceObjectOptionsModel.Rev = core.StringPtr("testString") + replaceObjectOptionsModel.CRN = core.StringPtr("testString") + replaceObjectOptionsModel.URL = core.StringPtr("testString") + replaceObjectOptionsModel.ParentID = core.StringPtr("testString") + replaceObjectOptionsModel.LabelI18n = make(map[string]string) + replaceObjectOptionsModel.Label = core.StringPtr("testString") + replaceObjectOptionsModel.Tags = []string{"testString"} + replaceObjectOptionsModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + replaceObjectOptionsModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + replaceObjectOptionsModel.ShortDescription = core.StringPtr("testString") + replaceObjectOptionsModel.ShortDescriptionI18n = make(map[string]string) + replaceObjectOptionsModel.Kind = core.StringPtr("testString") + replaceObjectOptionsModel.Publish = publishObjectModel + replaceObjectOptionsModel.State = stateModel + replaceObjectOptionsModel.CatalogID = core.StringPtr("testString") + replaceObjectOptionsModel.CatalogName = core.StringPtr("testString") + replaceObjectOptionsModel.Data = make(map[string]interface{}) + replaceObjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := catalogManagementService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := catalogManagementService.CreateObject(createObjectOptionsModel) + result, response, operationErr := catalogManagementService.ReplaceObject(replaceObjectOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the CreateObjectOptions model with no property values - createObjectOptionsModelNew := new(catalogmanagementv1.CreateObjectOptions) + // Construct a second instance of the ReplaceObjectOptions model with no property values + replaceObjectOptionsModelNew := new(catalogmanagementv1.ReplaceObjectOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = catalogManagementService.CreateObject(createObjectOptionsModelNew) + result, response, operationErr = catalogManagementService.ReplaceObject(replaceObjectOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -13307,10 +20325,10 @@ var _ = Describe(`CatalogManagementV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(201) + res.WriteHeader(200) })) }) - It(`Invoke CreateObject successfully`, func() { + It(`Invoke ReplaceObject successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -13334,32 +20352,33 @@ var _ = Describe(`CatalogManagementV1`, func() { stateModel.PendingRequested = CreateMockDateTime("2019-01-01T12:00:00.000Z") stateModel.Previous = core.StringPtr("testString") - // Construct an instance of the CreateObjectOptions model - createObjectOptionsModel := new(catalogmanagementv1.CreateObjectOptions) - createObjectOptionsModel.CatalogIdentifier = core.StringPtr("testString") - createObjectOptionsModel.ID = core.StringPtr("testString") - createObjectOptionsModel.Name = core.StringPtr("testString") - createObjectOptionsModel.Rev = core.StringPtr("testString") - createObjectOptionsModel.CRN = core.StringPtr("testString") - createObjectOptionsModel.URL = core.StringPtr("testString") - createObjectOptionsModel.ParentID = core.StringPtr("testString") - createObjectOptionsModel.LabelI18n = core.StringPtr("testString") - createObjectOptionsModel.Label = core.StringPtr("testString") - createObjectOptionsModel.Tags = []string{"testString"} - createObjectOptionsModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") - createObjectOptionsModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - createObjectOptionsModel.ShortDescription = core.StringPtr("testString") - createObjectOptionsModel.ShortDescriptionI18n = core.StringPtr("testString") - createObjectOptionsModel.Kind = core.StringPtr("testString") - createObjectOptionsModel.Publish = publishObjectModel - createObjectOptionsModel.State = stateModel - createObjectOptionsModel.CatalogID = core.StringPtr("testString") - createObjectOptionsModel.CatalogName = core.StringPtr("testString") - createObjectOptionsModel.Data = make(map[string]interface{}) - createObjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ReplaceObjectOptions model + replaceObjectOptionsModel := new(catalogmanagementv1.ReplaceObjectOptions) + replaceObjectOptionsModel.CatalogIdentifier = core.StringPtr("testString") + replaceObjectOptionsModel.ObjectIdentifier = core.StringPtr("testString") + replaceObjectOptionsModel.ID = core.StringPtr("testString") + replaceObjectOptionsModel.Name = core.StringPtr("testString") + replaceObjectOptionsModel.Rev = core.StringPtr("testString") + replaceObjectOptionsModel.CRN = core.StringPtr("testString") + replaceObjectOptionsModel.URL = core.StringPtr("testString") + replaceObjectOptionsModel.ParentID = core.StringPtr("testString") + replaceObjectOptionsModel.LabelI18n = make(map[string]string) + replaceObjectOptionsModel.Label = core.StringPtr("testString") + replaceObjectOptionsModel.Tags = []string{"testString"} + replaceObjectOptionsModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + replaceObjectOptionsModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + replaceObjectOptionsModel.ShortDescription = core.StringPtr("testString") + replaceObjectOptionsModel.ShortDescriptionI18n = make(map[string]string) + replaceObjectOptionsModel.Kind = core.StringPtr("testString") + replaceObjectOptionsModel.Publish = publishObjectModel + replaceObjectOptionsModel.State = stateModel + replaceObjectOptionsModel.CatalogID = core.StringPtr("testString") + replaceObjectOptionsModel.CatalogName = core.StringPtr("testString") + replaceObjectOptionsModel.Data = make(map[string]interface{}) + replaceObjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := catalogManagementService.CreateObject(createObjectOptionsModel) + result, response, operationErr := catalogManagementService.ReplaceObject(replaceObjectOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -13371,22 +20390,95 @@ var _ = Describe(`CatalogManagementV1`, func() { }) }) }) - Describe(`GetObject(getObjectOptions *GetObjectOptions) - Operation response error`, func() { - getObjectPath := "/catalogs/testString/objects/testString" + Describe(`DeleteObject(deleteObjectOptions *DeleteObjectOptions)`, func() { + deleteObjectPath := "/catalogs/testString/objects/testString" + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(deleteObjectPath)) + Expect(req.Method).To(Equal("DELETE")) + + res.WriteHeader(200) + })) + }) + It(`Invoke DeleteObject successfully`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + response, operationErr := catalogManagementService.DeleteObject(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteObjectOptions model + deleteObjectOptionsModel := new(catalogmanagementv1.DeleteObjectOptions) + deleteObjectOptionsModel.CatalogIdentifier = core.StringPtr("testString") + deleteObjectOptionsModel.ObjectIdentifier = core.StringPtr("testString") + deleteObjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = catalogManagementService.DeleteObject(deleteObjectOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteObject with error: Operation validation and request error`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Construct an instance of the DeleteObjectOptions model + deleteObjectOptionsModel := new(catalogmanagementv1.DeleteObjectOptions) + deleteObjectOptionsModel.CatalogIdentifier = core.StringPtr("testString") + deleteObjectOptionsModel.ObjectIdentifier = core.StringPtr("testString") + deleteObjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := catalogManagementService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := catalogManagementService.DeleteObject(deleteObjectOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteObjectOptions model with no property values + deleteObjectOptionsModelNew := new(catalogmanagementv1.DeleteObjectOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = catalogManagementService.DeleteObject(deleteObjectOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListObjectAudits(listObjectAuditsOptions *ListObjectAuditsOptions) - Operation response error`, func() { + listObjectAuditsPath := "/catalogs/testString/objects/testString/audits" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getObjectPath)) + Expect(req.URL.EscapedPath()).To(Equal(listObjectAuditsPath)) Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + // TODO: Add check for lookupnames query parameter res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, `} this is not valid json {`) + fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetObject with error: Operation response processing error`, func() { + It(`Invoke ListObjectAudits with error: Operation response processing error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -13394,20 +20486,23 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the GetObjectOptions model - getObjectOptionsModel := new(catalogmanagementv1.GetObjectOptions) - getObjectOptionsModel.CatalogIdentifier = core.StringPtr("testString") - getObjectOptionsModel.ObjectIdentifier = core.StringPtr("testString") - getObjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListObjectAuditsOptions model + listObjectAuditsOptionsModel := new(catalogmanagementv1.ListObjectAuditsOptions) + listObjectAuditsOptionsModel.CatalogIdentifier = core.StringPtr("testString") + listObjectAuditsOptionsModel.ObjectIdentifier = core.StringPtr("testString") + listObjectAuditsOptionsModel.Start = core.StringPtr("testString") + listObjectAuditsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listObjectAuditsOptionsModel.Lookupnames = core.BoolPtr(true) + listObjectAuditsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := catalogManagementService.GetObject(getObjectOptionsModel) + result, response, operationErr := catalogManagementService.ListObjectAudits(listObjectAuditsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again catalogManagementService.EnableRetries(0, 0) - result, response, operationErr = catalogManagementService.GetObject(getObjectOptionsModel) + result, response, operationErr = catalogManagementService.ListObjectAudits(listObjectAuditsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -13417,27 +20512,30 @@ var _ = Describe(`CatalogManagementV1`, func() { }) }) }) - Describe(`GetObject(getObjectOptions *GetObjectOptions)`, func() { - getObjectPath := "/catalogs/testString/objects/testString" + Describe(`ListObjectAudits(listObjectAuditsOptions *ListObjectAuditsOptions)`, func() { + listObjectAuditsPath := "/catalogs/testString/objects/testString/audits" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getObjectPath)) + Expect(req.URL.EscapedPath()).To(Equal(listObjectAuditsPath)) Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + // TODO: Add check for lookupnames query parameter // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"id": "ID", "name": "Name", "_rev": "Rev", "crn": "CRN", "url": "URL", "parent_id": "ParentID", "label_i18n": "LabelI18n", "label": "Label", "tags": ["Tags"], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "short_description": "ShortDescription", "short_description_i18n": "ShortDescriptionI18n", "kind": "Kind", "publish": {"permit_ibm_public_publish": true, "ibm_approved": false, "public_approved": true, "portal_approval_record": "PortalApprovalRecord", "portal_url": "PortalURL"}, "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "catalog_id": "CatalogID", "catalog_name": "CatalogName", "data": {"mapKey": "anyValue"}}`) + fmt.Fprintf(res, "%s", `{"start": "Start", "limit": 5, "total_count": 10, "resource_count": 13, "first": {"href": "Href", "start": "Start"}, "next": {"href": "Href", "start": "Start"}, "prev": {"href": "Href", "start": "Start"}, "last": {"href": "Href", "start": "Start"}, "audits": [{"id": "ID", "_rev": "Rev", "created": "2019-01-01T12:00:00.000Z", "change_type": "ChangeType", "target_type": "TargetType", "target_id": "TargetID", "who_email": "WhoEmail", "who_delegate_email": "WhoDelegateEmail", "message": "Message"}]}`) })) }) - It(`Invoke GetObject successfully with retries`, func() { + It(`Invoke ListObjectAudits successfully with retries`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -13446,22 +20544,25 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) catalogManagementService.EnableRetries(0, 0) - // Construct an instance of the GetObjectOptions model - getObjectOptionsModel := new(catalogmanagementv1.GetObjectOptions) - getObjectOptionsModel.CatalogIdentifier = core.StringPtr("testString") - getObjectOptionsModel.ObjectIdentifier = core.StringPtr("testString") - getObjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListObjectAuditsOptions model + listObjectAuditsOptionsModel := new(catalogmanagementv1.ListObjectAuditsOptions) + listObjectAuditsOptionsModel.CatalogIdentifier = core.StringPtr("testString") + listObjectAuditsOptionsModel.ObjectIdentifier = core.StringPtr("testString") + listObjectAuditsOptionsModel.Start = core.StringPtr("testString") + listObjectAuditsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listObjectAuditsOptionsModel.Lookupnames = core.BoolPtr(true) + listObjectAuditsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := catalogManagementService.GetObjectWithContext(ctx, getObjectOptionsModel) + _, _, operationErr := catalogManagementService.ListObjectAuditsWithContext(ctx, listObjectAuditsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again catalogManagementService.DisableRetries() - result, response, operationErr := catalogManagementService.GetObject(getObjectOptionsModel) + result, response, operationErr := catalogManagementService.ListObjectAudits(listObjectAuditsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -13469,7 +20570,7 @@ var _ = Describe(`CatalogManagementV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = catalogManagementService.GetObjectWithContext(ctx, getObjectOptionsModel) + _, _, operationErr = catalogManagementService.ListObjectAuditsWithContext(ctx, listObjectAuditsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -13483,16 +20584,19 @@ var _ = Describe(`CatalogManagementV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getObjectPath)) + Expect(req.URL.EscapedPath()).To(Equal(listObjectAuditsPath)) Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + // TODO: Add check for lookupnames query parameter // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"id": "ID", "name": "Name", "_rev": "Rev", "crn": "CRN", "url": "URL", "parent_id": "ParentID", "label_i18n": "LabelI18n", "label": "Label", "tags": ["Tags"], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "short_description": "ShortDescription", "short_description_i18n": "ShortDescriptionI18n", "kind": "Kind", "publish": {"permit_ibm_public_publish": true, "ibm_approved": false, "public_approved": true, "portal_approval_record": "PortalApprovalRecord", "portal_url": "PortalURL"}, "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "catalog_id": "CatalogID", "catalog_name": "CatalogName", "data": {"mapKey": "anyValue"}}`) + fmt.Fprintf(res, "%s", `{"start": "Start", "limit": 5, "total_count": 10, "resource_count": 13, "first": {"href": "Href", "start": "Start"}, "next": {"href": "Href", "start": "Start"}, "prev": {"href": "Href", "start": "Start"}, "last": {"href": "Href", "start": "Start"}, "audits": [{"id": "ID", "_rev": "Rev", "created": "2019-01-01T12:00:00.000Z", "change_type": "ChangeType", "target_type": "TargetType", "target_id": "TargetID", "who_email": "WhoEmail", "who_delegate_email": "WhoDelegateEmail", "message": "Message"}]}`) })) }) - It(`Invoke GetObject successfully`, func() { + It(`Invoke ListObjectAudits successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -13501,25 +20605,28 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := catalogManagementService.GetObject(nil) + result, response, operationErr := catalogManagementService.ListObjectAudits(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetObjectOptions model - getObjectOptionsModel := new(catalogmanagementv1.GetObjectOptions) - getObjectOptionsModel.CatalogIdentifier = core.StringPtr("testString") - getObjectOptionsModel.ObjectIdentifier = core.StringPtr("testString") - getObjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListObjectAuditsOptions model + listObjectAuditsOptionsModel := new(catalogmanagementv1.ListObjectAuditsOptions) + listObjectAuditsOptionsModel.CatalogIdentifier = core.StringPtr("testString") + listObjectAuditsOptionsModel.ObjectIdentifier = core.StringPtr("testString") + listObjectAuditsOptionsModel.Start = core.StringPtr("testString") + listObjectAuditsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listObjectAuditsOptionsModel.Lookupnames = core.BoolPtr(true) + listObjectAuditsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = catalogManagementService.GetObject(getObjectOptionsModel) + result, response, operationErr = catalogManagementService.ListObjectAudits(listObjectAuditsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetObject with error: Operation validation and request error`, func() { + It(`Invoke ListObjectAudits with error: Operation validation and request error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -13527,23 +20634,26 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the GetObjectOptions model - getObjectOptionsModel := new(catalogmanagementv1.GetObjectOptions) - getObjectOptionsModel.CatalogIdentifier = core.StringPtr("testString") - getObjectOptionsModel.ObjectIdentifier = core.StringPtr("testString") - getObjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListObjectAuditsOptions model + listObjectAuditsOptionsModel := new(catalogmanagementv1.ListObjectAuditsOptions) + listObjectAuditsOptionsModel.CatalogIdentifier = core.StringPtr("testString") + listObjectAuditsOptionsModel.ObjectIdentifier = core.StringPtr("testString") + listObjectAuditsOptionsModel.Start = core.StringPtr("testString") + listObjectAuditsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listObjectAuditsOptionsModel.Lookupnames = core.BoolPtr(true) + listObjectAuditsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := catalogManagementService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := catalogManagementService.GetObject(getObjectOptionsModel) + result, response, operationErr := catalogManagementService.ListObjectAudits(listObjectAuditsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetObjectOptions model with no property values - getObjectOptionsModelNew := new(catalogmanagementv1.GetObjectOptions) + // Construct a second instance of the ListObjectAuditsOptions model with no property values + listObjectAuditsOptionsModelNew := new(catalogmanagementv1.ListObjectAuditsOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = catalogManagementService.GetObject(getObjectOptionsModelNew) + result, response, operationErr = catalogManagementService.ListObjectAudits(listObjectAuditsOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -13561,7 +20671,7 @@ var _ = Describe(`CatalogManagementV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetObject successfully`, func() { + It(`Invoke ListObjectAudits successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -13569,14 +20679,17 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the GetObjectOptions model - getObjectOptionsModel := new(catalogmanagementv1.GetObjectOptions) - getObjectOptionsModel.CatalogIdentifier = core.StringPtr("testString") - getObjectOptionsModel.ObjectIdentifier = core.StringPtr("testString") - getObjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListObjectAuditsOptions model + listObjectAuditsOptionsModel := new(catalogmanagementv1.ListObjectAuditsOptions) + listObjectAuditsOptionsModel.CatalogIdentifier = core.StringPtr("testString") + listObjectAuditsOptionsModel.ObjectIdentifier = core.StringPtr("testString") + listObjectAuditsOptionsModel.Start = core.StringPtr("testString") + listObjectAuditsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listObjectAuditsOptionsModel.Lookupnames = core.BoolPtr(true) + listObjectAuditsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := catalogManagementService.GetObject(getObjectOptionsModel) + result, response, operationErr := catalogManagementService.ListObjectAudits(listObjectAuditsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -13587,23 +20700,49 @@ var _ = Describe(`CatalogManagementV1`, func() { testServer.Close() }) }) - }) - Describe(`ReplaceObject(replaceObjectOptions *ReplaceObjectOptions) - Operation response error`, func() { - replaceObjectPath := "/catalogs/testString/objects/testString" - Context(`Using mock server endpoint with invalid JSON response`, func() { + Context(`Test pagination helper method on response`, func() { + It(`Invoke GetNextStart successfully`, func() { + responseObject := new(catalogmanagementv1.AuditLogs) + nextObject := new(catalogmanagementv1.PaginationTokenLink) + nextObject.Start = core.StringPtr("abc-123") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(Equal(core.StringPtr("abc-123"))) + }) + It(`Invoke GetNextStart without a "Next" property in the response`, func() { + responseObject := new(catalogmanagementv1.AuditLogs) + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + Context(`Using mock server endpoint - paginated response`, func() { BeforeEach(func() { + var requestNumber int = 0 testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(replaceObjectPath)) - Expect(req.Method).To(Equal("PUT")) + Expect(req.URL.EscapedPath()).To(Equal(listObjectAuditsPath)) + Expect(req.Method).To(Equal("GET")) + + // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, `} this is not valid json {`) + requestNumber++ + if requestNumber == 1 { + fmt.Fprintf(res, "%s", `{"next":{"start":"1"},"total_count":2,"limit":1,"audits":[{"id":"ID","_rev":"Rev","created":"2019-01-01T12:00:00.000Z","change_type":"ChangeType","target_type":"TargetType","target_id":"TargetID","who_email":"WhoEmail","who_delegate_email":"WhoDelegateEmail","message":"Message"}]}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"audits":[{"id":"ID","_rev":"Rev","created":"2019-01-01T12:00:00.000Z","change_type":"ChangeType","target_type":"TargetType","target_id":"TargetID","who_email":"WhoEmail","who_delegate_email":"WhoDelegateEmail","message":"Message"}]}`) + } else { + res.WriteHeader(400) + } })) }) - It(`Invoke ReplaceObject with error: Operation response processing error`, func() { + It(`Use ObjectAuditsPager.GetNext successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -13611,55 +20750,92 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the PublishObject model - publishObjectModel := new(catalogmanagementv1.PublishObject) - publishObjectModel.PermitIBMPublicPublish = core.BoolPtr(true) - publishObjectModel.IBMApproved = core.BoolPtr(true) - publishObjectModel.PublicApproved = core.BoolPtr(true) - publishObjectModel.PortalApprovalRecord = core.StringPtr("testString") - publishObjectModel.PortalURL = core.StringPtr("testString") + listObjectAuditsOptionsModel := &catalogmanagementv1.ListObjectAuditsOptions{ + CatalogIdentifier: core.StringPtr("testString"), + ObjectIdentifier: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + Lookupnames: core.BoolPtr(true), + } - // Construct an instance of the State model - stateModel := new(catalogmanagementv1.State) - stateModel.Current = core.StringPtr("testString") - stateModel.CurrentEntered = CreateMockDateTime("2019-01-01T12:00:00.000Z") - stateModel.Pending = core.StringPtr("testString") - stateModel.PendingRequested = CreateMockDateTime("2019-01-01T12:00:00.000Z") - stateModel.Previous = core.StringPtr("testString") + pager, err := catalogManagementService.NewObjectAuditsPager(listObjectAuditsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []catalogmanagementv1.AuditLogDigest + for pager.HasNext() { + nextPage, err := pager.GetNext() + Expect(err).To(BeNil()) + Expect(nextPage).ToNot(BeNil()) + allResults = append(allResults, nextPage...) + } + Expect(len(allResults)).To(Equal(2)) + }) + It(`Use ObjectAuditsPager.GetAll successfully`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the ReplaceObjectOptions model - replaceObjectOptionsModel := new(catalogmanagementv1.ReplaceObjectOptions) - replaceObjectOptionsModel.CatalogIdentifier = core.StringPtr("testString") - replaceObjectOptionsModel.ObjectIdentifier = core.StringPtr("testString") - replaceObjectOptionsModel.ID = core.StringPtr("testString") - replaceObjectOptionsModel.Name = core.StringPtr("testString") - replaceObjectOptionsModel.Rev = core.StringPtr("testString") - replaceObjectOptionsModel.CRN = core.StringPtr("testString") - replaceObjectOptionsModel.URL = core.StringPtr("testString") - replaceObjectOptionsModel.ParentID = core.StringPtr("testString") - replaceObjectOptionsModel.LabelI18n = core.StringPtr("testString") - replaceObjectOptionsModel.Label = core.StringPtr("testString") - replaceObjectOptionsModel.Tags = []string{"testString"} - replaceObjectOptionsModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") - replaceObjectOptionsModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - replaceObjectOptionsModel.ShortDescription = core.StringPtr("testString") - replaceObjectOptionsModel.ShortDescriptionI18n = core.StringPtr("testString") - replaceObjectOptionsModel.Kind = core.StringPtr("testString") - replaceObjectOptionsModel.Publish = publishObjectModel - replaceObjectOptionsModel.State = stateModel - replaceObjectOptionsModel.CatalogID = core.StringPtr("testString") - replaceObjectOptionsModel.CatalogName = core.StringPtr("testString") - replaceObjectOptionsModel.Data = make(map[string]interface{}) - replaceObjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + listObjectAuditsOptionsModel := &catalogmanagementv1.ListObjectAuditsOptions{ + CatalogIdentifier: core.StringPtr("testString"), + ObjectIdentifier: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + Lookupnames: core.BoolPtr(true), + } + + pager, err := catalogManagementService.NewObjectAuditsPager(listObjectAuditsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + allResults, err := pager.GetAll() + Expect(err).To(BeNil()) + Expect(allResults).ToNot(BeNil()) + Expect(len(allResults)).To(Equal(2)) + }) + }) + }) + Describe(`GetObjectAudit(getObjectAuditOptions *GetObjectAuditOptions) - Operation response error`, func() { + getObjectAuditPath := "/catalogs/testString/objects/testString/audits/testString" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getObjectAuditPath)) + Expect(req.Method).To(Equal("GET")) + // TODO: Add check for lookupnames query parameter + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke GetObjectAudit with error: Operation response processing error`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Construct an instance of the GetObjectAuditOptions model + getObjectAuditOptionsModel := new(catalogmanagementv1.GetObjectAuditOptions) + getObjectAuditOptionsModel.CatalogIdentifier = core.StringPtr("testString") + getObjectAuditOptionsModel.ObjectIdentifier = core.StringPtr("testString") + getObjectAuditOptionsModel.AuditlogIdentifier = core.StringPtr("testString") + getObjectAuditOptionsModel.Lookupnames = core.BoolPtr(true) + getObjectAuditOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := catalogManagementService.ReplaceObject(replaceObjectOptionsModel) + result, response, operationErr := catalogManagementService.GetObjectAudit(getObjectAuditOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again catalogManagementService.EnableRetries(0, 0) - result, response, operationErr = catalogManagementService.ReplaceObject(replaceObjectOptionsModel) + result, response, operationErr = catalogManagementService.GetObjectAudit(getObjectAuditOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -13669,43 +20845,28 @@ var _ = Describe(`CatalogManagementV1`, func() { }) }) }) - Describe(`ReplaceObject(replaceObjectOptions *ReplaceObjectOptions)`, func() { - replaceObjectPath := "/catalogs/testString/objects/testString" + Describe(`GetObjectAudit(getObjectAuditOptions *GetObjectAuditOptions)`, func() { + getObjectAuditPath := "/catalogs/testString/objects/testString/audits/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(replaceObjectPath)) - Expect(req.Method).To(Equal("PUT")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(getObjectAuditPath)) + Expect(req.Method).To(Equal("GET")) + // TODO: Add check for lookupnames query parameter // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"id": "ID", "name": "Name", "_rev": "Rev", "crn": "CRN", "url": "URL", "parent_id": "ParentID", "label_i18n": "LabelI18n", "label": "Label", "tags": ["Tags"], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "short_description": "ShortDescription", "short_description_i18n": "ShortDescriptionI18n", "kind": "Kind", "publish": {"permit_ibm_public_publish": true, "ibm_approved": false, "public_approved": true, "portal_approval_record": "PortalApprovalRecord", "portal_url": "PortalURL"}, "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "catalog_id": "CatalogID", "catalog_name": "CatalogName", "data": {"mapKey": "anyValue"}}`) + fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "created": "2019-01-01T12:00:00.000Z", "change_type": "ChangeType", "target_type": "TargetType", "target_id": "TargetID", "who_email": "WhoEmail", "who_delegate_email": "WhoDelegateEmail", "message": "Message", "gid": "Gid", "who_id": "WhoID", "who_name": "WhoName", "who_delegate_id": "WhoDelegateID", "who_delegate_name": "WhoDelegateName", "data": "anyValue"}`) })) }) - It(`Invoke ReplaceObject successfully with retries`, func() { + It(`Invoke GetObjectAudit successfully with retries`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -13714,104 +20875,172 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) catalogManagementService.EnableRetries(0, 0) - // Construct an instance of the PublishObject model - publishObjectModel := new(catalogmanagementv1.PublishObject) - publishObjectModel.PermitIBMPublicPublish = core.BoolPtr(true) - publishObjectModel.IBMApproved = core.BoolPtr(true) - publishObjectModel.PublicApproved = core.BoolPtr(true) - publishObjectModel.PortalApprovalRecord = core.StringPtr("testString") - publishObjectModel.PortalURL = core.StringPtr("testString") - - // Construct an instance of the State model - stateModel := new(catalogmanagementv1.State) - stateModel.Current = core.StringPtr("testString") - stateModel.CurrentEntered = CreateMockDateTime("2019-01-01T12:00:00.000Z") - stateModel.Pending = core.StringPtr("testString") - stateModel.PendingRequested = CreateMockDateTime("2019-01-01T12:00:00.000Z") - stateModel.Previous = core.StringPtr("testString") - - // Construct an instance of the ReplaceObjectOptions model - replaceObjectOptionsModel := new(catalogmanagementv1.ReplaceObjectOptions) - replaceObjectOptionsModel.CatalogIdentifier = core.StringPtr("testString") - replaceObjectOptionsModel.ObjectIdentifier = core.StringPtr("testString") - replaceObjectOptionsModel.ID = core.StringPtr("testString") - replaceObjectOptionsModel.Name = core.StringPtr("testString") - replaceObjectOptionsModel.Rev = core.StringPtr("testString") - replaceObjectOptionsModel.CRN = core.StringPtr("testString") - replaceObjectOptionsModel.URL = core.StringPtr("testString") - replaceObjectOptionsModel.ParentID = core.StringPtr("testString") - replaceObjectOptionsModel.LabelI18n = core.StringPtr("testString") - replaceObjectOptionsModel.Label = core.StringPtr("testString") - replaceObjectOptionsModel.Tags = []string{"testString"} - replaceObjectOptionsModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") - replaceObjectOptionsModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - replaceObjectOptionsModel.ShortDescription = core.StringPtr("testString") - replaceObjectOptionsModel.ShortDescriptionI18n = core.StringPtr("testString") - replaceObjectOptionsModel.Kind = core.StringPtr("testString") - replaceObjectOptionsModel.Publish = publishObjectModel - replaceObjectOptionsModel.State = stateModel - replaceObjectOptionsModel.CatalogID = core.StringPtr("testString") - replaceObjectOptionsModel.CatalogName = core.StringPtr("testString") - replaceObjectOptionsModel.Data = make(map[string]interface{}) - replaceObjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetObjectAuditOptions model + getObjectAuditOptionsModel := new(catalogmanagementv1.GetObjectAuditOptions) + getObjectAuditOptionsModel.CatalogIdentifier = core.StringPtr("testString") + getObjectAuditOptionsModel.ObjectIdentifier = core.StringPtr("testString") + getObjectAuditOptionsModel.AuditlogIdentifier = core.StringPtr("testString") + getObjectAuditOptionsModel.Lookupnames = core.BoolPtr(true) + getObjectAuditOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := catalogManagementService.ReplaceObjectWithContext(ctx, replaceObjectOptionsModel) + _, _, operationErr := catalogManagementService.GetObjectAuditWithContext(ctx, getObjectAuditOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + catalogManagementService.DisableRetries() + result, response, operationErr := catalogManagementService.GetObjectAudit(getObjectAuditOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = catalogManagementService.GetObjectAuditWithContext(ctx, getObjectAuditOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getObjectAuditPath)) + Expect(req.Method).To(Equal("GET")) + + // TODO: Add check for lookupnames query parameter + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "created": "2019-01-01T12:00:00.000Z", "change_type": "ChangeType", "target_type": "TargetType", "target_id": "TargetID", "who_email": "WhoEmail", "who_delegate_email": "WhoDelegateEmail", "message": "Message", "gid": "Gid", "who_id": "WhoID", "who_name": "WhoName", "who_delegate_id": "WhoDelegateID", "who_delegate_name": "WhoDelegateName", "data": "anyValue"}`) + })) + }) + It(`Invoke GetObjectAudit successfully`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := catalogManagementService.GetObjectAudit(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetObjectAuditOptions model + getObjectAuditOptionsModel := new(catalogmanagementv1.GetObjectAuditOptions) + getObjectAuditOptionsModel.CatalogIdentifier = core.StringPtr("testString") + getObjectAuditOptionsModel.ObjectIdentifier = core.StringPtr("testString") + getObjectAuditOptionsModel.AuditlogIdentifier = core.StringPtr("testString") + getObjectAuditOptionsModel.Lookupnames = core.BoolPtr(true) + getObjectAuditOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = catalogManagementService.GetObjectAudit(getObjectAuditOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetObjectAudit with error: Operation validation and request error`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Construct an instance of the GetObjectAuditOptions model + getObjectAuditOptionsModel := new(catalogmanagementv1.GetObjectAuditOptions) + getObjectAuditOptionsModel.CatalogIdentifier = core.StringPtr("testString") + getObjectAuditOptionsModel.ObjectIdentifier = core.StringPtr("testString") + getObjectAuditOptionsModel.AuditlogIdentifier = core.StringPtr("testString") + getObjectAuditOptionsModel.Lookupnames = core.BoolPtr(true) + getObjectAuditOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := catalogManagementService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := catalogManagementService.GetObjectAudit(getObjectAuditOptionsModel) Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the GetObjectAuditOptions model with no property values + getObjectAuditOptionsModelNew := new(catalogmanagementv1.GetObjectAuditOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = catalogManagementService.GetObjectAudit(getObjectAuditOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() - // Disable retries and test again - catalogManagementService.DisableRetries() - result, response, operationErr := catalogManagementService.ReplaceObject(replaceObjectOptionsModel) + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke GetObjectAudit successfully`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Construct an instance of the GetObjectAuditOptions model + getObjectAuditOptionsModel := new(catalogmanagementv1.GetObjectAuditOptions) + getObjectAuditOptionsModel.CatalogIdentifier = core.StringPtr("testString") + getObjectAuditOptionsModel.ObjectIdentifier = core.StringPtr("testString") + getObjectAuditOptionsModel.AuditlogIdentifier = core.StringPtr("testString") + getObjectAuditOptionsModel.Lookupnames = core.BoolPtr(true) + getObjectAuditOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := catalogManagementService.GetObjectAudit(getObjectAuditOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - // Re-test the timeout error with retries disabled - ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) - defer cancelFunc2() - _, _, operationErr = catalogManagementService.ReplaceObjectWithContext(ctx, replaceObjectOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + // Verify a nil result + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) + }) + Describe(`ConsumableShareObject(consumableShareObjectOptions *ConsumableShareObjectOptions)`, func() { + consumableShareObjectPath := "/catalogs/testString/objects/testString/consume-publish" Context(`Using mock server endpoint`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(replaceObjectPath)) - Expect(req.Method).To(Equal("PUT")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(consumableShareObjectPath)) + Expect(req.Method).To(Equal("POST")) - // Set mock response - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"id": "ID", "name": "Name", "_rev": "Rev", "crn": "CRN", "url": "URL", "parent_id": "ParentID", "label_i18n": "LabelI18n", "label": "Label", "tags": ["Tags"], "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "short_description": "ShortDescription", "short_description_i18n": "ShortDescriptionI18n", "kind": "Kind", "publish": {"permit_ibm_public_publish": true, "ibm_approved": false, "public_approved": true, "portal_approval_record": "PortalApprovalRecord", "portal_url": "PortalURL"}, "state": {"current": "Current", "current_entered": "2019-01-01T12:00:00.000Z", "pending": "Pending", "pending_requested": "2019-01-01T12:00:00.000Z", "previous": "Previous"}, "catalog_id": "CatalogID", "catalog_name": "CatalogName", "data": {"mapKey": "anyValue"}}`) + res.WriteHeader(202) })) }) - It(`Invoke ReplaceObject successfully`, func() { + It(`Invoke ConsumableShareObject successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -13820,60 +21049,22 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := catalogManagementService.ReplaceObject(nil) + response, operationErr := catalogManagementService.ConsumableShareObject(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the PublishObject model - publishObjectModel := new(catalogmanagementv1.PublishObject) - publishObjectModel.PermitIBMPublicPublish = core.BoolPtr(true) - publishObjectModel.IBMApproved = core.BoolPtr(true) - publishObjectModel.PublicApproved = core.BoolPtr(true) - publishObjectModel.PortalApprovalRecord = core.StringPtr("testString") - publishObjectModel.PortalURL = core.StringPtr("testString") - - // Construct an instance of the State model - stateModel := new(catalogmanagementv1.State) - stateModel.Current = core.StringPtr("testString") - stateModel.CurrentEntered = CreateMockDateTime("2019-01-01T12:00:00.000Z") - stateModel.Pending = core.StringPtr("testString") - stateModel.PendingRequested = CreateMockDateTime("2019-01-01T12:00:00.000Z") - stateModel.Previous = core.StringPtr("testString") - // Construct an instance of the ReplaceObjectOptions model - replaceObjectOptionsModel := new(catalogmanagementv1.ReplaceObjectOptions) - replaceObjectOptionsModel.CatalogIdentifier = core.StringPtr("testString") - replaceObjectOptionsModel.ObjectIdentifier = core.StringPtr("testString") - replaceObjectOptionsModel.ID = core.StringPtr("testString") - replaceObjectOptionsModel.Name = core.StringPtr("testString") - replaceObjectOptionsModel.Rev = core.StringPtr("testString") - replaceObjectOptionsModel.CRN = core.StringPtr("testString") - replaceObjectOptionsModel.URL = core.StringPtr("testString") - replaceObjectOptionsModel.ParentID = core.StringPtr("testString") - replaceObjectOptionsModel.LabelI18n = core.StringPtr("testString") - replaceObjectOptionsModel.Label = core.StringPtr("testString") - replaceObjectOptionsModel.Tags = []string{"testString"} - replaceObjectOptionsModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") - replaceObjectOptionsModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - replaceObjectOptionsModel.ShortDescription = core.StringPtr("testString") - replaceObjectOptionsModel.ShortDescriptionI18n = core.StringPtr("testString") - replaceObjectOptionsModel.Kind = core.StringPtr("testString") - replaceObjectOptionsModel.Publish = publishObjectModel - replaceObjectOptionsModel.State = stateModel - replaceObjectOptionsModel.CatalogID = core.StringPtr("testString") - replaceObjectOptionsModel.CatalogName = core.StringPtr("testString") - replaceObjectOptionsModel.Data = make(map[string]interface{}) - replaceObjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ConsumableShareObjectOptions model + consumableShareObjectOptionsModel := new(catalogmanagementv1.ConsumableShareObjectOptions) + consumableShareObjectOptionsModel.CatalogIdentifier = core.StringPtr("testString") + consumableShareObjectOptionsModel.ObjectIdentifier = core.StringPtr("testString") + consumableShareObjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = catalogManagementService.ReplaceObject(replaceObjectOptionsModel) + response, operationErr = catalogManagementService.ConsumableShareObject(consumableShareObjectOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - }) - It(`Invoke ReplaceObject with error: Operation validation and request error`, func() { + It(`Invoke ConsumableShareObject with error: Operation validation and request error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -13881,76 +21072,46 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the PublishObject model - publishObjectModel := new(catalogmanagementv1.PublishObject) - publishObjectModel.PermitIBMPublicPublish = core.BoolPtr(true) - publishObjectModel.IBMApproved = core.BoolPtr(true) - publishObjectModel.PublicApproved = core.BoolPtr(true) - publishObjectModel.PortalApprovalRecord = core.StringPtr("testString") - publishObjectModel.PortalURL = core.StringPtr("testString") - - // Construct an instance of the State model - stateModel := new(catalogmanagementv1.State) - stateModel.Current = core.StringPtr("testString") - stateModel.CurrentEntered = CreateMockDateTime("2019-01-01T12:00:00.000Z") - stateModel.Pending = core.StringPtr("testString") - stateModel.PendingRequested = CreateMockDateTime("2019-01-01T12:00:00.000Z") - stateModel.Previous = core.StringPtr("testString") - - // Construct an instance of the ReplaceObjectOptions model - replaceObjectOptionsModel := new(catalogmanagementv1.ReplaceObjectOptions) - replaceObjectOptionsModel.CatalogIdentifier = core.StringPtr("testString") - replaceObjectOptionsModel.ObjectIdentifier = core.StringPtr("testString") - replaceObjectOptionsModel.ID = core.StringPtr("testString") - replaceObjectOptionsModel.Name = core.StringPtr("testString") - replaceObjectOptionsModel.Rev = core.StringPtr("testString") - replaceObjectOptionsModel.CRN = core.StringPtr("testString") - replaceObjectOptionsModel.URL = core.StringPtr("testString") - replaceObjectOptionsModel.ParentID = core.StringPtr("testString") - replaceObjectOptionsModel.LabelI18n = core.StringPtr("testString") - replaceObjectOptionsModel.Label = core.StringPtr("testString") - replaceObjectOptionsModel.Tags = []string{"testString"} - replaceObjectOptionsModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") - replaceObjectOptionsModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - replaceObjectOptionsModel.ShortDescription = core.StringPtr("testString") - replaceObjectOptionsModel.ShortDescriptionI18n = core.StringPtr("testString") - replaceObjectOptionsModel.Kind = core.StringPtr("testString") - replaceObjectOptionsModel.Publish = publishObjectModel - replaceObjectOptionsModel.State = stateModel - replaceObjectOptionsModel.CatalogID = core.StringPtr("testString") - replaceObjectOptionsModel.CatalogName = core.StringPtr("testString") - replaceObjectOptionsModel.Data = make(map[string]interface{}) - replaceObjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ConsumableShareObjectOptions model + consumableShareObjectOptionsModel := new(catalogmanagementv1.ConsumableShareObjectOptions) + consumableShareObjectOptionsModel.CatalogIdentifier = core.StringPtr("testString") + consumableShareObjectOptionsModel.ObjectIdentifier = core.StringPtr("testString") + consumableShareObjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := catalogManagementService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := catalogManagementService.ReplaceObject(replaceObjectOptionsModel) + response, operationErr := catalogManagementService.ConsumableShareObject(consumableShareObjectOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - // Construct a second instance of the ReplaceObjectOptions model with no property values - replaceObjectOptionsModelNew := new(catalogmanagementv1.ReplaceObjectOptions) + // Construct a second instance of the ConsumableShareObjectOptions model with no property values + consumableShareObjectOptionsModelNew := new(catalogmanagementv1.ConsumableShareObjectOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = catalogManagementService.ReplaceObject(replaceObjectOptionsModelNew) + response, operationErr = catalogManagementService.ConsumableShareObject(consumableShareObjectOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) - Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) - Context(`Using mock server endpoint with missing response body`, func() { + }) + Describe(`ShareObject(shareObjectOptions *ShareObjectOptions) - Operation response error`, func() { + shareObjectPath := "/catalogs/testString/objects/testString/share" + Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() - // Set success status code with no respoonse body + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(shareObjectPath)) + Expect(req.Method).To(Equal("POST")) + res.Header().Set("Content-type", "application/json") res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ReplaceObject successfully`, func() { + It(`Invoke ShareObject with error: Operation response processing error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -13958,75 +21119,143 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the PublishObject model - publishObjectModel := new(catalogmanagementv1.PublishObject) - publishObjectModel.PermitIBMPublicPublish = core.BoolPtr(true) - publishObjectModel.IBMApproved = core.BoolPtr(true) - publishObjectModel.PublicApproved = core.BoolPtr(true) - publishObjectModel.PortalApprovalRecord = core.StringPtr("testString") - publishObjectModel.PortalURL = core.StringPtr("testString") + // Construct an instance of the ShareObjectOptions model + shareObjectOptionsModel := new(catalogmanagementv1.ShareObjectOptions) + shareObjectOptionsModel.CatalogIdentifier = core.StringPtr("testString") + shareObjectOptionsModel.ObjectIdentifier = core.StringPtr("testString") + shareObjectOptionsModel.IBM = core.BoolPtr(true) + shareObjectOptionsModel.Public = core.BoolPtr(true) + shareObjectOptionsModel.Enabled = core.BoolPtr(true) + shareObjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := catalogManagementService.ShareObject(shareObjectOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) - // Construct an instance of the State model - stateModel := new(catalogmanagementv1.State) - stateModel.Current = core.StringPtr("testString") - stateModel.CurrentEntered = CreateMockDateTime("2019-01-01T12:00:00.000Z") - stateModel.Pending = core.StringPtr("testString") - stateModel.PendingRequested = CreateMockDateTime("2019-01-01T12:00:00.000Z") - stateModel.Previous = core.StringPtr("testString") + // Enable retries and test again + catalogManagementService.EnableRetries(0, 0) + result, response, operationErr = catalogManagementService.ShareObject(shareObjectOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ShareObject(shareObjectOptions *ShareObjectOptions)`, func() { + shareObjectPath := "/catalogs/testString/objects/testString/share" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() - // Construct an instance of the ReplaceObjectOptions model - replaceObjectOptionsModel := new(catalogmanagementv1.ReplaceObjectOptions) - replaceObjectOptionsModel.CatalogIdentifier = core.StringPtr("testString") - replaceObjectOptionsModel.ObjectIdentifier = core.StringPtr("testString") - replaceObjectOptionsModel.ID = core.StringPtr("testString") - replaceObjectOptionsModel.Name = core.StringPtr("testString") - replaceObjectOptionsModel.Rev = core.StringPtr("testString") - replaceObjectOptionsModel.CRN = core.StringPtr("testString") - replaceObjectOptionsModel.URL = core.StringPtr("testString") - replaceObjectOptionsModel.ParentID = core.StringPtr("testString") - replaceObjectOptionsModel.LabelI18n = core.StringPtr("testString") - replaceObjectOptionsModel.Label = core.StringPtr("testString") - replaceObjectOptionsModel.Tags = []string{"testString"} - replaceObjectOptionsModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") - replaceObjectOptionsModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - replaceObjectOptionsModel.ShortDescription = core.StringPtr("testString") - replaceObjectOptionsModel.ShortDescriptionI18n = core.StringPtr("testString") - replaceObjectOptionsModel.Kind = core.StringPtr("testString") - replaceObjectOptionsModel.Publish = publishObjectModel - replaceObjectOptionsModel.State = stateModel - replaceObjectOptionsModel.CatalogID = core.StringPtr("testString") - replaceObjectOptionsModel.CatalogName = core.StringPtr("testString") - replaceObjectOptionsModel.Data = make(map[string]interface{}) - replaceObjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(shareObjectPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"ibm": false, "public": true, "enabled": false}`) + })) + }) + It(`Invoke ShareObject successfully with retries`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + catalogManagementService.EnableRetries(0, 0) - // Invoke operation - result, response, operationErr := catalogManagementService.ReplaceObject(replaceObjectOptionsModel) + // Construct an instance of the ShareObjectOptions model + shareObjectOptionsModel := new(catalogmanagementv1.ShareObjectOptions) + shareObjectOptionsModel.CatalogIdentifier = core.StringPtr("testString") + shareObjectOptionsModel.ObjectIdentifier = core.StringPtr("testString") + shareObjectOptionsModel.IBM = core.BoolPtr(true) + shareObjectOptionsModel.Public = core.BoolPtr(true) + shareObjectOptionsModel.Enabled = core.BoolPtr(true) + shareObjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := catalogManagementService.ShareObjectWithContext(ctx, shareObjectOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + catalogManagementService.DisableRetries() + result, response, operationErr := catalogManagementService.ShareObject(shareObjectOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) - // Verify a nil result - Expect(result).To(BeNil()) + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = catalogManagementService.ShareObjectWithContext(ctx, shareObjectOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) AfterEach(func() { testServer.Close() }) }) - }) - Describe(`DeleteObject(deleteObjectOptions *DeleteObjectOptions)`, func() { - deleteObjectPath := "/catalogs/testString/objects/testString" Context(`Using mock server endpoint`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteObjectPath)) - Expect(req.Method).To(Equal("DELETE")) + Expect(req.URL.EscapedPath()).To(Equal(shareObjectPath)) + Expect(req.Method).To(Equal("POST")) + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + // Set mock response + res.Header().Set("Content-type", "application/json") res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"ibm": false, "public": true, "enabled": false}`) })) }) - It(`Invoke DeleteObject successfully`, func() { + It(`Invoke ShareObject successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -14035,22 +21264,28 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - response, operationErr := catalogManagementService.DeleteObject(nil) + result, response, operationErr := catalogManagementService.ShareObject(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) + Expect(result).To(BeNil()) - // Construct an instance of the DeleteObjectOptions model - deleteObjectOptionsModel := new(catalogmanagementv1.DeleteObjectOptions) - deleteObjectOptionsModel.CatalogIdentifier = core.StringPtr("testString") - deleteObjectOptionsModel.ObjectIdentifier = core.StringPtr("testString") - deleteObjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ShareObjectOptions model + shareObjectOptionsModel := new(catalogmanagementv1.ShareObjectOptions) + shareObjectOptionsModel.CatalogIdentifier = core.StringPtr("testString") + shareObjectOptionsModel.ObjectIdentifier = core.StringPtr("testString") + shareObjectOptionsModel.IBM = core.BoolPtr(true) + shareObjectOptionsModel.Public = core.BoolPtr(true) + shareObjectOptionsModel.Enabled = core.BoolPtr(true) + shareObjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - response, operationErr = catalogManagementService.DeleteObject(deleteObjectOptionsModel) + result, response, operationErr = catalogManagementService.ShareObject(shareObjectOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + }) - It(`Invoke DeleteObject with error: Operation validation and request error`, func() { + It(`Invoke ShareObject with error: Operation validation and request error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -14058,46 +21293,91 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the DeleteObjectOptions model - deleteObjectOptionsModel := new(catalogmanagementv1.DeleteObjectOptions) - deleteObjectOptionsModel.CatalogIdentifier = core.StringPtr("testString") - deleteObjectOptionsModel.ObjectIdentifier = core.StringPtr("testString") - deleteObjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ShareObjectOptions model + shareObjectOptionsModel := new(catalogmanagementv1.ShareObjectOptions) + shareObjectOptionsModel.CatalogIdentifier = core.StringPtr("testString") + shareObjectOptionsModel.ObjectIdentifier = core.StringPtr("testString") + shareObjectOptionsModel.IBM = core.BoolPtr(true) + shareObjectOptionsModel.Public = core.BoolPtr(true) + shareObjectOptionsModel.Enabled = core.BoolPtr(true) + shareObjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := catalogManagementService.SetServiceURL("") Expect(err).To(BeNil()) - response, operationErr := catalogManagementService.DeleteObject(deleteObjectOptionsModel) + result, response, operationErr := catalogManagementService.ShareObject(shareObjectOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) - // Construct a second instance of the DeleteObjectOptions model with no property values - deleteObjectOptionsModelNew := new(catalogmanagementv1.DeleteObjectOptions) + Expect(result).To(BeNil()) + // Construct a second instance of the ShareObjectOptions model with no property values + shareObjectOptionsModelNew := new(catalogmanagementv1.ShareObjectOptions) // Invoke operation with invalid model (negative test) - response, operationErr = catalogManagementService.DeleteObject(deleteObjectOptionsModelNew) + result, response, operationErr = catalogManagementService.ShareObject(shareObjectOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke ShareObject successfully`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Construct an instance of the ShareObjectOptions model + shareObjectOptionsModel := new(catalogmanagementv1.ShareObjectOptions) + shareObjectOptionsModel.CatalogIdentifier = core.StringPtr("testString") + shareObjectOptionsModel.ObjectIdentifier = core.StringPtr("testString") + shareObjectOptionsModel.IBM = core.BoolPtr(true) + shareObjectOptionsModel.Public = core.BoolPtr(true) + shareObjectOptionsModel.Enabled = core.BoolPtr(true) + shareObjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := catalogManagementService.ShareObject(shareObjectOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) }) - Describe(`GetObjectAudit(getObjectAuditOptions *GetObjectAuditOptions) - Operation response error`, func() { - getObjectAuditPath := "/catalogs/testString/objects/testString/audit" + Describe(`GetObjectAccessList(getObjectAccessListOptions *GetObjectAccessListOptions) - Operation response error`, func() { + getObjectAccessListPath := "/catalogs/testString/objects/testString/accessv1" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getObjectAuditPath)) + Expect(req.URL.EscapedPath()).To(Equal(getObjectAccessListPath)) Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, `} this is not valid json {`) + fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetObjectAudit with error: Operation response processing error`, func() { + It(`Invoke GetObjectAccessList with error: Operation response processing error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -14105,20 +21385,22 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the GetObjectAuditOptions model - getObjectAuditOptionsModel := new(catalogmanagementv1.GetObjectAuditOptions) - getObjectAuditOptionsModel.CatalogIdentifier = core.StringPtr("testString") - getObjectAuditOptionsModel.ObjectIdentifier = core.StringPtr("testString") - getObjectAuditOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetObjectAccessListOptions model + getObjectAccessListOptionsModel := new(catalogmanagementv1.GetObjectAccessListOptions) + getObjectAccessListOptionsModel.CatalogIdentifier = core.StringPtr("testString") + getObjectAccessListOptionsModel.ObjectIdentifier = core.StringPtr("testString") + getObjectAccessListOptionsModel.Start = core.StringPtr("testString") + getObjectAccessListOptionsModel.Limit = core.Int64Ptr(int64(10)) + getObjectAccessListOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := catalogManagementService.GetObjectAudit(getObjectAuditOptionsModel) + result, response, operationErr := catalogManagementService.GetObjectAccessList(getObjectAccessListOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again catalogManagementService.EnableRetries(0, 0) - result, response, operationErr = catalogManagementService.GetObjectAudit(getObjectAuditOptionsModel) + result, response, operationErr = catalogManagementService.GetObjectAccessList(getObjectAccessListOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -14128,27 +21410,29 @@ var _ = Describe(`CatalogManagementV1`, func() { }) }) }) - Describe(`GetObjectAudit(getObjectAuditOptions *GetObjectAuditOptions)`, func() { - getObjectAuditPath := "/catalogs/testString/objects/testString/audit" + Describe(`GetObjectAccessList(getObjectAccessListOptions *GetObjectAccessListOptions)`, func() { + getObjectAccessListPath := "/catalogs/testString/objects/testString/accessv1" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getObjectAuditPath)) + Expect(req.URL.EscapedPath()).To(Equal(getObjectAccessListPath)) Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"list": [{"id": "ID", "created": "2019-01-01T12:00:00.000Z", "change_type": "ChangeType", "target_type": "TargetType", "target_id": "TargetID", "who_delegate_email": "WhoDelegateEmail", "message": "Message"}]}`) + fmt.Fprintf(res, "%s", `{"start": "Start", "limit": 5, "total_count": 10, "resource_count": 13, "first": {"href": "Href", "start": "Start"}, "next": {"href": "Href", "start": "Start"}, "prev": {"href": "Href", "start": "Start"}, "last": {"href": "Href", "start": "Start"}, "resources": [{"id": "ID", "account": "Account", "account_type": 11, "catalog_id": "CatalogID", "target_id": "TargetID", "target_account": "TargetAccount", "target_kind": "TargetKind", "private_accessible": false, "created": "2019-01-01T12:00:00.000Z"}]}`) })) }) - It(`Invoke GetObjectAudit successfully with retries`, func() { + It(`Invoke GetObjectAccessList successfully with retries`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -14157,22 +21441,24 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) catalogManagementService.EnableRetries(0, 0) - // Construct an instance of the GetObjectAuditOptions model - getObjectAuditOptionsModel := new(catalogmanagementv1.GetObjectAuditOptions) - getObjectAuditOptionsModel.CatalogIdentifier = core.StringPtr("testString") - getObjectAuditOptionsModel.ObjectIdentifier = core.StringPtr("testString") - getObjectAuditOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetObjectAccessListOptions model + getObjectAccessListOptionsModel := new(catalogmanagementv1.GetObjectAccessListOptions) + getObjectAccessListOptionsModel.CatalogIdentifier = core.StringPtr("testString") + getObjectAccessListOptionsModel.ObjectIdentifier = core.StringPtr("testString") + getObjectAccessListOptionsModel.Start = core.StringPtr("testString") + getObjectAccessListOptionsModel.Limit = core.Int64Ptr(int64(10)) + getObjectAccessListOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := catalogManagementService.GetObjectAuditWithContext(ctx, getObjectAuditOptionsModel) + _, _, operationErr := catalogManagementService.GetObjectAccessListWithContext(ctx, getObjectAccessListOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again catalogManagementService.DisableRetries() - result, response, operationErr := catalogManagementService.GetObjectAudit(getObjectAuditOptionsModel) + result, response, operationErr := catalogManagementService.GetObjectAccessList(getObjectAccessListOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -14180,7 +21466,7 @@ var _ = Describe(`CatalogManagementV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = catalogManagementService.GetObjectAuditWithContext(ctx, getObjectAuditOptionsModel) + _, _, operationErr = catalogManagementService.GetObjectAccessListWithContext(ctx, getObjectAccessListOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -14194,16 +21480,18 @@ var _ = Describe(`CatalogManagementV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getObjectAuditPath)) + Expect(req.URL.EscapedPath()).To(Equal(getObjectAccessListPath)) Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"list": [{"id": "ID", "created": "2019-01-01T12:00:00.000Z", "change_type": "ChangeType", "target_type": "TargetType", "target_id": "TargetID", "who_delegate_email": "WhoDelegateEmail", "message": "Message"}]}`) + fmt.Fprintf(res, "%s", `{"start": "Start", "limit": 5, "total_count": 10, "resource_count": 13, "first": {"href": "Href", "start": "Start"}, "next": {"href": "Href", "start": "Start"}, "prev": {"href": "Href", "start": "Start"}, "last": {"href": "Href", "start": "Start"}, "resources": [{"id": "ID", "account": "Account", "account_type": 11, "catalog_id": "CatalogID", "target_id": "TargetID", "target_account": "TargetAccount", "target_kind": "TargetKind", "private_accessible": false, "created": "2019-01-01T12:00:00.000Z"}]}`) })) }) - It(`Invoke GetObjectAudit successfully`, func() { + It(`Invoke GetObjectAccessList successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -14212,25 +21500,168 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := catalogManagementService.GetObjectAudit(nil) + result, response, operationErr := catalogManagementService.GetObjectAccessList(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetObjectAuditOptions model - getObjectAuditOptionsModel := new(catalogmanagementv1.GetObjectAuditOptions) - getObjectAuditOptionsModel.CatalogIdentifier = core.StringPtr("testString") - getObjectAuditOptionsModel.ObjectIdentifier = core.StringPtr("testString") - getObjectAuditOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetObjectAccessListOptions model + getObjectAccessListOptionsModel := new(catalogmanagementv1.GetObjectAccessListOptions) + getObjectAccessListOptionsModel.CatalogIdentifier = core.StringPtr("testString") + getObjectAccessListOptionsModel.ObjectIdentifier = core.StringPtr("testString") + getObjectAccessListOptionsModel.Start = core.StringPtr("testString") + getObjectAccessListOptionsModel.Limit = core.Int64Ptr(int64(10)) + getObjectAccessListOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = catalogManagementService.GetObjectAudit(getObjectAuditOptionsModel) + result, response, operationErr = catalogManagementService.GetObjectAccessList(getObjectAccessListOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetObjectAudit with error: Operation validation and request error`, func() { + It(`Invoke GetObjectAccessList with error: Operation validation and request error`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Construct an instance of the GetObjectAccessListOptions model + getObjectAccessListOptionsModel := new(catalogmanagementv1.GetObjectAccessListOptions) + getObjectAccessListOptionsModel.CatalogIdentifier = core.StringPtr("testString") + getObjectAccessListOptionsModel.ObjectIdentifier = core.StringPtr("testString") + getObjectAccessListOptionsModel.Start = core.StringPtr("testString") + getObjectAccessListOptionsModel.Limit = core.Int64Ptr(int64(10)) + getObjectAccessListOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := catalogManagementService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := catalogManagementService.GetObjectAccessList(getObjectAccessListOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the GetObjectAccessListOptions model with no property values + getObjectAccessListOptionsModelNew := new(catalogmanagementv1.GetObjectAccessListOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = catalogManagementService.GetObjectAccessList(getObjectAccessListOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke GetObjectAccessList successfully`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Construct an instance of the GetObjectAccessListOptions model + getObjectAccessListOptionsModel := new(catalogmanagementv1.GetObjectAccessListOptions) + getObjectAccessListOptionsModel.CatalogIdentifier = core.StringPtr("testString") + getObjectAccessListOptionsModel.ObjectIdentifier = core.StringPtr("testString") + getObjectAccessListOptionsModel.Start = core.StringPtr("testString") + getObjectAccessListOptionsModel.Limit = core.Int64Ptr(int64(10)) + getObjectAccessListOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := catalogManagementService.GetObjectAccessList(getObjectAccessListOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Test pagination helper method on response`, func() { + It(`Invoke GetNextStart successfully`, func() { + responseObject := new(catalogmanagementv1.AccessListResult) + nextObject := new(catalogmanagementv1.PaginationTokenLink) + nextObject.Start = core.StringPtr("abc-123") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(Equal(core.StringPtr("abc-123"))) + }) + It(`Invoke GetNextStart without a "Next" property in the response`, func() { + responseObject := new(catalogmanagementv1.AccessListResult) + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + Context(`Using mock server endpoint - paginated response`, func() { + BeforeEach(func() { + var requestNumber int = 0 + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getObjectAccessListPath)) + Expect(req.Method).To(Equal("GET")) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + requestNumber++ + if requestNumber == 1 { + fmt.Fprintf(res, "%s", `{"next":{"start":"1"},"total_count":2,"limit":1,"resources":[{"id":"ID","account":"Account","account_type":11,"catalog_id":"CatalogID","target_id":"TargetID","target_account":"TargetAccount","target_kind":"TargetKind","private_accessible":false,"created":"2019-01-01T12:00:00.000Z"}]}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"resources":[{"id":"ID","account":"Account","account_type":11,"catalog_id":"CatalogID","target_id":"TargetID","target_account":"TargetAccount","target_kind":"TargetKind","private_accessible":false,"created":"2019-01-01T12:00:00.000Z"}]}`) + } else { + res.WriteHeader(400) + } + })) + }) + It(`Use GetObjectAccessListPager.GetNext successfully`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + getObjectAccessListOptionsModel := &catalogmanagementv1.GetObjectAccessListOptions{ + CatalogIdentifier: core.StringPtr("testString"), + ObjectIdentifier: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := catalogManagementService.NewGetObjectAccessListPager(getObjectAccessListOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []catalogmanagementv1.Access + for pager.HasNext() { + nextPage, err := pager.GetNext() + Expect(err).To(BeNil()) + Expect(nextPage).ToNot(BeNil()) + allResults = append(allResults, nextPage...) + } + Expect(len(allResults)).To(Equal(2)) + }) + It(`Use GetObjectAccessListPager.GetAll successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -14238,41 +21669,39 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the GetObjectAuditOptions model - getObjectAuditOptionsModel := new(catalogmanagementv1.GetObjectAuditOptions) - getObjectAuditOptionsModel.CatalogIdentifier = core.StringPtr("testString") - getObjectAuditOptionsModel.ObjectIdentifier = core.StringPtr("testString") - getObjectAuditOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := catalogManagementService.SetServiceURL("") + getObjectAccessListOptionsModel := &catalogmanagementv1.GetObjectAccessListOptions{ + CatalogIdentifier: core.StringPtr("testString"), + ObjectIdentifier: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := catalogManagementService.NewGetObjectAccessListPager(getObjectAccessListOptionsModel) Expect(err).To(BeNil()) - result, response, operationErr := catalogManagementService.GetObjectAudit(getObjectAuditOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - // Construct a second instance of the GetObjectAuditOptions model with no property values - getObjectAuditOptionsModelNew := new(catalogmanagementv1.GetObjectAuditOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = catalogManagementService.GetObjectAudit(getObjectAuditOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() + Expect(pager).ToNot(BeNil()) + + allResults, err := pager.GetAll() + Expect(err).To(BeNil()) + Expect(allResults).ToNot(BeNil()) + Expect(len(allResults)).To(Equal(2)) }) }) - Context(`Using mock server endpoint with missing response body`, func() { + }) + Describe(`GetObjectAccess(getObjectAccessOptions *GetObjectAccessOptions) - Operation response error`, func() { + getObjectAccessPath := "/catalogs/testString/objects/testString/access/testString" + Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() - // Set success status code with no respoonse body + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getObjectAccessPath)) + Expect(req.Method).To(Equal("GET")) + res.Header().Set("Content-type", "application/json") res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetObjectAudit successfully`, func() { + It(`Invoke GetObjectAccess with error: Operation response processing error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -14280,18 +21709,23 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the GetObjectAuditOptions model - getObjectAuditOptionsModel := new(catalogmanagementv1.GetObjectAuditOptions) - getObjectAuditOptionsModel.CatalogIdentifier = core.StringPtr("testString") - getObjectAuditOptionsModel.ObjectIdentifier = core.StringPtr("testString") - getObjectAuditOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := catalogManagementService.GetObjectAudit(getObjectAuditOptionsModel) - Expect(operationErr).To(BeNil()) + // Construct an instance of the GetObjectAccessOptions model + getObjectAccessOptionsModel := new(catalogmanagementv1.GetObjectAccessOptions) + getObjectAccessOptionsModel.CatalogIdentifier = core.StringPtr("testString") + getObjectAccessOptionsModel.ObjectIdentifier = core.StringPtr("testString") + getObjectAccessOptionsModel.AccessIdentifier = core.StringPtr("testString") + getObjectAccessOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := catalogManagementService.GetObjectAccess(getObjectAccessOptionsModel) + Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) - // Verify a nil result + // Enable retries and test again + catalogManagementService.EnableRetries(0, 0) + result, response, operationErr = catalogManagementService.GetObjectAccess(getObjectAccessOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) }) AfterEach(func() { @@ -14299,91 +21733,83 @@ var _ = Describe(`CatalogManagementV1`, func() { }) }) }) - Describe(`AccountPublishObject(accountPublishObjectOptions *AccountPublishObjectOptions)`, func() { - accountPublishObjectPath := "/catalogs/testString/objects/testString/account-publish" - Context(`Using mock server endpoint`, func() { + Describe(`GetObjectAccess(getObjectAccessOptions *GetObjectAccessOptions)`, func() { + getObjectAccessPath := "/catalogs/testString/objects/testString/access/testString" + Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(accountPublishObjectPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(getObjectAccessPath)) + Expect(req.Method).To(Equal("GET")) - res.WriteHeader(202) + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"id": "ID", "account": "Account", "account_type": 11, "catalog_id": "CatalogID", "target_id": "TargetID", "target_account": "TargetAccount", "target_kind": "TargetKind", "private_accessible": false, "created": "2019-01-01T12:00:00.000Z"}`) })) }) - It(`Invoke AccountPublishObject successfully`, func() { + It(`Invoke GetObjectAccess successfully with retries`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) + catalogManagementService.EnableRetries(0, 0) - // Invoke operation with nil options model (negative test) - response, operationErr := catalogManagementService.AccountPublishObject(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) + // Construct an instance of the GetObjectAccessOptions model + getObjectAccessOptionsModel := new(catalogmanagementv1.GetObjectAccessOptions) + getObjectAccessOptionsModel.CatalogIdentifier = core.StringPtr("testString") + getObjectAccessOptionsModel.ObjectIdentifier = core.StringPtr("testString") + getObjectAccessOptionsModel.AccessIdentifier = core.StringPtr("testString") + getObjectAccessOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Construct an instance of the AccountPublishObjectOptions model - accountPublishObjectOptionsModel := new(catalogmanagementv1.AccountPublishObjectOptions) - accountPublishObjectOptionsModel.CatalogIdentifier = core.StringPtr("testString") - accountPublishObjectOptionsModel.ObjectIdentifier = core.StringPtr("testString") - accountPublishObjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := catalogManagementService.GetObjectAccessWithContext(ctx, getObjectAccessOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - // Invoke operation with valid options model (positive test) - response, operationErr = catalogManagementService.AccountPublishObject(accountPublishObjectOptionsModel) + // Disable retries and test again + catalogManagementService.DisableRetries() + result, response, operationErr := catalogManagementService.GetObjectAccess(getObjectAccessOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) - }) - It(`Invoke AccountPublishObject with error: Operation validation and request error`, func() { - catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(catalogManagementService).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) - // Construct an instance of the AccountPublishObjectOptions model - accountPublishObjectOptionsModel := new(catalogmanagementv1.AccountPublishObjectOptions) - accountPublishObjectOptionsModel.CatalogIdentifier = core.StringPtr("testString") - accountPublishObjectOptionsModel.ObjectIdentifier = core.StringPtr("testString") - accountPublishObjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := catalogManagementService.SetServiceURL("") - Expect(err).To(BeNil()) - response, operationErr := catalogManagementService.AccountPublishObject(accountPublishObjectOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the AccountPublishObjectOptions model with no property values - accountPublishObjectOptionsModelNew := new(catalogmanagementv1.AccountPublishObjectOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = catalogManagementService.AccountPublishObject(accountPublishObjectOptionsModelNew) + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = catalogManagementService.GetObjectAccessWithContext(ctx, getObjectAccessOptionsModel) Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) AfterEach(func() { testServer.Close() }) }) - }) - Describe(`SharedPublishObject(sharedPublishObjectOptions *SharedPublishObjectOptions)`, func() { - sharedPublishObjectPath := "/catalogs/testString/objects/testString/shared-publish" Context(`Using mock server endpoint`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(sharedPublishObjectPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(getObjectAccessPath)) + Expect(req.Method).To(Equal("GET")) - res.WriteHeader(202) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"id": "ID", "account": "Account", "account_type": 11, "catalog_id": "CatalogID", "target_id": "TargetID", "target_account": "TargetAccount", "target_kind": "TargetKind", "private_accessible": false, "created": "2019-01-01T12:00:00.000Z"}`) })) }) - It(`Invoke SharedPublishObject successfully`, func() { + It(`Invoke GetObjectAccess successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -14392,22 +21818,26 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - response, operationErr := catalogManagementService.SharedPublishObject(nil) + result, response, operationErr := catalogManagementService.GetObjectAccess(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) + Expect(result).To(BeNil()) - // Construct an instance of the SharedPublishObjectOptions model - sharedPublishObjectOptionsModel := new(catalogmanagementv1.SharedPublishObjectOptions) - sharedPublishObjectOptionsModel.CatalogIdentifier = core.StringPtr("testString") - sharedPublishObjectOptionsModel.ObjectIdentifier = core.StringPtr("testString") - sharedPublishObjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetObjectAccessOptions model + getObjectAccessOptionsModel := new(catalogmanagementv1.GetObjectAccessOptions) + getObjectAccessOptionsModel.CatalogIdentifier = core.StringPtr("testString") + getObjectAccessOptionsModel.ObjectIdentifier = core.StringPtr("testString") + getObjectAccessOptionsModel.AccessIdentifier = core.StringPtr("testString") + getObjectAccessOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - response, operationErr = catalogManagementService.SharedPublishObject(sharedPublishObjectOptionsModel) + result, response, operationErr = catalogManagementService.GetObjectAccess(getObjectAccessOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + }) - It(`Invoke SharedPublishObject with error: Operation validation and request error`, func() { + It(`Invoke GetObjectAccess with error: Operation validation and request error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -14415,69 +21845,42 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the SharedPublishObjectOptions model - sharedPublishObjectOptionsModel := new(catalogmanagementv1.SharedPublishObjectOptions) - sharedPublishObjectOptionsModel.CatalogIdentifier = core.StringPtr("testString") - sharedPublishObjectOptionsModel.ObjectIdentifier = core.StringPtr("testString") - sharedPublishObjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetObjectAccessOptions model + getObjectAccessOptionsModel := new(catalogmanagementv1.GetObjectAccessOptions) + getObjectAccessOptionsModel.CatalogIdentifier = core.StringPtr("testString") + getObjectAccessOptionsModel.ObjectIdentifier = core.StringPtr("testString") + getObjectAccessOptionsModel.AccessIdentifier = core.StringPtr("testString") + getObjectAccessOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := catalogManagementService.SetServiceURL("") Expect(err).To(BeNil()) - response, operationErr := catalogManagementService.SharedPublishObject(sharedPublishObjectOptionsModel) + result, response, operationErr := catalogManagementService.GetObjectAccess(getObjectAccessOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) - // Construct a second instance of the SharedPublishObjectOptions model with no property values - sharedPublishObjectOptionsModelNew := new(catalogmanagementv1.SharedPublishObjectOptions) + Expect(result).To(BeNil()) + // Construct a second instance of the GetObjectAccessOptions model with no property values + getObjectAccessOptionsModelNew := new(catalogmanagementv1.GetObjectAccessOptions) // Invoke operation with invalid model (negative test) - response, operationErr = catalogManagementService.SharedPublishObject(sharedPublishObjectOptionsModelNew) + result, response, operationErr = catalogManagementService.GetObjectAccess(getObjectAccessOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) - }) - Describe(`IBMPublishObject(ibmPublishObjectOptions *IBMPublishObjectOptions)`, func() { - ibmPublishObjectPath := "/catalogs/testString/objects/testString/ibm-publish" - Context(`Using mock server endpoint`, func() { + Context(`Using mock server endpoint with missing response body`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(ibmPublishObjectPath)) - Expect(req.Method).To(Equal("POST")) - - res.WriteHeader(202) + // Set success status code with no respoonse body + res.WriteHeader(200) })) }) - It(`Invoke IBMPublishObject successfully`, func() { - catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(catalogManagementService).ToNot(BeNil()) - - // Invoke operation with nil options model (negative test) - response, operationErr := catalogManagementService.IBMPublishObject(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the IBMPublishObjectOptions model - ibmPublishObjectOptionsModel := new(catalogmanagementv1.IBMPublishObjectOptions) - ibmPublishObjectOptionsModel.CatalogIdentifier = core.StringPtr("testString") - ibmPublishObjectOptionsModel.ObjectIdentifier = core.StringPtr("testString") - ibmPublishObjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = catalogManagementService.IBMPublishObject(ibmPublishObjectOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke IBMPublishObject with error: Operation validation and request error`, func() { + It(`Invoke GetObjectAccess successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -14485,45 +21888,41 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the IBMPublishObjectOptions model - ibmPublishObjectOptionsModel := new(catalogmanagementv1.IBMPublishObjectOptions) - ibmPublishObjectOptionsModel.CatalogIdentifier = core.StringPtr("testString") - ibmPublishObjectOptionsModel.ObjectIdentifier = core.StringPtr("testString") - ibmPublishObjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := catalogManagementService.SetServiceURL("") - Expect(err).To(BeNil()) - response, operationErr := catalogManagementService.IBMPublishObject(ibmPublishObjectOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the IBMPublishObjectOptions model with no property values - ibmPublishObjectOptionsModelNew := new(catalogmanagementv1.IBMPublishObjectOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = catalogManagementService.IBMPublishObject(ibmPublishObjectOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) + // Construct an instance of the GetObjectAccessOptions model + getObjectAccessOptionsModel := new(catalogmanagementv1.GetObjectAccessOptions) + getObjectAccessOptionsModel.CatalogIdentifier = core.StringPtr("testString") + getObjectAccessOptionsModel.ObjectIdentifier = core.StringPtr("testString") + getObjectAccessOptionsModel.AccessIdentifier = core.StringPtr("testString") + getObjectAccessOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := catalogManagementService.GetObjectAccess(getObjectAccessOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) }) - Describe(`PublicPublishObject(publicPublishObjectOptions *PublicPublishObjectOptions)`, func() { - publicPublishObjectPath := "/catalogs/testString/objects/testString/public-publish" + Describe(`CreateObjectAccess(createObjectAccessOptions *CreateObjectAccessOptions)`, func() { + createObjectAccessPath := "/catalogs/testString/objects/testString/access/testString" Context(`Using mock server endpoint`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(publicPublishObjectPath)) + Expect(req.URL.EscapedPath()).To(Equal(createObjectAccessPath)) Expect(req.Method).To(Equal("POST")) - res.WriteHeader(202) + res.WriteHeader(201) })) }) - It(`Invoke PublicPublishObject successfully`, func() { + It(`Invoke CreateObjectAccess successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -14532,22 +21931,23 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - response, operationErr := catalogManagementService.PublicPublishObject(nil) + response, operationErr := catalogManagementService.CreateObjectAccess(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) - // Construct an instance of the PublicPublishObjectOptions model - publicPublishObjectOptionsModel := new(catalogmanagementv1.PublicPublishObjectOptions) - publicPublishObjectOptionsModel.CatalogIdentifier = core.StringPtr("testString") - publicPublishObjectOptionsModel.ObjectIdentifier = core.StringPtr("testString") - publicPublishObjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateObjectAccessOptions model + createObjectAccessOptionsModel := new(catalogmanagementv1.CreateObjectAccessOptions) + createObjectAccessOptionsModel.CatalogIdentifier = core.StringPtr("testString") + createObjectAccessOptionsModel.ObjectIdentifier = core.StringPtr("testString") + createObjectAccessOptionsModel.AccessIdentifier = core.StringPtr("testString") + createObjectAccessOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - response, operationErr = catalogManagementService.PublicPublishObject(publicPublishObjectOptionsModel) + response, operationErr = catalogManagementService.CreateObjectAccess(createObjectAccessOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) }) - It(`Invoke PublicPublishObject with error: Operation validation and request error`, func() { + It(`Invoke CreateObjectAccess with error: Operation validation and request error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -14555,22 +21955,23 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the PublicPublishObjectOptions model - publicPublishObjectOptionsModel := new(catalogmanagementv1.PublicPublishObjectOptions) - publicPublishObjectOptionsModel.CatalogIdentifier = core.StringPtr("testString") - publicPublishObjectOptionsModel.ObjectIdentifier = core.StringPtr("testString") - publicPublishObjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateObjectAccessOptions model + createObjectAccessOptionsModel := new(catalogmanagementv1.CreateObjectAccessOptions) + createObjectAccessOptionsModel.CatalogIdentifier = core.StringPtr("testString") + createObjectAccessOptionsModel.ObjectIdentifier = core.StringPtr("testString") + createObjectAccessOptionsModel.AccessIdentifier = core.StringPtr("testString") + createObjectAccessOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := catalogManagementService.SetServiceURL("") Expect(err).To(BeNil()) - response, operationErr := catalogManagementService.PublicPublishObject(publicPublishObjectOptionsModel) + response, operationErr := catalogManagementService.CreateObjectAccess(createObjectAccessOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) - // Construct a second instance of the PublicPublishObjectOptions model with no property values - publicPublishObjectOptionsModelNew := new(catalogmanagementv1.PublicPublishObjectOptions) + // Construct a second instance of the CreateObjectAccessOptions model with no property values + createObjectAccessOptionsModelNew := new(catalogmanagementv1.CreateObjectAccessOptions) // Invoke operation with invalid model (negative test) - response, operationErr = catalogManagementService.PublicPublishObject(publicPublishObjectOptionsModelNew) + response, operationErr = catalogManagementService.CreateObjectAccess(createObjectAccessOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) }) @@ -14579,21 +21980,21 @@ var _ = Describe(`CatalogManagementV1`, func() { }) }) }) - Describe(`CreateObjectAccess(createObjectAccessOptions *CreateObjectAccessOptions)`, func() { - createObjectAccessPath := "/catalogs/testString/objects/testString/access/testString" + Describe(`DeleteObjectAccess(deleteObjectAccessOptions *DeleteObjectAccessOptions)`, func() { + deleteObjectAccessPath := "/catalogs/testString/objects/testString/access/testString" Context(`Using mock server endpoint`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createObjectAccessPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(deleteObjectAccessPath)) + Expect(req.Method).To(Equal("DELETE")) - res.WriteHeader(201) + res.WriteHeader(200) })) }) - It(`Invoke CreateObjectAccess successfully`, func() { + It(`Invoke DeleteObjectAccess successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -14602,23 +22003,23 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - response, operationErr := catalogManagementService.CreateObjectAccess(nil) + response, operationErr := catalogManagementService.DeleteObjectAccess(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) - // Construct an instance of the CreateObjectAccessOptions model - createObjectAccessOptionsModel := new(catalogmanagementv1.CreateObjectAccessOptions) - createObjectAccessOptionsModel.CatalogIdentifier = core.StringPtr("testString") - createObjectAccessOptionsModel.ObjectIdentifier = core.StringPtr("testString") - createObjectAccessOptionsModel.AccountIdentifier = core.StringPtr("testString") - createObjectAccessOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteObjectAccessOptions model + deleteObjectAccessOptionsModel := new(catalogmanagementv1.DeleteObjectAccessOptions) + deleteObjectAccessOptionsModel.CatalogIdentifier = core.StringPtr("testString") + deleteObjectAccessOptionsModel.ObjectIdentifier = core.StringPtr("testString") + deleteObjectAccessOptionsModel.AccessIdentifier = core.StringPtr("testString") + deleteObjectAccessOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - response, operationErr = catalogManagementService.CreateObjectAccess(createObjectAccessOptionsModel) + response, operationErr = catalogManagementService.DeleteObjectAccess(deleteObjectAccessOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) }) - It(`Invoke CreateObjectAccess with error: Operation validation and request error`, func() { + It(`Invoke DeleteObjectAccess with error: Operation validation and request error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -14626,23 +22027,23 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the CreateObjectAccessOptions model - createObjectAccessOptionsModel := new(catalogmanagementv1.CreateObjectAccessOptions) - createObjectAccessOptionsModel.CatalogIdentifier = core.StringPtr("testString") - createObjectAccessOptionsModel.ObjectIdentifier = core.StringPtr("testString") - createObjectAccessOptionsModel.AccountIdentifier = core.StringPtr("testString") - createObjectAccessOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteObjectAccessOptions model + deleteObjectAccessOptionsModel := new(catalogmanagementv1.DeleteObjectAccessOptions) + deleteObjectAccessOptionsModel.CatalogIdentifier = core.StringPtr("testString") + deleteObjectAccessOptionsModel.ObjectIdentifier = core.StringPtr("testString") + deleteObjectAccessOptionsModel.AccessIdentifier = core.StringPtr("testString") + deleteObjectAccessOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := catalogManagementService.SetServiceURL("") Expect(err).To(BeNil()) - response, operationErr := catalogManagementService.CreateObjectAccess(createObjectAccessOptionsModel) + response, operationErr := catalogManagementService.DeleteObjectAccess(deleteObjectAccessOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) - // Construct a second instance of the CreateObjectAccessOptions model with no property values - createObjectAccessOptionsModelNew := new(catalogmanagementv1.CreateObjectAccessOptions) + // Construct a second instance of the DeleteObjectAccessOptions model with no property values + deleteObjectAccessOptionsModelNew := new(catalogmanagementv1.DeleteObjectAccessOptions) // Invoke operation with invalid model (negative test) - response, operationErr = catalogManagementService.CreateObjectAccess(createObjectAccessOptionsModelNew) + response, operationErr = catalogManagementService.DeleteObjectAccess(deleteObjectAccessOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) }) @@ -14651,22 +22052,24 @@ var _ = Describe(`CatalogManagementV1`, func() { }) }) }) - Describe(`GetObjectAccess(getObjectAccessOptions *GetObjectAccessOptions) - Operation response error`, func() { - getObjectAccessPath := "/catalogs/testString/objects/testString/access/testString" + Describe(`GetObjectAccessListDeprecated(getObjectAccessListDeprecatedOptions *GetObjectAccessListDeprecatedOptions) - Operation response error`, func() { + getObjectAccessListDeprecatedPath := "/catalogs/testString/objects/testString/access" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getObjectAccessPath)) + Expect(req.URL.EscapedPath()).To(Equal(getObjectAccessListDeprecatedPath)) Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1000))})) + Expect(req.URL.Query()["offset"]).To(Equal([]string{fmt.Sprint(int64(38))})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, `} this is not valid json {`) + fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetObjectAccess with error: Operation response processing error`, func() { + It(`Invoke GetObjectAccessListDeprecated with error: Operation response processing error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -14674,21 +22077,22 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the GetObjectAccessOptions model - getObjectAccessOptionsModel := new(catalogmanagementv1.GetObjectAccessOptions) - getObjectAccessOptionsModel.CatalogIdentifier = core.StringPtr("testString") - getObjectAccessOptionsModel.ObjectIdentifier = core.StringPtr("testString") - getObjectAccessOptionsModel.AccountIdentifier = core.StringPtr("testString") - getObjectAccessOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetObjectAccessListDeprecatedOptions model + getObjectAccessListDeprecatedOptionsModel := new(catalogmanagementv1.GetObjectAccessListDeprecatedOptions) + getObjectAccessListDeprecatedOptionsModel.CatalogIdentifier = core.StringPtr("testString") + getObjectAccessListDeprecatedOptionsModel.ObjectIdentifier = core.StringPtr("testString") + getObjectAccessListDeprecatedOptionsModel.Limit = core.Int64Ptr(int64(1000)) + getObjectAccessListDeprecatedOptionsModel.Offset = core.Int64Ptr(int64(38)) + getObjectAccessListDeprecatedOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := catalogManagementService.GetObjectAccess(getObjectAccessOptionsModel) + result, response, operationErr := catalogManagementService.GetObjectAccessListDeprecated(getObjectAccessListDeprecatedOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again catalogManagementService.EnableRetries(0, 0) - result, response, operationErr = catalogManagementService.GetObjectAccess(getObjectAccessOptionsModel) + result, response, operationErr = catalogManagementService.GetObjectAccessListDeprecated(getObjectAccessListDeprecatedOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -14698,27 +22102,29 @@ var _ = Describe(`CatalogManagementV1`, func() { }) }) }) - Describe(`GetObjectAccess(getObjectAccessOptions *GetObjectAccessOptions)`, func() { - getObjectAccessPath := "/catalogs/testString/objects/testString/access/testString" + Describe(`GetObjectAccessListDeprecated(getObjectAccessListDeprecatedOptions *GetObjectAccessListDeprecatedOptions)`, func() { + getObjectAccessListDeprecatedPath := "/catalogs/testString/objects/testString/access" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getObjectAccessPath)) + Expect(req.URL.EscapedPath()).To(Equal(getObjectAccessListDeprecatedPath)) Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1000))})) + Expect(req.URL.Query()["offset"]).To(Equal([]string{fmt.Sprint(int64(38))})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"id": "ID", "account": "Account", "catalog_id": "CatalogID", "target_id": "TargetID", "create": "2019-01-01T12:00:00.000Z"}`) + fmt.Fprintf(res, "%s", `{"offset": 6, "limit": 5, "total_count": 10, "resource_count": 13, "first": "First", "last": "Last", "prev": "Prev", "next": "Next", "resources": [{"id": "ID", "account": "Account", "account_type": 11, "catalog_id": "CatalogID", "target_id": "TargetID", "target_account": "TargetAccount", "target_kind": "TargetKind", "private_accessible": false, "created": "2019-01-01T12:00:00.000Z"}]}`) })) }) - It(`Invoke GetObjectAccess successfully with retries`, func() { + It(`Invoke GetObjectAccessListDeprecated successfully with retries`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -14727,23 +22133,24 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) catalogManagementService.EnableRetries(0, 0) - // Construct an instance of the GetObjectAccessOptions model - getObjectAccessOptionsModel := new(catalogmanagementv1.GetObjectAccessOptions) - getObjectAccessOptionsModel.CatalogIdentifier = core.StringPtr("testString") - getObjectAccessOptionsModel.ObjectIdentifier = core.StringPtr("testString") - getObjectAccessOptionsModel.AccountIdentifier = core.StringPtr("testString") - getObjectAccessOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetObjectAccessListDeprecatedOptions model + getObjectAccessListDeprecatedOptionsModel := new(catalogmanagementv1.GetObjectAccessListDeprecatedOptions) + getObjectAccessListDeprecatedOptionsModel.CatalogIdentifier = core.StringPtr("testString") + getObjectAccessListDeprecatedOptionsModel.ObjectIdentifier = core.StringPtr("testString") + getObjectAccessListDeprecatedOptionsModel.Limit = core.Int64Ptr(int64(1000)) + getObjectAccessListDeprecatedOptionsModel.Offset = core.Int64Ptr(int64(38)) + getObjectAccessListDeprecatedOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := catalogManagementService.GetObjectAccessWithContext(ctx, getObjectAccessOptionsModel) + _, _, operationErr := catalogManagementService.GetObjectAccessListDeprecatedWithContext(ctx, getObjectAccessListDeprecatedOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again catalogManagementService.DisableRetries() - result, response, operationErr := catalogManagementService.GetObjectAccess(getObjectAccessOptionsModel) + result, response, operationErr := catalogManagementService.GetObjectAccessListDeprecated(getObjectAccessListDeprecatedOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -14751,7 +22158,7 @@ var _ = Describe(`CatalogManagementV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = catalogManagementService.GetObjectAccessWithContext(ctx, getObjectAccessOptionsModel) + _, _, operationErr = catalogManagementService.GetObjectAccessListDeprecatedWithContext(ctx, getObjectAccessListDeprecatedOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -14765,16 +22172,18 @@ var _ = Describe(`CatalogManagementV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getObjectAccessPath)) + Expect(req.URL.EscapedPath()).To(Equal(getObjectAccessListDeprecatedPath)) Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1000))})) + Expect(req.URL.Query()["offset"]).To(Equal([]string{fmt.Sprint(int64(38))})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"id": "ID", "account": "Account", "catalog_id": "CatalogID", "target_id": "TargetID", "create": "2019-01-01T12:00:00.000Z"}`) + fmt.Fprintf(res, "%s", `{"offset": 6, "limit": 5, "total_count": 10, "resource_count": 13, "first": "First", "last": "Last", "prev": "Prev", "next": "Next", "resources": [{"id": "ID", "account": "Account", "account_type": 11, "catalog_id": "CatalogID", "target_id": "TargetID", "target_account": "TargetAccount", "target_kind": "TargetKind", "private_accessible": false, "created": "2019-01-01T12:00:00.000Z"}]}`) })) }) - It(`Invoke GetObjectAccess successfully`, func() { + It(`Invoke GetObjectAccessListDeprecated successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -14783,26 +22192,27 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := catalogManagementService.GetObjectAccess(nil) + result, response, operationErr := catalogManagementService.GetObjectAccessListDeprecated(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetObjectAccessOptions model - getObjectAccessOptionsModel := new(catalogmanagementv1.GetObjectAccessOptions) - getObjectAccessOptionsModel.CatalogIdentifier = core.StringPtr("testString") - getObjectAccessOptionsModel.ObjectIdentifier = core.StringPtr("testString") - getObjectAccessOptionsModel.AccountIdentifier = core.StringPtr("testString") - getObjectAccessOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetObjectAccessListDeprecatedOptions model + getObjectAccessListDeprecatedOptionsModel := new(catalogmanagementv1.GetObjectAccessListDeprecatedOptions) + getObjectAccessListDeprecatedOptionsModel.CatalogIdentifier = core.StringPtr("testString") + getObjectAccessListDeprecatedOptionsModel.ObjectIdentifier = core.StringPtr("testString") + getObjectAccessListDeprecatedOptionsModel.Limit = core.Int64Ptr(int64(1000)) + getObjectAccessListDeprecatedOptionsModel.Offset = core.Int64Ptr(int64(38)) + getObjectAccessListDeprecatedOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = catalogManagementService.GetObjectAccess(getObjectAccessOptionsModel) + result, response, operationErr = catalogManagementService.GetObjectAccessListDeprecated(getObjectAccessListDeprecatedOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetObjectAccess with error: Operation validation and request error`, func() { + It(`Invoke GetObjectAccessListDeprecated with error: Operation validation and request error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -14810,24 +22220,25 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the GetObjectAccessOptions model - getObjectAccessOptionsModel := new(catalogmanagementv1.GetObjectAccessOptions) - getObjectAccessOptionsModel.CatalogIdentifier = core.StringPtr("testString") - getObjectAccessOptionsModel.ObjectIdentifier = core.StringPtr("testString") - getObjectAccessOptionsModel.AccountIdentifier = core.StringPtr("testString") - getObjectAccessOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetObjectAccessListDeprecatedOptions model + getObjectAccessListDeprecatedOptionsModel := new(catalogmanagementv1.GetObjectAccessListDeprecatedOptions) + getObjectAccessListDeprecatedOptionsModel.CatalogIdentifier = core.StringPtr("testString") + getObjectAccessListDeprecatedOptionsModel.ObjectIdentifier = core.StringPtr("testString") + getObjectAccessListDeprecatedOptionsModel.Limit = core.Int64Ptr(int64(1000)) + getObjectAccessListDeprecatedOptionsModel.Offset = core.Int64Ptr(int64(38)) + getObjectAccessListDeprecatedOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := catalogManagementService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := catalogManagementService.GetObjectAccess(getObjectAccessOptionsModel) + result, response, operationErr := catalogManagementService.GetObjectAccessListDeprecated(getObjectAccessListDeprecatedOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetObjectAccessOptions model with no property values - getObjectAccessOptionsModelNew := new(catalogmanagementv1.GetObjectAccessOptions) + // Construct a second instance of the GetObjectAccessListDeprecatedOptions model with no property values + getObjectAccessListDeprecatedOptionsModelNew := new(catalogmanagementv1.GetObjectAccessListDeprecatedOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = catalogManagementService.GetObjectAccess(getObjectAccessOptionsModelNew) + result, response, operationErr = catalogManagementService.GetObjectAccessListDeprecated(getObjectAccessListDeprecatedOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -14845,7 +22256,7 @@ var _ = Describe(`CatalogManagementV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetObjectAccess successfully`, func() { + It(`Invoke GetObjectAccessListDeprecated successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -14853,15 +22264,16 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the GetObjectAccessOptions model - getObjectAccessOptionsModel := new(catalogmanagementv1.GetObjectAccessOptions) - getObjectAccessOptionsModel.CatalogIdentifier = core.StringPtr("testString") - getObjectAccessOptionsModel.ObjectIdentifier = core.StringPtr("testString") - getObjectAccessOptionsModel.AccountIdentifier = core.StringPtr("testString") - getObjectAccessOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetObjectAccessListDeprecatedOptions model + getObjectAccessListDeprecatedOptionsModel := new(catalogmanagementv1.GetObjectAccessListDeprecatedOptions) + getObjectAccessListDeprecatedOptionsModel.CatalogIdentifier = core.StringPtr("testString") + getObjectAccessListDeprecatedOptionsModel.ObjectIdentifier = core.StringPtr("testString") + getObjectAccessListDeprecatedOptionsModel.Limit = core.Int64Ptr(int64(1000)) + getObjectAccessListDeprecatedOptionsModel.Offset = core.Int64Ptr(int64(38)) + getObjectAccessListDeprecatedOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := catalogManagementService.GetObjectAccess(getObjectAccessOptionsModel) + result, response, operationErr := catalogManagementService.GetObjectAccessListDeprecated(getObjectAccessListDeprecatedOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -14873,96 +22285,22 @@ var _ = Describe(`CatalogManagementV1`, func() { }) }) }) - Describe(`DeleteObjectAccess(deleteObjectAccessOptions *DeleteObjectAccessOptions)`, func() { - deleteObjectAccessPath := "/catalogs/testString/objects/testString/access/testString" - Context(`Using mock server endpoint`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteObjectAccessPath)) - Expect(req.Method).To(Equal("DELETE")) - - res.WriteHeader(200) - })) - }) - It(`Invoke DeleteObjectAccess successfully`, func() { - catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(catalogManagementService).ToNot(BeNil()) - - // Invoke operation with nil options model (negative test) - response, operationErr := catalogManagementService.DeleteObjectAccess(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteObjectAccessOptions model - deleteObjectAccessOptionsModel := new(catalogmanagementv1.DeleteObjectAccessOptions) - deleteObjectAccessOptionsModel.CatalogIdentifier = core.StringPtr("testString") - deleteObjectAccessOptionsModel.ObjectIdentifier = core.StringPtr("testString") - deleteObjectAccessOptionsModel.AccountIdentifier = core.StringPtr("testString") - deleteObjectAccessOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = catalogManagementService.DeleteObjectAccess(deleteObjectAccessOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteObjectAccess with error: Operation validation and request error`, func() { - catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(catalogManagementService).ToNot(BeNil()) - - // Construct an instance of the DeleteObjectAccessOptions model - deleteObjectAccessOptionsModel := new(catalogmanagementv1.DeleteObjectAccessOptions) - deleteObjectAccessOptionsModel.CatalogIdentifier = core.StringPtr("testString") - deleteObjectAccessOptionsModel.ObjectIdentifier = core.StringPtr("testString") - deleteObjectAccessOptionsModel.AccountIdentifier = core.StringPtr("testString") - deleteObjectAccessOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := catalogManagementService.SetServiceURL("") - Expect(err).To(BeNil()) - response, operationErr := catalogManagementService.DeleteObjectAccess(deleteObjectAccessOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteObjectAccessOptions model with no property values - deleteObjectAccessOptionsModelNew := new(catalogmanagementv1.DeleteObjectAccessOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = catalogManagementService.DeleteObjectAccess(deleteObjectAccessOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetObjectAccessList(getObjectAccessListOptions *GetObjectAccessListOptions) - Operation response error`, func() { - getObjectAccessListPath := "/catalogs/testString/objects/testString/access" + Describe(`DeleteObjectAccessList(deleteObjectAccessListOptions *DeleteObjectAccessListOptions) - Operation response error`, func() { + deleteObjectAccessListPath := "/catalogs/testString/objects/testString/access" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getObjectAccessListPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1000))})) - Expect(req.URL.Query()["offset"]).To(Equal([]string{fmt.Sprint(int64(38))})) + Expect(req.URL.EscapedPath()).To(Equal(deleteObjectAccessListPath)) + Expect(req.Method).To(Equal("DELETE")) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, `} this is not valid json {`) + fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetObjectAccessList with error: Operation response processing error`, func() { + It(`Invoke DeleteObjectAccessList with error: Operation response processing error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -14970,22 +22308,21 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the GetObjectAccessListOptions model - getObjectAccessListOptionsModel := new(catalogmanagementv1.GetObjectAccessListOptions) - getObjectAccessListOptionsModel.CatalogIdentifier = core.StringPtr("testString") - getObjectAccessListOptionsModel.ObjectIdentifier = core.StringPtr("testString") - getObjectAccessListOptionsModel.Limit = core.Int64Ptr(int64(1000)) - getObjectAccessListOptionsModel.Offset = core.Int64Ptr(int64(38)) - getObjectAccessListOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteObjectAccessListOptions model + deleteObjectAccessListOptionsModel := new(catalogmanagementv1.DeleteObjectAccessListOptions) + deleteObjectAccessListOptionsModel.CatalogIdentifier = core.StringPtr("testString") + deleteObjectAccessListOptionsModel.ObjectIdentifier = core.StringPtr("testString") + deleteObjectAccessListOptionsModel.Accesses = []string{"testString"} + deleteObjectAccessListOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := catalogManagementService.GetObjectAccessList(getObjectAccessListOptionsModel) + result, response, operationErr := catalogManagementService.DeleteObjectAccessList(deleteObjectAccessListOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again catalogManagementService.EnableRetries(0, 0) - result, response, operationErr = catalogManagementService.GetObjectAccessList(getObjectAccessListOptionsModel) + result, response, operationErr = catalogManagementService.DeleteObjectAccessList(deleteObjectAccessListOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -14995,29 +22332,43 @@ var _ = Describe(`CatalogManagementV1`, func() { }) }) }) - Describe(`GetObjectAccessList(getObjectAccessListOptions *GetObjectAccessListOptions)`, func() { - getObjectAccessListPath := "/catalogs/testString/objects/testString/access" + Describe(`DeleteObjectAccessList(deleteObjectAccessListOptions *DeleteObjectAccessListOptions)`, func() { + deleteObjectAccessListPath := "/catalogs/testString/objects/testString/access" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getObjectAccessListPath)) - Expect(req.Method).To(Equal("GET")) + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(deleteObjectAccessListPath)) + Expect(req.Method).To(Equal("DELETE")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1000))})) - Expect(req.URL.Query()["offset"]).To(Equal([]string{fmt.Sprint(int64(38))})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"offset": 6, "limit": 5, "total_count": 10, "resource_count": 13, "first": "First", "last": "Last", "prev": "Prev", "next": "Next", "resources": [{"id": "ID", "account": "Account", "catalog_id": "CatalogID", "target_id": "TargetID", "create": "2019-01-01T12:00:00.000Z"}]}`) + fmt.Fprintf(res, "%s", `{"errors": {"mapKey": "Inner"}}`) })) }) - It(`Invoke GetObjectAccessList successfully with retries`, func() { + It(`Invoke DeleteObjectAccessList successfully with retries`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -15026,24 +22377,23 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) catalogManagementService.EnableRetries(0, 0) - // Construct an instance of the GetObjectAccessListOptions model - getObjectAccessListOptionsModel := new(catalogmanagementv1.GetObjectAccessListOptions) - getObjectAccessListOptionsModel.CatalogIdentifier = core.StringPtr("testString") - getObjectAccessListOptionsModel.ObjectIdentifier = core.StringPtr("testString") - getObjectAccessListOptionsModel.Limit = core.Int64Ptr(int64(1000)) - getObjectAccessListOptionsModel.Offset = core.Int64Ptr(int64(38)) - getObjectAccessListOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteObjectAccessListOptions model + deleteObjectAccessListOptionsModel := new(catalogmanagementv1.DeleteObjectAccessListOptions) + deleteObjectAccessListOptionsModel.CatalogIdentifier = core.StringPtr("testString") + deleteObjectAccessListOptionsModel.ObjectIdentifier = core.StringPtr("testString") + deleteObjectAccessListOptionsModel.Accesses = []string{"testString"} + deleteObjectAccessListOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := catalogManagementService.GetObjectAccessListWithContext(ctx, getObjectAccessListOptionsModel) + _, _, operationErr := catalogManagementService.DeleteObjectAccessListWithContext(ctx, deleteObjectAccessListOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again catalogManagementService.DisableRetries() - result, response, operationErr := catalogManagementService.GetObjectAccessList(getObjectAccessListOptionsModel) + result, response, operationErr := catalogManagementService.DeleteObjectAccessList(deleteObjectAccessListOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -15051,7 +22401,7 @@ var _ = Describe(`CatalogManagementV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = catalogManagementService.GetObjectAccessListWithContext(ctx, getObjectAccessListOptionsModel) + _, _, operationErr = catalogManagementService.DeleteObjectAccessListWithContext(ctx, deleteObjectAccessListOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -15065,18 +22415,32 @@ var _ = Describe(`CatalogManagementV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getObjectAccessListPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(deleteObjectAccessListPath)) + Expect(req.Method).To(Equal("DELETE")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) - Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1000))})) - Expect(req.URL.Query()["offset"]).To(Equal([]string{fmt.Sprint(int64(38))})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"offset": 6, "limit": 5, "total_count": 10, "resource_count": 13, "first": "First", "last": "Last", "prev": "Prev", "next": "Next", "resources": [{"id": "ID", "account": "Account", "catalog_id": "CatalogID", "target_id": "TargetID", "create": "2019-01-01T12:00:00.000Z"}]}`) + fmt.Fprintf(res, "%s", `{"errors": {"mapKey": "Inner"}}`) })) }) - It(`Invoke GetObjectAccessList successfully`, func() { + It(`Invoke DeleteObjectAccessList successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -15085,27 +22449,26 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := catalogManagementService.GetObjectAccessList(nil) + result, response, operationErr := catalogManagementService.DeleteObjectAccessList(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetObjectAccessListOptions model - getObjectAccessListOptionsModel := new(catalogmanagementv1.GetObjectAccessListOptions) - getObjectAccessListOptionsModel.CatalogIdentifier = core.StringPtr("testString") - getObjectAccessListOptionsModel.ObjectIdentifier = core.StringPtr("testString") - getObjectAccessListOptionsModel.Limit = core.Int64Ptr(int64(1000)) - getObjectAccessListOptionsModel.Offset = core.Int64Ptr(int64(38)) - getObjectAccessListOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteObjectAccessListOptions model + deleteObjectAccessListOptionsModel := new(catalogmanagementv1.DeleteObjectAccessListOptions) + deleteObjectAccessListOptionsModel.CatalogIdentifier = core.StringPtr("testString") + deleteObjectAccessListOptionsModel.ObjectIdentifier = core.StringPtr("testString") + deleteObjectAccessListOptionsModel.Accesses = []string{"testString"} + deleteObjectAccessListOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = catalogManagementService.GetObjectAccessList(getObjectAccessListOptionsModel) + result, response, operationErr = catalogManagementService.DeleteObjectAccessList(deleteObjectAccessListOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetObjectAccessList with error: Operation validation and request error`, func() { + It(`Invoke DeleteObjectAccessList with error: Operation validation and request error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -15113,25 +22476,24 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the GetObjectAccessListOptions model - getObjectAccessListOptionsModel := new(catalogmanagementv1.GetObjectAccessListOptions) - getObjectAccessListOptionsModel.CatalogIdentifier = core.StringPtr("testString") - getObjectAccessListOptionsModel.ObjectIdentifier = core.StringPtr("testString") - getObjectAccessListOptionsModel.Limit = core.Int64Ptr(int64(1000)) - getObjectAccessListOptionsModel.Offset = core.Int64Ptr(int64(38)) - getObjectAccessListOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteObjectAccessListOptions model + deleteObjectAccessListOptionsModel := new(catalogmanagementv1.DeleteObjectAccessListOptions) + deleteObjectAccessListOptionsModel.CatalogIdentifier = core.StringPtr("testString") + deleteObjectAccessListOptionsModel.ObjectIdentifier = core.StringPtr("testString") + deleteObjectAccessListOptionsModel.Accesses = []string{"testString"} + deleteObjectAccessListOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := catalogManagementService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := catalogManagementService.GetObjectAccessList(getObjectAccessListOptionsModel) + result, response, operationErr := catalogManagementService.DeleteObjectAccessList(deleteObjectAccessListOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetObjectAccessListOptions model with no property values - getObjectAccessListOptionsModelNew := new(catalogmanagementv1.GetObjectAccessListOptions) + // Construct a second instance of the DeleteObjectAccessListOptions model with no property values + deleteObjectAccessListOptionsModelNew := new(catalogmanagementv1.DeleteObjectAccessListOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = catalogManagementService.GetObjectAccessList(getObjectAccessListOptionsModelNew) + result, response, operationErr = catalogManagementService.DeleteObjectAccessList(deleteObjectAccessListOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -15149,7 +22511,7 @@ var _ = Describe(`CatalogManagementV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetObjectAccessList successfully`, func() { + It(`Invoke DeleteObjectAccessList successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -15157,16 +22519,15 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the GetObjectAccessListOptions model - getObjectAccessListOptionsModel := new(catalogmanagementv1.GetObjectAccessListOptions) - getObjectAccessListOptionsModel.CatalogIdentifier = core.StringPtr("testString") - getObjectAccessListOptionsModel.ObjectIdentifier = core.StringPtr("testString") - getObjectAccessListOptionsModel.Limit = core.Int64Ptr(int64(1000)) - getObjectAccessListOptionsModel.Offset = core.Int64Ptr(int64(38)) - getObjectAccessListOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteObjectAccessListOptions model + deleteObjectAccessListOptionsModel := new(catalogmanagementv1.DeleteObjectAccessListOptions) + deleteObjectAccessListOptionsModel.CatalogIdentifier = core.StringPtr("testString") + deleteObjectAccessListOptionsModel.ObjectIdentifier = core.StringPtr("testString") + deleteObjectAccessListOptionsModel.Accesses = []string{"testString"} + deleteObjectAccessListOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := catalogManagementService.GetObjectAccessList(getObjectAccessListOptionsModel) + result, response, operationErr := catalogManagementService.DeleteObjectAccessList(deleteObjectAccessListOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -15178,22 +22539,22 @@ var _ = Describe(`CatalogManagementV1`, func() { }) }) }) - Describe(`DeleteObjectAccessList(deleteObjectAccessListOptions *DeleteObjectAccessListOptions) - Operation response error`, func() { - deleteObjectAccessListPath := "/catalogs/testString/objects/testString/access" + Describe(`AddObjectAccessList(addObjectAccessListOptions *AddObjectAccessListOptions) - Operation response error`, func() { + addObjectAccessListPath := "/catalogs/testString/objects/testString/access" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteObjectAccessListPath)) - Expect(req.Method).To(Equal("DELETE")) + Expect(req.URL.EscapedPath()).To(Equal(addObjectAccessListPath)) + Expect(req.Method).To(Equal("POST")) res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, `} this is not valid json {`) + res.WriteHeader(201) + fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke DeleteObjectAccessList with error: Operation response processing error`, func() { + It(`Invoke AddObjectAccessList with error: Operation response processing error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -15201,21 +22562,21 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the DeleteObjectAccessListOptions model - deleteObjectAccessListOptionsModel := new(catalogmanagementv1.DeleteObjectAccessListOptions) - deleteObjectAccessListOptionsModel.CatalogIdentifier = core.StringPtr("testString") - deleteObjectAccessListOptionsModel.ObjectIdentifier = core.StringPtr("testString") - deleteObjectAccessListOptionsModel.Accounts = []string{"testString"} - deleteObjectAccessListOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the AddObjectAccessListOptions model + addObjectAccessListOptionsModel := new(catalogmanagementv1.AddObjectAccessListOptions) + addObjectAccessListOptionsModel.CatalogIdentifier = core.StringPtr("testString") + addObjectAccessListOptionsModel.ObjectIdentifier = core.StringPtr("testString") + addObjectAccessListOptionsModel.Accesses = []string{"testString"} + addObjectAccessListOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := catalogManagementService.DeleteObjectAccessList(deleteObjectAccessListOptionsModel) + result, response, operationErr := catalogManagementService.AddObjectAccessList(addObjectAccessListOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again catalogManagementService.EnableRetries(0, 0) - result, response, operationErr = catalogManagementService.DeleteObjectAccessList(deleteObjectAccessListOptionsModel) + result, response, operationErr = catalogManagementService.AddObjectAccessList(addObjectAccessListOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -15225,16 +22586,16 @@ var _ = Describe(`CatalogManagementV1`, func() { }) }) }) - Describe(`DeleteObjectAccessList(deleteObjectAccessListOptions *DeleteObjectAccessListOptions)`, func() { - deleteObjectAccessListPath := "/catalogs/testString/objects/testString/access" + Describe(`AddObjectAccessList(addObjectAccessListOptions *AddObjectAccessListOptions)`, func() { + addObjectAccessListPath := "/catalogs/testString/objects/testString/access" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteObjectAccessListPath)) - Expect(req.Method).To(Equal("DELETE")) + Expect(req.URL.EscapedPath()).To(Equal(addObjectAccessListPath)) + Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) @@ -15257,11 +22618,11 @@ var _ = Describe(`CatalogManagementV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) + res.WriteHeader(201) fmt.Fprintf(res, "%s", `{"errors": {"mapKey": "Inner"}}`) })) }) - It(`Invoke DeleteObjectAccessList successfully with retries`, func() { + It(`Invoke AddObjectAccessList successfully with retries`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -15270,23 +22631,23 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) catalogManagementService.EnableRetries(0, 0) - // Construct an instance of the DeleteObjectAccessListOptions model - deleteObjectAccessListOptionsModel := new(catalogmanagementv1.DeleteObjectAccessListOptions) - deleteObjectAccessListOptionsModel.CatalogIdentifier = core.StringPtr("testString") - deleteObjectAccessListOptionsModel.ObjectIdentifier = core.StringPtr("testString") - deleteObjectAccessListOptionsModel.Accounts = []string{"testString"} - deleteObjectAccessListOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the AddObjectAccessListOptions model + addObjectAccessListOptionsModel := new(catalogmanagementv1.AddObjectAccessListOptions) + addObjectAccessListOptionsModel.CatalogIdentifier = core.StringPtr("testString") + addObjectAccessListOptionsModel.ObjectIdentifier = core.StringPtr("testString") + addObjectAccessListOptionsModel.Accesses = []string{"testString"} + addObjectAccessListOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := catalogManagementService.DeleteObjectAccessListWithContext(ctx, deleteObjectAccessListOptionsModel) + _, _, operationErr := catalogManagementService.AddObjectAccessListWithContext(ctx, addObjectAccessListOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again catalogManagementService.DisableRetries() - result, response, operationErr := catalogManagementService.DeleteObjectAccessList(deleteObjectAccessListOptionsModel) + result, response, operationErr := catalogManagementService.AddObjectAccessList(addObjectAccessListOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -15294,7 +22655,7 @@ var _ = Describe(`CatalogManagementV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = catalogManagementService.DeleteObjectAccessListWithContext(ctx, deleteObjectAccessListOptionsModel) + _, _, operationErr = catalogManagementService.AddObjectAccessListWithContext(ctx, addObjectAccessListOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -15308,8 +22669,8 @@ var _ = Describe(`CatalogManagementV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteObjectAccessListPath)) - Expect(req.Method).To(Equal("DELETE")) + Expect(req.URL.EscapedPath()).To(Equal(addObjectAccessListPath)) + Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) @@ -15329,11 +22690,11 @@ var _ = Describe(`CatalogManagementV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) + res.WriteHeader(201) fmt.Fprintf(res, "%s", `{"errors": {"mapKey": "Inner"}}`) })) }) - It(`Invoke DeleteObjectAccessList successfully`, func() { + It(`Invoke AddObjectAccessList successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -15342,26 +22703,26 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := catalogManagementService.DeleteObjectAccessList(nil) + result, response, operationErr := catalogManagementService.AddObjectAccessList(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the DeleteObjectAccessListOptions model - deleteObjectAccessListOptionsModel := new(catalogmanagementv1.DeleteObjectAccessListOptions) - deleteObjectAccessListOptionsModel.CatalogIdentifier = core.StringPtr("testString") - deleteObjectAccessListOptionsModel.ObjectIdentifier = core.StringPtr("testString") - deleteObjectAccessListOptionsModel.Accounts = []string{"testString"} - deleteObjectAccessListOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the AddObjectAccessListOptions model + addObjectAccessListOptionsModel := new(catalogmanagementv1.AddObjectAccessListOptions) + addObjectAccessListOptionsModel.CatalogIdentifier = core.StringPtr("testString") + addObjectAccessListOptionsModel.ObjectIdentifier = core.StringPtr("testString") + addObjectAccessListOptionsModel.Accesses = []string{"testString"} + addObjectAccessListOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = catalogManagementService.DeleteObjectAccessList(deleteObjectAccessListOptionsModel) + result, response, operationErr = catalogManagementService.AddObjectAccessList(addObjectAccessListOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke DeleteObjectAccessList with error: Operation validation and request error`, func() { + It(`Invoke AddObjectAccessList with error: Operation validation and request error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -15369,24 +22730,24 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the DeleteObjectAccessListOptions model - deleteObjectAccessListOptionsModel := new(catalogmanagementv1.DeleteObjectAccessListOptions) - deleteObjectAccessListOptionsModel.CatalogIdentifier = core.StringPtr("testString") - deleteObjectAccessListOptionsModel.ObjectIdentifier = core.StringPtr("testString") - deleteObjectAccessListOptionsModel.Accounts = []string{"testString"} - deleteObjectAccessListOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the AddObjectAccessListOptions model + addObjectAccessListOptionsModel := new(catalogmanagementv1.AddObjectAccessListOptions) + addObjectAccessListOptionsModel.CatalogIdentifier = core.StringPtr("testString") + addObjectAccessListOptionsModel.ObjectIdentifier = core.StringPtr("testString") + addObjectAccessListOptionsModel.Accesses = []string{"testString"} + addObjectAccessListOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := catalogManagementService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := catalogManagementService.DeleteObjectAccessList(deleteObjectAccessListOptionsModel) + result, response, operationErr := catalogManagementService.AddObjectAccessList(addObjectAccessListOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the DeleteObjectAccessListOptions model with no property values - deleteObjectAccessListOptionsModelNew := new(catalogmanagementv1.DeleteObjectAccessListOptions) + // Construct a second instance of the AddObjectAccessListOptions model with no property values + addObjectAccessListOptionsModelNew := new(catalogmanagementv1.AddObjectAccessListOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = catalogManagementService.DeleteObjectAccessList(deleteObjectAccessListOptionsModelNew) + result, response, operationErr = catalogManagementService.AddObjectAccessList(addObjectAccessListOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -15401,10 +22762,10 @@ var _ = Describe(`CatalogManagementV1`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(201) })) }) - It(`Invoke DeleteObjectAccessList successfully`, func() { + It(`Invoke AddObjectAccessList successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -15412,15 +22773,15 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the DeleteObjectAccessListOptions model - deleteObjectAccessListOptionsModel := new(catalogmanagementv1.DeleteObjectAccessListOptions) - deleteObjectAccessListOptionsModel.CatalogIdentifier = core.StringPtr("testString") - deleteObjectAccessListOptionsModel.ObjectIdentifier = core.StringPtr("testString") - deleteObjectAccessListOptionsModel.Accounts = []string{"testString"} - deleteObjectAccessListOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the AddObjectAccessListOptions model + addObjectAccessListOptionsModel := new(catalogmanagementv1.AddObjectAccessListOptions) + addObjectAccessListOptionsModel.CatalogIdentifier = core.StringPtr("testString") + addObjectAccessListOptionsModel.ObjectIdentifier = core.StringPtr("testString") + addObjectAccessListOptionsModel.Accesses = []string{"testString"} + addObjectAccessListOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := catalogManagementService.DeleteObjectAccessList(deleteObjectAccessListOptionsModel) + result, response, operationErr := catalogManagementService.AddObjectAccessList(addObjectAccessListOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -15432,22 +22793,45 @@ var _ = Describe(`CatalogManagementV1`, func() { }) }) }) - Describe(`AddObjectAccessList(addObjectAccessListOptions *AddObjectAccessListOptions) - Operation response error`, func() { - addObjectAccessListPath := "/catalogs/testString/objects/testString/access" - Context(`Using mock server endpoint with invalid JSON response`, func() { + Describe(`AccountPublishObject(accountPublishObjectOptions *AccountPublishObjectOptions)`, func() { + accountPublishObjectPath := "/catalogs/testString/objects/testString/account-publish" + Context(`Using mock server endpoint`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(addObjectAccessListPath)) + Expect(req.URL.EscapedPath()).To(Equal(accountPublishObjectPath)) Expect(req.Method).To(Equal("POST")) - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, `} this is not valid json {`) + + res.WriteHeader(202) })) }) - It(`Invoke AddObjectAccessList with error: Operation response processing error`, func() { + It(`Invoke AccountPublishObject successfully`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + response, operationErr := catalogManagementService.AccountPublishObject(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the AccountPublishObjectOptions model + accountPublishObjectOptionsModel := new(catalogmanagementv1.AccountPublishObjectOptions) + accountPublishObjectOptionsModel.CatalogIdentifier = core.StringPtr("testString") + accountPublishObjectOptionsModel.ObjectIdentifier = core.StringPtr("testString") + accountPublishObjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = catalogManagementService.AccountPublishObject(accountPublishObjectOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke AccountPublishObject with error: Operation validation and request error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -15455,139 +22839,115 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the AddObjectAccessListOptions model - addObjectAccessListOptionsModel := new(catalogmanagementv1.AddObjectAccessListOptions) - addObjectAccessListOptionsModel.CatalogIdentifier = core.StringPtr("testString") - addObjectAccessListOptionsModel.ObjectIdentifier = core.StringPtr("testString") - addObjectAccessListOptionsModel.Accounts = []string{"testString"} - addObjectAccessListOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := catalogManagementService.AddObjectAccessList(addObjectAccessListOptionsModel) + // Construct an instance of the AccountPublishObjectOptions model + accountPublishObjectOptionsModel := new(catalogmanagementv1.AccountPublishObjectOptions) + accountPublishObjectOptionsModel.CatalogIdentifier = core.StringPtr("testString") + accountPublishObjectOptionsModel.ObjectIdentifier = core.StringPtr("testString") + accountPublishObjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := catalogManagementService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := catalogManagementService.AccountPublishObject(accountPublishObjectOptionsModel) Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - - // Enable retries and test again - catalogManagementService.EnableRetries(0, 0) - result, response, operationErr = catalogManagementService.AddObjectAccessList(addObjectAccessListOptionsModel) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the AccountPublishObjectOptions model with no property values + accountPublishObjectOptionsModelNew := new(catalogmanagementv1.AccountPublishObjectOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = catalogManagementService.AccountPublishObject(accountPublishObjectOptionsModelNew) Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) + Expect(response).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) }) - Describe(`AddObjectAccessList(addObjectAccessListOptions *AddObjectAccessListOptions)`, func() { - addObjectAccessListPath := "/catalogs/testString/objects/testString/access" - Context(`Using mock server endpoint with timeout`, func() { + Describe(`SharedPublishObject(sharedPublishObjectOptions *SharedPublishObjectOptions)`, func() { + sharedPublishObjectPath := "/catalogs/testString/objects/testString/shared-publish" + Context(`Using mock server endpoint`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(addObjectAccessListPath)) + Expect(req.URL.EscapedPath()).To(Equal(sharedPublishObjectPath)) Expect(req.Method).To(Equal("POST")) - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) - - // Sleep a short time to support a timeout test - time.Sleep(100 * time.Millisecond) - - // Set mock response - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"errors": {"mapKey": "Inner"}}`) + res.WriteHeader(202) })) }) - It(`Invoke AddObjectAccessList successfully with retries`, func() { + It(`Invoke SharedPublishObject successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - catalogManagementService.EnableRetries(0, 0) - // Construct an instance of the AddObjectAccessListOptions model - addObjectAccessListOptionsModel := new(catalogmanagementv1.AddObjectAccessListOptions) - addObjectAccessListOptionsModel.CatalogIdentifier = core.StringPtr("testString") - addObjectAccessListOptionsModel.ObjectIdentifier = core.StringPtr("testString") - addObjectAccessListOptionsModel.Accounts = []string{"testString"} - addObjectAccessListOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with nil options model (negative test) + response, operationErr := catalogManagementService.SharedPublishObject(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) - // Invoke operation with a Context to test a timeout error - ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) - defer cancelFunc() - _, _, operationErr := catalogManagementService.AddObjectAccessListWithContext(ctx, addObjectAccessListOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + // Construct an instance of the SharedPublishObjectOptions model + sharedPublishObjectOptionsModel := new(catalogmanagementv1.SharedPublishObjectOptions) + sharedPublishObjectOptionsModel.CatalogIdentifier = core.StringPtr("testString") + sharedPublishObjectOptionsModel.ObjectIdentifier = core.StringPtr("testString") + sharedPublishObjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Disable retries and test again - catalogManagementService.DisableRetries() - result, response, operationErr := catalogManagementService.AddObjectAccessList(addObjectAccessListOptionsModel) + // Invoke operation with valid options model (positive test) + response, operationErr = catalogManagementService.SharedPublishObject(sharedPublishObjectOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) + }) + It(`Invoke SharedPublishObject with error: Operation validation and request error`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) - // Re-test the timeout error with retries disabled - ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) - defer cancelFunc2() - _, _, operationErr = catalogManagementService.AddObjectAccessListWithContext(ctx, addObjectAccessListOptionsModel) + // Construct an instance of the SharedPublishObjectOptions model + sharedPublishObjectOptionsModel := new(catalogmanagementv1.SharedPublishObjectOptions) + sharedPublishObjectOptionsModel.CatalogIdentifier = core.StringPtr("testString") + sharedPublishObjectOptionsModel.ObjectIdentifier = core.StringPtr("testString") + sharedPublishObjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := catalogManagementService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := catalogManagementService.SharedPublishObject(sharedPublishObjectOptionsModel) Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the SharedPublishObjectOptions model with no property values + sharedPublishObjectOptionsModelNew := new(catalogmanagementv1.SharedPublishObjectOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = catalogManagementService.SharedPublishObject(sharedPublishObjectOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) + }) + Describe(`IBMPublishObject(ibmPublishObjectOptions *IBMPublishObjectOptions)`, func() { + ibmPublishObjectPath := "/catalogs/testString/objects/testString/ibm-publish" Context(`Using mock server endpoint`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(addObjectAccessListPath)) + Expect(req.URL.EscapedPath()).To(Equal(ibmPublishObjectPath)) Expect(req.Method).To(Equal("POST")) - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) - - // Set mock response - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"errors": {"mapKey": "Inner"}}`) + res.WriteHeader(202) })) }) - It(`Invoke AddObjectAccessList successfully`, func() { + It(`Invoke IBMPublishObject successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -15596,26 +22956,22 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := catalogManagementService.AddObjectAccessList(nil) + response, operationErr := catalogManagementService.IBMPublishObject(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - // Construct an instance of the AddObjectAccessListOptions model - addObjectAccessListOptionsModel := new(catalogmanagementv1.AddObjectAccessListOptions) - addObjectAccessListOptionsModel.CatalogIdentifier = core.StringPtr("testString") - addObjectAccessListOptionsModel.ObjectIdentifier = core.StringPtr("testString") - addObjectAccessListOptionsModel.Accounts = []string{"testString"} - addObjectAccessListOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the IBMPublishObjectOptions model + ibmPublishObjectOptionsModel := new(catalogmanagementv1.IBMPublishObjectOptions) + ibmPublishObjectOptionsModel.CatalogIdentifier = core.StringPtr("testString") + ibmPublishObjectOptionsModel.ObjectIdentifier = core.StringPtr("testString") + ibmPublishObjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = catalogManagementService.AddObjectAccessList(addObjectAccessListOptionsModel) + response, operationErr = catalogManagementService.IBMPublishObject(ibmPublishObjectOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - }) - It(`Invoke AddObjectAccessList with error: Operation validation and request error`, func() { + It(`Invoke IBMPublishObject with error: Operation validation and request error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -15623,42 +22979,45 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the AddObjectAccessListOptions model - addObjectAccessListOptionsModel := new(catalogmanagementv1.AddObjectAccessListOptions) - addObjectAccessListOptionsModel.CatalogIdentifier = core.StringPtr("testString") - addObjectAccessListOptionsModel.ObjectIdentifier = core.StringPtr("testString") - addObjectAccessListOptionsModel.Accounts = []string{"testString"} - addObjectAccessListOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the IBMPublishObjectOptions model + ibmPublishObjectOptionsModel := new(catalogmanagementv1.IBMPublishObjectOptions) + ibmPublishObjectOptionsModel.CatalogIdentifier = core.StringPtr("testString") + ibmPublishObjectOptionsModel.ObjectIdentifier = core.StringPtr("testString") + ibmPublishObjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := catalogManagementService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := catalogManagementService.AddObjectAccessList(addObjectAccessListOptionsModel) + response, operationErr := catalogManagementService.IBMPublishObject(ibmPublishObjectOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - // Construct a second instance of the AddObjectAccessListOptions model with no property values - addObjectAccessListOptionsModelNew := new(catalogmanagementv1.AddObjectAccessListOptions) + // Construct a second instance of the IBMPublishObjectOptions model with no property values + ibmPublishObjectOptionsModelNew := new(catalogmanagementv1.IBMPublishObjectOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = catalogManagementService.AddObjectAccessList(addObjectAccessListOptionsModelNew) + response, operationErr = catalogManagementService.IBMPublishObject(ibmPublishObjectOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) - Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) - Context(`Using mock server endpoint with missing response body`, func() { + }) + Describe(`PublicPublishObject(publicPublishObjectOptions *PublicPublishObjectOptions)`, func() { + publicPublishObjectPath := "/catalogs/testString/objects/testString/public-publish" + Context(`Using mock server endpoint`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() - // Set success status code with no respoonse body - res.WriteHeader(200) + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(publicPublishObjectPath)) + Expect(req.Method).To(Equal("POST")) + + res.WriteHeader(202) })) }) - It(`Invoke AddObjectAccessList successfully`, func() { + It(`Invoke PublicPublishObject successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -15666,20 +23025,48 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the AddObjectAccessListOptions model - addObjectAccessListOptionsModel := new(catalogmanagementv1.AddObjectAccessListOptions) - addObjectAccessListOptionsModel.CatalogIdentifier = core.StringPtr("testString") - addObjectAccessListOptionsModel.ObjectIdentifier = core.StringPtr("testString") - addObjectAccessListOptionsModel.Accounts = []string{"testString"} - addObjectAccessListOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with nil options model (negative test) + response, operationErr := catalogManagementService.PublicPublishObject(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) - // Invoke operation - result, response, operationErr := catalogManagementService.AddObjectAccessList(addObjectAccessListOptionsModel) + // Construct an instance of the PublicPublishObjectOptions model + publicPublishObjectOptionsModel := new(catalogmanagementv1.PublicPublishObjectOptions) + publicPublishObjectOptionsModel.CatalogIdentifier = core.StringPtr("testString") + publicPublishObjectOptionsModel.ObjectIdentifier = core.StringPtr("testString") + publicPublishObjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = catalogManagementService.PublicPublishObject(publicPublishObjectOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) + }) + It(`Invoke PublicPublishObject with error: Operation validation and request error`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) - // Verify a nil result - Expect(result).To(BeNil()) + // Construct an instance of the PublicPublishObjectOptions model + publicPublishObjectOptionsModel := new(catalogmanagementv1.PublicPublishObjectOptions) + publicPublishObjectOptionsModel.CatalogIdentifier = core.StringPtr("testString") + publicPublishObjectOptionsModel.ObjectIdentifier = core.StringPtr("testString") + publicPublishObjectOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := catalogManagementService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := catalogManagementService.PublicPublishObject(publicPublishObjectOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the PublicPublishObjectOptions model with no property values + publicPublishObjectOptionsModelNew := new(catalogmanagementv1.PublicPublishObjectOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = catalogManagementService.PublicPublishObject(publicPublishObjectOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -15700,7 +23087,7 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(req.Header["X-Auth-Refresh-Token"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, `} this is not valid json {`) + fmt.Fprint(res, `} this is not valid json {`) })) }) It(`Invoke CreateOfferingInstance with error: Operation response processing error`, func() { @@ -15717,7 +23104,8 @@ var _ = Describe(`CatalogManagementV1`, func() { offeringInstanceLastOperationModel.State = core.StringPtr("testString") offeringInstanceLastOperationModel.Message = core.StringPtr("testString") offeringInstanceLastOperationModel.TransactionID = core.StringPtr("testString") - offeringInstanceLastOperationModel.Updated = core.StringPtr("testString") + offeringInstanceLastOperationModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + offeringInstanceLastOperationModel.Code = core.StringPtr("testString") // Construct an instance of the CreateOfferingInstanceOptions model createOfferingInstanceOptionsModel := new(catalogmanagementv1.CreateOfferingInstanceOptions) @@ -15731,16 +23119,24 @@ var _ = Describe(`CatalogManagementV1`, func() { createOfferingInstanceOptionsModel.OfferingID = core.StringPtr("testString") createOfferingInstanceOptionsModel.KindFormat = core.StringPtr("testString") createOfferingInstanceOptionsModel.Version = core.StringPtr("testString") + createOfferingInstanceOptionsModel.VersionID = core.StringPtr("testString") createOfferingInstanceOptionsModel.ClusterID = core.StringPtr("testString") createOfferingInstanceOptionsModel.ClusterRegion = core.StringPtr("testString") createOfferingInstanceOptionsModel.ClusterNamespaces = []string{"testString"} createOfferingInstanceOptionsModel.ClusterAllNamespaces = core.BoolPtr(true) createOfferingInstanceOptionsModel.SchematicsWorkspaceID = core.StringPtr("testString") - createOfferingInstanceOptionsModel.ResourceGroupID = core.StringPtr("testString") createOfferingInstanceOptionsModel.InstallPlan = core.StringPtr("testString") createOfferingInstanceOptionsModel.Channel = core.StringPtr("testString") + createOfferingInstanceOptionsModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + createOfferingInstanceOptionsModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") createOfferingInstanceOptionsModel.Metadata = make(map[string]interface{}) + createOfferingInstanceOptionsModel.ResourceGroupID = core.StringPtr("testString") + createOfferingInstanceOptionsModel.Location = core.StringPtr("testString") + createOfferingInstanceOptionsModel.Disabled = core.BoolPtr(true) + createOfferingInstanceOptionsModel.Account = core.StringPtr("testString") createOfferingInstanceOptionsModel.LastOperation = offeringInstanceLastOperationModel + createOfferingInstanceOptionsModel.KindTarget = core.StringPtr("testString") + createOfferingInstanceOptionsModel.Sha = core.StringPtr("testString") createOfferingInstanceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response result, response, operationErr := catalogManagementService.CreateOfferingInstance(createOfferingInstanceOptionsModel) @@ -15795,7 +23191,7 @@ var _ = Describe(`CatalogManagementV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "url": "URL", "crn": "CRN", "label": "Label", "catalog_id": "CatalogID", "offering_id": "OfferingID", "kind_format": "KindFormat", "version": "Version", "cluster_id": "ClusterID", "cluster_region": "ClusterRegion", "cluster_namespaces": ["ClusterNamespaces"], "cluster_all_namespaces": true, "schematics_workspace_id": "SchematicsWorkspaceID", "resource_group_id": "ResourceGroupID", "install_plan": "InstallPlan", "channel": "Channel", "metadata": {"mapKey": "anyValue"}, "last_operation": {"operation": "Operation", "state": "State", "message": "Message", "transaction_id": "TransactionID", "updated": "Updated"}}`) + fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "url": "URL", "crn": "CRN", "label": "Label", "catalog_id": "CatalogID", "offering_id": "OfferingID", "kind_format": "KindFormat", "version": "Version", "version_id": "VersionID", "cluster_id": "ClusterID", "cluster_region": "ClusterRegion", "cluster_namespaces": ["ClusterNamespaces"], "cluster_all_namespaces": true, "schematics_workspace_id": "SchematicsWorkspaceID", "install_plan": "InstallPlan", "channel": "Channel", "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "metadata": {"mapKey": "anyValue"}, "resource_group_id": "ResourceGroupID", "location": "Location", "disabled": true, "account": "Account", "last_operation": {"operation": "Operation", "state": "State", "message": "Message", "transaction_id": "TransactionID", "updated": "2019-01-01T12:00:00.000Z", "code": "Code"}, "kind_target": "KindTarget", "sha": "Sha"}`) })) }) It(`Invoke CreateOfferingInstance successfully with retries`, func() { @@ -15813,7 +23209,8 @@ var _ = Describe(`CatalogManagementV1`, func() { offeringInstanceLastOperationModel.State = core.StringPtr("testString") offeringInstanceLastOperationModel.Message = core.StringPtr("testString") offeringInstanceLastOperationModel.TransactionID = core.StringPtr("testString") - offeringInstanceLastOperationModel.Updated = core.StringPtr("testString") + offeringInstanceLastOperationModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + offeringInstanceLastOperationModel.Code = core.StringPtr("testString") // Construct an instance of the CreateOfferingInstanceOptions model createOfferingInstanceOptionsModel := new(catalogmanagementv1.CreateOfferingInstanceOptions) @@ -15827,16 +23224,24 @@ var _ = Describe(`CatalogManagementV1`, func() { createOfferingInstanceOptionsModel.OfferingID = core.StringPtr("testString") createOfferingInstanceOptionsModel.KindFormat = core.StringPtr("testString") createOfferingInstanceOptionsModel.Version = core.StringPtr("testString") + createOfferingInstanceOptionsModel.VersionID = core.StringPtr("testString") createOfferingInstanceOptionsModel.ClusterID = core.StringPtr("testString") createOfferingInstanceOptionsModel.ClusterRegion = core.StringPtr("testString") createOfferingInstanceOptionsModel.ClusterNamespaces = []string{"testString"} createOfferingInstanceOptionsModel.ClusterAllNamespaces = core.BoolPtr(true) createOfferingInstanceOptionsModel.SchematicsWorkspaceID = core.StringPtr("testString") - createOfferingInstanceOptionsModel.ResourceGroupID = core.StringPtr("testString") createOfferingInstanceOptionsModel.InstallPlan = core.StringPtr("testString") createOfferingInstanceOptionsModel.Channel = core.StringPtr("testString") + createOfferingInstanceOptionsModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + createOfferingInstanceOptionsModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") createOfferingInstanceOptionsModel.Metadata = make(map[string]interface{}) + createOfferingInstanceOptionsModel.ResourceGroupID = core.StringPtr("testString") + createOfferingInstanceOptionsModel.Location = core.StringPtr("testString") + createOfferingInstanceOptionsModel.Disabled = core.BoolPtr(true) + createOfferingInstanceOptionsModel.Account = core.StringPtr("testString") createOfferingInstanceOptionsModel.LastOperation = offeringInstanceLastOperationModel + createOfferingInstanceOptionsModel.KindTarget = core.StringPtr("testString") + createOfferingInstanceOptionsModel.Sha = core.StringPtr("testString") createOfferingInstanceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error @@ -15894,7 +23299,7 @@ var _ = Describe(`CatalogManagementV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "url": "URL", "crn": "CRN", "label": "Label", "catalog_id": "CatalogID", "offering_id": "OfferingID", "kind_format": "KindFormat", "version": "Version", "cluster_id": "ClusterID", "cluster_region": "ClusterRegion", "cluster_namespaces": ["ClusterNamespaces"], "cluster_all_namespaces": true, "schematics_workspace_id": "SchematicsWorkspaceID", "resource_group_id": "ResourceGroupID", "install_plan": "InstallPlan", "channel": "Channel", "metadata": {"mapKey": "anyValue"}, "last_operation": {"operation": "Operation", "state": "State", "message": "Message", "transaction_id": "TransactionID", "updated": "Updated"}}`) + fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "url": "URL", "crn": "CRN", "label": "Label", "catalog_id": "CatalogID", "offering_id": "OfferingID", "kind_format": "KindFormat", "version": "Version", "version_id": "VersionID", "cluster_id": "ClusterID", "cluster_region": "ClusterRegion", "cluster_namespaces": ["ClusterNamespaces"], "cluster_all_namespaces": true, "schematics_workspace_id": "SchematicsWorkspaceID", "install_plan": "InstallPlan", "channel": "Channel", "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "metadata": {"mapKey": "anyValue"}, "resource_group_id": "ResourceGroupID", "location": "Location", "disabled": true, "account": "Account", "last_operation": {"operation": "Operation", "state": "State", "message": "Message", "transaction_id": "TransactionID", "updated": "2019-01-01T12:00:00.000Z", "code": "Code"}, "kind_target": "KindTarget", "sha": "Sha"}`) })) }) It(`Invoke CreateOfferingInstance successfully`, func() { @@ -15917,7 +23322,8 @@ var _ = Describe(`CatalogManagementV1`, func() { offeringInstanceLastOperationModel.State = core.StringPtr("testString") offeringInstanceLastOperationModel.Message = core.StringPtr("testString") offeringInstanceLastOperationModel.TransactionID = core.StringPtr("testString") - offeringInstanceLastOperationModel.Updated = core.StringPtr("testString") + offeringInstanceLastOperationModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + offeringInstanceLastOperationModel.Code = core.StringPtr("testString") // Construct an instance of the CreateOfferingInstanceOptions model createOfferingInstanceOptionsModel := new(catalogmanagementv1.CreateOfferingInstanceOptions) @@ -15931,16 +23337,24 @@ var _ = Describe(`CatalogManagementV1`, func() { createOfferingInstanceOptionsModel.OfferingID = core.StringPtr("testString") createOfferingInstanceOptionsModel.KindFormat = core.StringPtr("testString") createOfferingInstanceOptionsModel.Version = core.StringPtr("testString") + createOfferingInstanceOptionsModel.VersionID = core.StringPtr("testString") createOfferingInstanceOptionsModel.ClusterID = core.StringPtr("testString") createOfferingInstanceOptionsModel.ClusterRegion = core.StringPtr("testString") createOfferingInstanceOptionsModel.ClusterNamespaces = []string{"testString"} createOfferingInstanceOptionsModel.ClusterAllNamespaces = core.BoolPtr(true) createOfferingInstanceOptionsModel.SchematicsWorkspaceID = core.StringPtr("testString") - createOfferingInstanceOptionsModel.ResourceGroupID = core.StringPtr("testString") createOfferingInstanceOptionsModel.InstallPlan = core.StringPtr("testString") createOfferingInstanceOptionsModel.Channel = core.StringPtr("testString") + createOfferingInstanceOptionsModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + createOfferingInstanceOptionsModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") createOfferingInstanceOptionsModel.Metadata = make(map[string]interface{}) + createOfferingInstanceOptionsModel.ResourceGroupID = core.StringPtr("testString") + createOfferingInstanceOptionsModel.Location = core.StringPtr("testString") + createOfferingInstanceOptionsModel.Disabled = core.BoolPtr(true) + createOfferingInstanceOptionsModel.Account = core.StringPtr("testString") createOfferingInstanceOptionsModel.LastOperation = offeringInstanceLastOperationModel + createOfferingInstanceOptionsModel.KindTarget = core.StringPtr("testString") + createOfferingInstanceOptionsModel.Sha = core.StringPtr("testString") createOfferingInstanceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) @@ -15964,7 +23378,8 @@ var _ = Describe(`CatalogManagementV1`, func() { offeringInstanceLastOperationModel.State = core.StringPtr("testString") offeringInstanceLastOperationModel.Message = core.StringPtr("testString") offeringInstanceLastOperationModel.TransactionID = core.StringPtr("testString") - offeringInstanceLastOperationModel.Updated = core.StringPtr("testString") + offeringInstanceLastOperationModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + offeringInstanceLastOperationModel.Code = core.StringPtr("testString") // Construct an instance of the CreateOfferingInstanceOptions model createOfferingInstanceOptionsModel := new(catalogmanagementv1.CreateOfferingInstanceOptions) @@ -15978,16 +23393,24 @@ var _ = Describe(`CatalogManagementV1`, func() { createOfferingInstanceOptionsModel.OfferingID = core.StringPtr("testString") createOfferingInstanceOptionsModel.KindFormat = core.StringPtr("testString") createOfferingInstanceOptionsModel.Version = core.StringPtr("testString") + createOfferingInstanceOptionsModel.VersionID = core.StringPtr("testString") createOfferingInstanceOptionsModel.ClusterID = core.StringPtr("testString") createOfferingInstanceOptionsModel.ClusterRegion = core.StringPtr("testString") createOfferingInstanceOptionsModel.ClusterNamespaces = []string{"testString"} createOfferingInstanceOptionsModel.ClusterAllNamespaces = core.BoolPtr(true) createOfferingInstanceOptionsModel.SchematicsWorkspaceID = core.StringPtr("testString") - createOfferingInstanceOptionsModel.ResourceGroupID = core.StringPtr("testString") createOfferingInstanceOptionsModel.InstallPlan = core.StringPtr("testString") createOfferingInstanceOptionsModel.Channel = core.StringPtr("testString") + createOfferingInstanceOptionsModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + createOfferingInstanceOptionsModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") createOfferingInstanceOptionsModel.Metadata = make(map[string]interface{}) + createOfferingInstanceOptionsModel.ResourceGroupID = core.StringPtr("testString") + createOfferingInstanceOptionsModel.Location = core.StringPtr("testString") + createOfferingInstanceOptionsModel.Disabled = core.BoolPtr(true) + createOfferingInstanceOptionsModel.Account = core.StringPtr("testString") createOfferingInstanceOptionsModel.LastOperation = offeringInstanceLastOperationModel + createOfferingInstanceOptionsModel.KindTarget = core.StringPtr("testString") + createOfferingInstanceOptionsModel.Sha = core.StringPtr("testString") createOfferingInstanceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := catalogManagementService.SetServiceURL("") @@ -16032,7 +23455,8 @@ var _ = Describe(`CatalogManagementV1`, func() { offeringInstanceLastOperationModel.State = core.StringPtr("testString") offeringInstanceLastOperationModel.Message = core.StringPtr("testString") offeringInstanceLastOperationModel.TransactionID = core.StringPtr("testString") - offeringInstanceLastOperationModel.Updated = core.StringPtr("testString") + offeringInstanceLastOperationModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + offeringInstanceLastOperationModel.Code = core.StringPtr("testString") // Construct an instance of the CreateOfferingInstanceOptions model createOfferingInstanceOptionsModel := new(catalogmanagementv1.CreateOfferingInstanceOptions) @@ -16046,16 +23470,24 @@ var _ = Describe(`CatalogManagementV1`, func() { createOfferingInstanceOptionsModel.OfferingID = core.StringPtr("testString") createOfferingInstanceOptionsModel.KindFormat = core.StringPtr("testString") createOfferingInstanceOptionsModel.Version = core.StringPtr("testString") + createOfferingInstanceOptionsModel.VersionID = core.StringPtr("testString") createOfferingInstanceOptionsModel.ClusterID = core.StringPtr("testString") createOfferingInstanceOptionsModel.ClusterRegion = core.StringPtr("testString") createOfferingInstanceOptionsModel.ClusterNamespaces = []string{"testString"} createOfferingInstanceOptionsModel.ClusterAllNamespaces = core.BoolPtr(true) createOfferingInstanceOptionsModel.SchematicsWorkspaceID = core.StringPtr("testString") - createOfferingInstanceOptionsModel.ResourceGroupID = core.StringPtr("testString") createOfferingInstanceOptionsModel.InstallPlan = core.StringPtr("testString") createOfferingInstanceOptionsModel.Channel = core.StringPtr("testString") + createOfferingInstanceOptionsModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + createOfferingInstanceOptionsModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") createOfferingInstanceOptionsModel.Metadata = make(map[string]interface{}) + createOfferingInstanceOptionsModel.ResourceGroupID = core.StringPtr("testString") + createOfferingInstanceOptionsModel.Location = core.StringPtr("testString") + createOfferingInstanceOptionsModel.Disabled = core.BoolPtr(true) + createOfferingInstanceOptionsModel.Account = core.StringPtr("testString") createOfferingInstanceOptionsModel.LastOperation = offeringInstanceLastOperationModel + createOfferingInstanceOptionsModel.KindTarget = core.StringPtr("testString") + createOfferingInstanceOptionsModel.Sha = core.StringPtr("testString") createOfferingInstanceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation @@ -16083,7 +23515,7 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(req.Method).To(Equal("GET")) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, `} this is not valid json {`) + fmt.Fprint(res, `} this is not valid json {`) })) }) It(`Invoke GetOfferingInstance with error: Operation response processing error`, func() { @@ -16133,10 +23565,279 @@ var _ = Describe(`CatalogManagementV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "url": "URL", "crn": "CRN", "label": "Label", "catalog_id": "CatalogID", "offering_id": "OfferingID", "kind_format": "KindFormat", "version": "Version", "cluster_id": "ClusterID", "cluster_region": "ClusterRegion", "cluster_namespaces": ["ClusterNamespaces"], "cluster_all_namespaces": true, "schematics_workspace_id": "SchematicsWorkspaceID", "resource_group_id": "ResourceGroupID", "install_plan": "InstallPlan", "channel": "Channel", "metadata": {"mapKey": "anyValue"}, "last_operation": {"operation": "Operation", "state": "State", "message": "Message", "transaction_id": "TransactionID", "updated": "Updated"}}`) + fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "url": "URL", "crn": "CRN", "label": "Label", "catalog_id": "CatalogID", "offering_id": "OfferingID", "kind_format": "KindFormat", "version": "Version", "version_id": "VersionID", "cluster_id": "ClusterID", "cluster_region": "ClusterRegion", "cluster_namespaces": ["ClusterNamespaces"], "cluster_all_namespaces": true, "schematics_workspace_id": "SchematicsWorkspaceID", "install_plan": "InstallPlan", "channel": "Channel", "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "metadata": {"mapKey": "anyValue"}, "resource_group_id": "ResourceGroupID", "location": "Location", "disabled": true, "account": "Account", "last_operation": {"operation": "Operation", "state": "State", "message": "Message", "transaction_id": "TransactionID", "updated": "2019-01-01T12:00:00.000Z", "code": "Code"}, "kind_target": "KindTarget", "sha": "Sha"}`) + })) + }) + It(`Invoke GetOfferingInstance successfully with retries`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + catalogManagementService.EnableRetries(0, 0) + + // Construct an instance of the GetOfferingInstanceOptions model + getOfferingInstanceOptionsModel := new(catalogmanagementv1.GetOfferingInstanceOptions) + getOfferingInstanceOptionsModel.InstanceIdentifier = core.StringPtr("testString") + getOfferingInstanceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := catalogManagementService.GetOfferingInstanceWithContext(ctx, getOfferingInstanceOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + catalogManagementService.DisableRetries() + result, response, operationErr := catalogManagementService.GetOfferingInstance(getOfferingInstanceOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = catalogManagementService.GetOfferingInstanceWithContext(ctx, getOfferingInstanceOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getOfferingInstancePath)) + Expect(req.Method).To(Equal("GET")) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "url": "URL", "crn": "CRN", "label": "Label", "catalog_id": "CatalogID", "offering_id": "OfferingID", "kind_format": "KindFormat", "version": "Version", "version_id": "VersionID", "cluster_id": "ClusterID", "cluster_region": "ClusterRegion", "cluster_namespaces": ["ClusterNamespaces"], "cluster_all_namespaces": true, "schematics_workspace_id": "SchematicsWorkspaceID", "install_plan": "InstallPlan", "channel": "Channel", "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "metadata": {"mapKey": "anyValue"}, "resource_group_id": "ResourceGroupID", "location": "Location", "disabled": true, "account": "Account", "last_operation": {"operation": "Operation", "state": "State", "message": "Message", "transaction_id": "TransactionID", "updated": "2019-01-01T12:00:00.000Z", "code": "Code"}, "kind_target": "KindTarget", "sha": "Sha"}`) + })) + }) + It(`Invoke GetOfferingInstance successfully`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := catalogManagementService.GetOfferingInstance(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetOfferingInstanceOptions model + getOfferingInstanceOptionsModel := new(catalogmanagementv1.GetOfferingInstanceOptions) + getOfferingInstanceOptionsModel.InstanceIdentifier = core.StringPtr("testString") + getOfferingInstanceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = catalogManagementService.GetOfferingInstance(getOfferingInstanceOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetOfferingInstance with error: Operation validation and request error`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Construct an instance of the GetOfferingInstanceOptions model + getOfferingInstanceOptionsModel := new(catalogmanagementv1.GetOfferingInstanceOptions) + getOfferingInstanceOptionsModel.InstanceIdentifier = core.StringPtr("testString") + getOfferingInstanceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := catalogManagementService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := catalogManagementService.GetOfferingInstance(getOfferingInstanceOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the GetOfferingInstanceOptions model with no property values + getOfferingInstanceOptionsModelNew := new(catalogmanagementv1.GetOfferingInstanceOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = catalogManagementService.GetOfferingInstance(getOfferingInstanceOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke GetOfferingInstance successfully`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Construct an instance of the GetOfferingInstanceOptions model + getOfferingInstanceOptionsModel := new(catalogmanagementv1.GetOfferingInstanceOptions) + getOfferingInstanceOptionsModel.InstanceIdentifier = core.StringPtr("testString") + getOfferingInstanceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := catalogManagementService.GetOfferingInstance(getOfferingInstanceOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`PutOfferingInstance(putOfferingInstanceOptions *PutOfferingInstanceOptions) - Operation response error`, func() { + putOfferingInstancePath := "/instances/offerings/testString" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(putOfferingInstancePath)) + Expect(req.Method).To(Equal("PUT")) + Expect(req.Header["X-Auth-Refresh-Token"]).ToNot(BeNil()) + Expect(req.Header["X-Auth-Refresh-Token"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke PutOfferingInstance with error: Operation response processing error`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Construct an instance of the OfferingInstanceLastOperation model + offeringInstanceLastOperationModel := new(catalogmanagementv1.OfferingInstanceLastOperation) + offeringInstanceLastOperationModel.Operation = core.StringPtr("testString") + offeringInstanceLastOperationModel.State = core.StringPtr("testString") + offeringInstanceLastOperationModel.Message = core.StringPtr("testString") + offeringInstanceLastOperationModel.TransactionID = core.StringPtr("testString") + offeringInstanceLastOperationModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + offeringInstanceLastOperationModel.Code = core.StringPtr("testString") + + // Construct an instance of the PutOfferingInstanceOptions model + putOfferingInstanceOptionsModel := new(catalogmanagementv1.PutOfferingInstanceOptions) + putOfferingInstanceOptionsModel.InstanceIdentifier = core.StringPtr("testString") + putOfferingInstanceOptionsModel.XAuthRefreshToken = core.StringPtr("testString") + putOfferingInstanceOptionsModel.ID = core.StringPtr("testString") + putOfferingInstanceOptionsModel.Rev = core.StringPtr("testString") + putOfferingInstanceOptionsModel.URL = core.StringPtr("testString") + putOfferingInstanceOptionsModel.CRN = core.StringPtr("testString") + putOfferingInstanceOptionsModel.Label = core.StringPtr("testString") + putOfferingInstanceOptionsModel.CatalogID = core.StringPtr("testString") + putOfferingInstanceOptionsModel.OfferingID = core.StringPtr("testString") + putOfferingInstanceOptionsModel.KindFormat = core.StringPtr("testString") + putOfferingInstanceOptionsModel.Version = core.StringPtr("testString") + putOfferingInstanceOptionsModel.VersionID = core.StringPtr("testString") + putOfferingInstanceOptionsModel.ClusterID = core.StringPtr("testString") + putOfferingInstanceOptionsModel.ClusterRegion = core.StringPtr("testString") + putOfferingInstanceOptionsModel.ClusterNamespaces = []string{"testString"} + putOfferingInstanceOptionsModel.ClusterAllNamespaces = core.BoolPtr(true) + putOfferingInstanceOptionsModel.SchematicsWorkspaceID = core.StringPtr("testString") + putOfferingInstanceOptionsModel.InstallPlan = core.StringPtr("testString") + putOfferingInstanceOptionsModel.Channel = core.StringPtr("testString") + putOfferingInstanceOptionsModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + putOfferingInstanceOptionsModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + putOfferingInstanceOptionsModel.Metadata = make(map[string]interface{}) + putOfferingInstanceOptionsModel.ResourceGroupID = core.StringPtr("testString") + putOfferingInstanceOptionsModel.Location = core.StringPtr("testString") + putOfferingInstanceOptionsModel.Disabled = core.BoolPtr(true) + putOfferingInstanceOptionsModel.Account = core.StringPtr("testString") + putOfferingInstanceOptionsModel.LastOperation = offeringInstanceLastOperationModel + putOfferingInstanceOptionsModel.KindTarget = core.StringPtr("testString") + putOfferingInstanceOptionsModel.Sha = core.StringPtr("testString") + putOfferingInstanceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := catalogManagementService.PutOfferingInstance(putOfferingInstanceOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + catalogManagementService.EnableRetries(0, 0) + result, response, operationErr = catalogManagementService.PutOfferingInstance(putOfferingInstanceOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`PutOfferingInstance(putOfferingInstanceOptions *PutOfferingInstanceOptions)`, func() { + putOfferingInstancePath := "/instances/offerings/testString" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(putOfferingInstancePath)) + Expect(req.Method).To(Equal("PUT")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + Expect(req.Header["X-Auth-Refresh-Token"]).ToNot(BeNil()) + Expect(req.Header["X-Auth-Refresh-Token"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "url": "URL", "crn": "CRN", "label": "Label", "catalog_id": "CatalogID", "offering_id": "OfferingID", "kind_format": "KindFormat", "version": "Version", "version_id": "VersionID", "cluster_id": "ClusterID", "cluster_region": "ClusterRegion", "cluster_namespaces": ["ClusterNamespaces"], "cluster_all_namespaces": true, "schematics_workspace_id": "SchematicsWorkspaceID", "install_plan": "InstallPlan", "channel": "Channel", "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "metadata": {"mapKey": "anyValue"}, "resource_group_id": "ResourceGroupID", "location": "Location", "disabled": true, "account": "Account", "last_operation": {"operation": "Operation", "state": "State", "message": "Message", "transaction_id": "TransactionID", "updated": "2019-01-01T12:00:00.000Z", "code": "Code"}, "kind_target": "KindTarget", "sha": "Sha"}`) })) }) - It(`Invoke GetOfferingInstance successfully with retries`, func() { + It(`Invoke PutOfferingInstance successfully with retries`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -16145,21 +23846,58 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) catalogManagementService.EnableRetries(0, 0) - // Construct an instance of the GetOfferingInstanceOptions model - getOfferingInstanceOptionsModel := new(catalogmanagementv1.GetOfferingInstanceOptions) - getOfferingInstanceOptionsModel.InstanceIdentifier = core.StringPtr("testString") - getOfferingInstanceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the OfferingInstanceLastOperation model + offeringInstanceLastOperationModel := new(catalogmanagementv1.OfferingInstanceLastOperation) + offeringInstanceLastOperationModel.Operation = core.StringPtr("testString") + offeringInstanceLastOperationModel.State = core.StringPtr("testString") + offeringInstanceLastOperationModel.Message = core.StringPtr("testString") + offeringInstanceLastOperationModel.TransactionID = core.StringPtr("testString") + offeringInstanceLastOperationModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + offeringInstanceLastOperationModel.Code = core.StringPtr("testString") + + // Construct an instance of the PutOfferingInstanceOptions model + putOfferingInstanceOptionsModel := new(catalogmanagementv1.PutOfferingInstanceOptions) + putOfferingInstanceOptionsModel.InstanceIdentifier = core.StringPtr("testString") + putOfferingInstanceOptionsModel.XAuthRefreshToken = core.StringPtr("testString") + putOfferingInstanceOptionsModel.ID = core.StringPtr("testString") + putOfferingInstanceOptionsModel.Rev = core.StringPtr("testString") + putOfferingInstanceOptionsModel.URL = core.StringPtr("testString") + putOfferingInstanceOptionsModel.CRN = core.StringPtr("testString") + putOfferingInstanceOptionsModel.Label = core.StringPtr("testString") + putOfferingInstanceOptionsModel.CatalogID = core.StringPtr("testString") + putOfferingInstanceOptionsModel.OfferingID = core.StringPtr("testString") + putOfferingInstanceOptionsModel.KindFormat = core.StringPtr("testString") + putOfferingInstanceOptionsModel.Version = core.StringPtr("testString") + putOfferingInstanceOptionsModel.VersionID = core.StringPtr("testString") + putOfferingInstanceOptionsModel.ClusterID = core.StringPtr("testString") + putOfferingInstanceOptionsModel.ClusterRegion = core.StringPtr("testString") + putOfferingInstanceOptionsModel.ClusterNamespaces = []string{"testString"} + putOfferingInstanceOptionsModel.ClusterAllNamespaces = core.BoolPtr(true) + putOfferingInstanceOptionsModel.SchematicsWorkspaceID = core.StringPtr("testString") + putOfferingInstanceOptionsModel.InstallPlan = core.StringPtr("testString") + putOfferingInstanceOptionsModel.Channel = core.StringPtr("testString") + putOfferingInstanceOptionsModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + putOfferingInstanceOptionsModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + putOfferingInstanceOptionsModel.Metadata = make(map[string]interface{}) + putOfferingInstanceOptionsModel.ResourceGroupID = core.StringPtr("testString") + putOfferingInstanceOptionsModel.Location = core.StringPtr("testString") + putOfferingInstanceOptionsModel.Disabled = core.BoolPtr(true) + putOfferingInstanceOptionsModel.Account = core.StringPtr("testString") + putOfferingInstanceOptionsModel.LastOperation = offeringInstanceLastOperationModel + putOfferingInstanceOptionsModel.KindTarget = core.StringPtr("testString") + putOfferingInstanceOptionsModel.Sha = core.StringPtr("testString") + putOfferingInstanceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := catalogManagementService.GetOfferingInstanceWithContext(ctx, getOfferingInstanceOptionsModel) + _, _, operationErr := catalogManagementService.PutOfferingInstanceWithContext(ctx, putOfferingInstanceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again catalogManagementService.DisableRetries() - result, response, operationErr := catalogManagementService.GetOfferingInstance(getOfferingInstanceOptionsModel) + result, response, operationErr := catalogManagementService.PutOfferingInstance(putOfferingInstanceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -16167,7 +23905,7 @@ var _ = Describe(`CatalogManagementV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = catalogManagementService.GetOfferingInstanceWithContext(ctx, getOfferingInstanceOptionsModel) + _, _, operationErr = catalogManagementService.PutOfferingInstanceWithContext(ctx, putOfferingInstanceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -16181,16 +23919,34 @@ var _ = Describe(`CatalogManagementV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getOfferingInstancePath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(putOfferingInstancePath)) + Expect(req.Method).To(Equal("PUT")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.Header["X-Auth-Refresh-Token"]).ToNot(BeNil()) + Expect(req.Header["X-Auth-Refresh-Token"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "url": "URL", "crn": "CRN", "label": "Label", "catalog_id": "CatalogID", "offering_id": "OfferingID", "kind_format": "KindFormat", "version": "Version", "cluster_id": "ClusterID", "cluster_region": "ClusterRegion", "cluster_namespaces": ["ClusterNamespaces"], "cluster_all_namespaces": true, "schematics_workspace_id": "SchematicsWorkspaceID", "resource_group_id": "ResourceGroupID", "install_plan": "InstallPlan", "channel": "Channel", "metadata": {"mapKey": "anyValue"}, "last_operation": {"operation": "Operation", "state": "State", "message": "Message", "transaction_id": "TransactionID", "updated": "Updated"}}`) + fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "url": "URL", "crn": "CRN", "label": "Label", "catalog_id": "CatalogID", "offering_id": "OfferingID", "kind_format": "KindFormat", "version": "Version", "version_id": "VersionID", "cluster_id": "ClusterID", "cluster_region": "ClusterRegion", "cluster_namespaces": ["ClusterNamespaces"], "cluster_all_namespaces": true, "schematics_workspace_id": "SchematicsWorkspaceID", "install_plan": "InstallPlan", "channel": "Channel", "created": "2019-01-01T12:00:00.000Z", "updated": "2019-01-01T12:00:00.000Z", "metadata": {"mapKey": "anyValue"}, "resource_group_id": "ResourceGroupID", "location": "Location", "disabled": true, "account": "Account", "last_operation": {"operation": "Operation", "state": "State", "message": "Message", "transaction_id": "TransactionID", "updated": "2019-01-01T12:00:00.000Z", "code": "Code"}, "kind_target": "KindTarget", "sha": "Sha"}`) })) }) - It(`Invoke GetOfferingInstance successfully`, func() { + It(`Invoke PutOfferingInstance successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -16199,24 +23955,61 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := catalogManagementService.GetOfferingInstance(nil) + result, response, operationErr := catalogManagementService.PutOfferingInstance(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetOfferingInstanceOptions model - getOfferingInstanceOptionsModel := new(catalogmanagementv1.GetOfferingInstanceOptions) - getOfferingInstanceOptionsModel.InstanceIdentifier = core.StringPtr("testString") - getOfferingInstanceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the OfferingInstanceLastOperation model + offeringInstanceLastOperationModel := new(catalogmanagementv1.OfferingInstanceLastOperation) + offeringInstanceLastOperationModel.Operation = core.StringPtr("testString") + offeringInstanceLastOperationModel.State = core.StringPtr("testString") + offeringInstanceLastOperationModel.Message = core.StringPtr("testString") + offeringInstanceLastOperationModel.TransactionID = core.StringPtr("testString") + offeringInstanceLastOperationModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + offeringInstanceLastOperationModel.Code = core.StringPtr("testString") + + // Construct an instance of the PutOfferingInstanceOptions model + putOfferingInstanceOptionsModel := new(catalogmanagementv1.PutOfferingInstanceOptions) + putOfferingInstanceOptionsModel.InstanceIdentifier = core.StringPtr("testString") + putOfferingInstanceOptionsModel.XAuthRefreshToken = core.StringPtr("testString") + putOfferingInstanceOptionsModel.ID = core.StringPtr("testString") + putOfferingInstanceOptionsModel.Rev = core.StringPtr("testString") + putOfferingInstanceOptionsModel.URL = core.StringPtr("testString") + putOfferingInstanceOptionsModel.CRN = core.StringPtr("testString") + putOfferingInstanceOptionsModel.Label = core.StringPtr("testString") + putOfferingInstanceOptionsModel.CatalogID = core.StringPtr("testString") + putOfferingInstanceOptionsModel.OfferingID = core.StringPtr("testString") + putOfferingInstanceOptionsModel.KindFormat = core.StringPtr("testString") + putOfferingInstanceOptionsModel.Version = core.StringPtr("testString") + putOfferingInstanceOptionsModel.VersionID = core.StringPtr("testString") + putOfferingInstanceOptionsModel.ClusterID = core.StringPtr("testString") + putOfferingInstanceOptionsModel.ClusterRegion = core.StringPtr("testString") + putOfferingInstanceOptionsModel.ClusterNamespaces = []string{"testString"} + putOfferingInstanceOptionsModel.ClusterAllNamespaces = core.BoolPtr(true) + putOfferingInstanceOptionsModel.SchematicsWorkspaceID = core.StringPtr("testString") + putOfferingInstanceOptionsModel.InstallPlan = core.StringPtr("testString") + putOfferingInstanceOptionsModel.Channel = core.StringPtr("testString") + putOfferingInstanceOptionsModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + putOfferingInstanceOptionsModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + putOfferingInstanceOptionsModel.Metadata = make(map[string]interface{}) + putOfferingInstanceOptionsModel.ResourceGroupID = core.StringPtr("testString") + putOfferingInstanceOptionsModel.Location = core.StringPtr("testString") + putOfferingInstanceOptionsModel.Disabled = core.BoolPtr(true) + putOfferingInstanceOptionsModel.Account = core.StringPtr("testString") + putOfferingInstanceOptionsModel.LastOperation = offeringInstanceLastOperationModel + putOfferingInstanceOptionsModel.KindTarget = core.StringPtr("testString") + putOfferingInstanceOptionsModel.Sha = core.StringPtr("testString") + putOfferingInstanceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = catalogManagementService.GetOfferingInstance(getOfferingInstanceOptionsModel) + result, response, operationErr = catalogManagementService.PutOfferingInstance(putOfferingInstanceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetOfferingInstance with error: Operation validation and request error`, func() { + It(`Invoke PutOfferingInstance with error: Operation validation and request error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -16224,22 +24017,59 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the GetOfferingInstanceOptions model - getOfferingInstanceOptionsModel := new(catalogmanagementv1.GetOfferingInstanceOptions) - getOfferingInstanceOptionsModel.InstanceIdentifier = core.StringPtr("testString") - getOfferingInstanceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the OfferingInstanceLastOperation model + offeringInstanceLastOperationModel := new(catalogmanagementv1.OfferingInstanceLastOperation) + offeringInstanceLastOperationModel.Operation = core.StringPtr("testString") + offeringInstanceLastOperationModel.State = core.StringPtr("testString") + offeringInstanceLastOperationModel.Message = core.StringPtr("testString") + offeringInstanceLastOperationModel.TransactionID = core.StringPtr("testString") + offeringInstanceLastOperationModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + offeringInstanceLastOperationModel.Code = core.StringPtr("testString") + + // Construct an instance of the PutOfferingInstanceOptions model + putOfferingInstanceOptionsModel := new(catalogmanagementv1.PutOfferingInstanceOptions) + putOfferingInstanceOptionsModel.InstanceIdentifier = core.StringPtr("testString") + putOfferingInstanceOptionsModel.XAuthRefreshToken = core.StringPtr("testString") + putOfferingInstanceOptionsModel.ID = core.StringPtr("testString") + putOfferingInstanceOptionsModel.Rev = core.StringPtr("testString") + putOfferingInstanceOptionsModel.URL = core.StringPtr("testString") + putOfferingInstanceOptionsModel.CRN = core.StringPtr("testString") + putOfferingInstanceOptionsModel.Label = core.StringPtr("testString") + putOfferingInstanceOptionsModel.CatalogID = core.StringPtr("testString") + putOfferingInstanceOptionsModel.OfferingID = core.StringPtr("testString") + putOfferingInstanceOptionsModel.KindFormat = core.StringPtr("testString") + putOfferingInstanceOptionsModel.Version = core.StringPtr("testString") + putOfferingInstanceOptionsModel.VersionID = core.StringPtr("testString") + putOfferingInstanceOptionsModel.ClusterID = core.StringPtr("testString") + putOfferingInstanceOptionsModel.ClusterRegion = core.StringPtr("testString") + putOfferingInstanceOptionsModel.ClusterNamespaces = []string{"testString"} + putOfferingInstanceOptionsModel.ClusterAllNamespaces = core.BoolPtr(true) + putOfferingInstanceOptionsModel.SchematicsWorkspaceID = core.StringPtr("testString") + putOfferingInstanceOptionsModel.InstallPlan = core.StringPtr("testString") + putOfferingInstanceOptionsModel.Channel = core.StringPtr("testString") + putOfferingInstanceOptionsModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + putOfferingInstanceOptionsModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + putOfferingInstanceOptionsModel.Metadata = make(map[string]interface{}) + putOfferingInstanceOptionsModel.ResourceGroupID = core.StringPtr("testString") + putOfferingInstanceOptionsModel.Location = core.StringPtr("testString") + putOfferingInstanceOptionsModel.Disabled = core.BoolPtr(true) + putOfferingInstanceOptionsModel.Account = core.StringPtr("testString") + putOfferingInstanceOptionsModel.LastOperation = offeringInstanceLastOperationModel + putOfferingInstanceOptionsModel.KindTarget = core.StringPtr("testString") + putOfferingInstanceOptionsModel.Sha = core.StringPtr("testString") + putOfferingInstanceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := catalogManagementService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := catalogManagementService.GetOfferingInstance(getOfferingInstanceOptionsModel) + result, response, operationErr := catalogManagementService.PutOfferingInstance(putOfferingInstanceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetOfferingInstanceOptions model with no property values - getOfferingInstanceOptionsModelNew := new(catalogmanagementv1.GetOfferingInstanceOptions) + // Construct a second instance of the PutOfferingInstanceOptions model with no property values + putOfferingInstanceOptionsModelNew := new(catalogmanagementv1.PutOfferingInstanceOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = catalogManagementService.GetOfferingInstance(getOfferingInstanceOptionsModelNew) + result, response, operationErr = catalogManagementService.PutOfferingInstance(putOfferingInstanceOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -16257,7 +24087,7 @@ var _ = Describe(`CatalogManagementV1`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetOfferingInstance successfully`, func() { + It(`Invoke PutOfferingInstance successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -16265,42 +24095,152 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the GetOfferingInstanceOptions model - getOfferingInstanceOptionsModel := new(catalogmanagementv1.GetOfferingInstanceOptions) - getOfferingInstanceOptionsModel.InstanceIdentifier = core.StringPtr("testString") - getOfferingInstanceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the OfferingInstanceLastOperation model + offeringInstanceLastOperationModel := new(catalogmanagementv1.OfferingInstanceLastOperation) + offeringInstanceLastOperationModel.Operation = core.StringPtr("testString") + offeringInstanceLastOperationModel.State = core.StringPtr("testString") + offeringInstanceLastOperationModel.Message = core.StringPtr("testString") + offeringInstanceLastOperationModel.TransactionID = core.StringPtr("testString") + offeringInstanceLastOperationModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + offeringInstanceLastOperationModel.Code = core.StringPtr("testString") + + // Construct an instance of the PutOfferingInstanceOptions model + putOfferingInstanceOptionsModel := new(catalogmanagementv1.PutOfferingInstanceOptions) + putOfferingInstanceOptionsModel.InstanceIdentifier = core.StringPtr("testString") + putOfferingInstanceOptionsModel.XAuthRefreshToken = core.StringPtr("testString") + putOfferingInstanceOptionsModel.ID = core.StringPtr("testString") + putOfferingInstanceOptionsModel.Rev = core.StringPtr("testString") + putOfferingInstanceOptionsModel.URL = core.StringPtr("testString") + putOfferingInstanceOptionsModel.CRN = core.StringPtr("testString") + putOfferingInstanceOptionsModel.Label = core.StringPtr("testString") + putOfferingInstanceOptionsModel.CatalogID = core.StringPtr("testString") + putOfferingInstanceOptionsModel.OfferingID = core.StringPtr("testString") + putOfferingInstanceOptionsModel.KindFormat = core.StringPtr("testString") + putOfferingInstanceOptionsModel.Version = core.StringPtr("testString") + putOfferingInstanceOptionsModel.VersionID = core.StringPtr("testString") + putOfferingInstanceOptionsModel.ClusterID = core.StringPtr("testString") + putOfferingInstanceOptionsModel.ClusterRegion = core.StringPtr("testString") + putOfferingInstanceOptionsModel.ClusterNamespaces = []string{"testString"} + putOfferingInstanceOptionsModel.ClusterAllNamespaces = core.BoolPtr(true) + putOfferingInstanceOptionsModel.SchematicsWorkspaceID = core.StringPtr("testString") + putOfferingInstanceOptionsModel.InstallPlan = core.StringPtr("testString") + putOfferingInstanceOptionsModel.Channel = core.StringPtr("testString") + putOfferingInstanceOptionsModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") + putOfferingInstanceOptionsModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + putOfferingInstanceOptionsModel.Metadata = make(map[string]interface{}) + putOfferingInstanceOptionsModel.ResourceGroupID = core.StringPtr("testString") + putOfferingInstanceOptionsModel.Location = core.StringPtr("testString") + putOfferingInstanceOptionsModel.Disabled = core.BoolPtr(true) + putOfferingInstanceOptionsModel.Account = core.StringPtr("testString") + putOfferingInstanceOptionsModel.LastOperation = offeringInstanceLastOperationModel + putOfferingInstanceOptionsModel.KindTarget = core.StringPtr("testString") + putOfferingInstanceOptionsModel.Sha = core.StringPtr("testString") + putOfferingInstanceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := catalogManagementService.GetOfferingInstance(getOfferingInstanceOptionsModel) + result, response, operationErr := catalogManagementService.PutOfferingInstance(putOfferingInstanceOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteOfferingInstance(deleteOfferingInstanceOptions *DeleteOfferingInstanceOptions)`, func() { + deleteOfferingInstancePath := "/instances/offerings/testString" + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(deleteOfferingInstancePath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.Header["X-Auth-Refresh-Token"]).ToNot(BeNil()) + Expect(req.Header["X-Auth-Refresh-Token"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + res.WriteHeader(200) + })) + }) + It(`Invoke DeleteOfferingInstance successfully`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + response, operationErr := catalogManagementService.DeleteOfferingInstance(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteOfferingInstanceOptions model + deleteOfferingInstanceOptionsModel := new(catalogmanagementv1.DeleteOfferingInstanceOptions) + deleteOfferingInstanceOptionsModel.InstanceIdentifier = core.StringPtr("testString") + deleteOfferingInstanceOptionsModel.XAuthRefreshToken = core.StringPtr("testString") + deleteOfferingInstanceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = catalogManagementService.DeleteOfferingInstance(deleteOfferingInstanceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteOfferingInstance with error: Operation validation and request error`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) - // Verify a nil result - Expect(result).To(BeNil()) + // Construct an instance of the DeleteOfferingInstanceOptions model + deleteOfferingInstanceOptionsModel := new(catalogmanagementv1.DeleteOfferingInstanceOptions) + deleteOfferingInstanceOptionsModel.InstanceIdentifier = core.StringPtr("testString") + deleteOfferingInstanceOptionsModel.XAuthRefreshToken = core.StringPtr("testString") + deleteOfferingInstanceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := catalogManagementService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := catalogManagementService.DeleteOfferingInstance(deleteOfferingInstanceOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteOfferingInstanceOptions model with no property values + deleteOfferingInstanceOptionsModelNew := new(catalogmanagementv1.DeleteOfferingInstanceOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = catalogManagementService.DeleteOfferingInstance(deleteOfferingInstanceOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) }) - Describe(`PutOfferingInstance(putOfferingInstanceOptions *PutOfferingInstanceOptions) - Operation response error`, func() { - putOfferingInstancePath := "/instances/offerings/testString" + Describe(`ListOfferingInstanceAudits(listOfferingInstanceAuditsOptions *ListOfferingInstanceAuditsOptions) - Operation response error`, func() { + listOfferingInstanceAuditsPath := "/instances/offerings/testString/audits" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(putOfferingInstancePath)) - Expect(req.Method).To(Equal("PUT")) - Expect(req.Header["X-Auth-Refresh-Token"]).ToNot(BeNil()) - Expect(req.Header["X-Auth-Refresh-Token"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.EscapedPath()).To(Equal(listOfferingInstanceAuditsPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + // TODO: Add check for lookupnames query parameter res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, `} this is not valid json {`) + fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke PutOfferingInstance with error: Operation response processing error`, func() { + It(`Invoke ListOfferingInstanceAudits with error: Operation response processing error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -16308,47 +24248,22 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the OfferingInstanceLastOperation model - offeringInstanceLastOperationModel := new(catalogmanagementv1.OfferingInstanceLastOperation) - offeringInstanceLastOperationModel.Operation = core.StringPtr("testString") - offeringInstanceLastOperationModel.State = core.StringPtr("testString") - offeringInstanceLastOperationModel.Message = core.StringPtr("testString") - offeringInstanceLastOperationModel.TransactionID = core.StringPtr("testString") - offeringInstanceLastOperationModel.Updated = core.StringPtr("testString") - - // Construct an instance of the PutOfferingInstanceOptions model - putOfferingInstanceOptionsModel := new(catalogmanagementv1.PutOfferingInstanceOptions) - putOfferingInstanceOptionsModel.InstanceIdentifier = core.StringPtr("testString") - putOfferingInstanceOptionsModel.XAuthRefreshToken = core.StringPtr("testString") - putOfferingInstanceOptionsModel.ID = core.StringPtr("testString") - putOfferingInstanceOptionsModel.Rev = core.StringPtr("testString") - putOfferingInstanceOptionsModel.URL = core.StringPtr("testString") - putOfferingInstanceOptionsModel.CRN = core.StringPtr("testString") - putOfferingInstanceOptionsModel.Label = core.StringPtr("testString") - putOfferingInstanceOptionsModel.CatalogID = core.StringPtr("testString") - putOfferingInstanceOptionsModel.OfferingID = core.StringPtr("testString") - putOfferingInstanceOptionsModel.KindFormat = core.StringPtr("testString") - putOfferingInstanceOptionsModel.Version = core.StringPtr("testString") - putOfferingInstanceOptionsModel.ClusterID = core.StringPtr("testString") - putOfferingInstanceOptionsModel.ClusterRegion = core.StringPtr("testString") - putOfferingInstanceOptionsModel.ClusterNamespaces = []string{"testString"} - putOfferingInstanceOptionsModel.ClusterAllNamespaces = core.BoolPtr(true) - putOfferingInstanceOptionsModel.SchematicsWorkspaceID = core.StringPtr("testString") - putOfferingInstanceOptionsModel.ResourceGroupID = core.StringPtr("testString") - putOfferingInstanceOptionsModel.InstallPlan = core.StringPtr("testString") - putOfferingInstanceOptionsModel.Channel = core.StringPtr("testString") - putOfferingInstanceOptionsModel.Metadata = make(map[string]interface{}) - putOfferingInstanceOptionsModel.LastOperation = offeringInstanceLastOperationModel - putOfferingInstanceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListOfferingInstanceAuditsOptions model + listOfferingInstanceAuditsOptionsModel := new(catalogmanagementv1.ListOfferingInstanceAuditsOptions) + listOfferingInstanceAuditsOptionsModel.InstanceIdentifier = core.StringPtr("testString") + listOfferingInstanceAuditsOptionsModel.Start = core.StringPtr("testString") + listOfferingInstanceAuditsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listOfferingInstanceAuditsOptionsModel.Lookupnames = core.BoolPtr(true) + listOfferingInstanceAuditsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := catalogManagementService.PutOfferingInstance(putOfferingInstanceOptionsModel) + result, response, operationErr := catalogManagementService.ListOfferingInstanceAudits(listOfferingInstanceAuditsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again catalogManagementService.EnableRetries(0, 0) - result, response, operationErr = catalogManagementService.PutOfferingInstance(putOfferingInstanceOptionsModel) + result, response, operationErr = catalogManagementService.ListOfferingInstanceAudits(listOfferingInstanceAuditsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -16358,45 +24273,30 @@ var _ = Describe(`CatalogManagementV1`, func() { }) }) }) - Describe(`PutOfferingInstance(putOfferingInstanceOptions *PutOfferingInstanceOptions)`, func() { - putOfferingInstancePath := "/instances/offerings/testString" + Describe(`ListOfferingInstanceAudits(listOfferingInstanceAuditsOptions *ListOfferingInstanceAuditsOptions)`, func() { + listOfferingInstanceAuditsPath := "/instances/offerings/testString/audits" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(putOfferingInstancePath)) - Expect(req.Method).To(Equal("PUT")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(listOfferingInstanceAuditsPath)) + Expect(req.Method).To(Equal("GET")) - Expect(req.Header["X-Auth-Refresh-Token"]).ToNot(BeNil()) - Expect(req.Header["X-Auth-Refresh-Token"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + // TODO: Add check for lookupnames query parameter // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "url": "URL", "crn": "CRN", "label": "Label", "catalog_id": "CatalogID", "offering_id": "OfferingID", "kind_format": "KindFormat", "version": "Version", "cluster_id": "ClusterID", "cluster_region": "ClusterRegion", "cluster_namespaces": ["ClusterNamespaces"], "cluster_all_namespaces": true, "schematics_workspace_id": "SchematicsWorkspaceID", "resource_group_id": "ResourceGroupID", "install_plan": "InstallPlan", "channel": "Channel", "metadata": {"mapKey": "anyValue"}, "last_operation": {"operation": "Operation", "state": "State", "message": "Message", "transaction_id": "TransactionID", "updated": "Updated"}}`) + fmt.Fprintf(res, "%s", `{"start": "Start", "limit": 5, "total_count": 10, "resource_count": 13, "first": {"href": "Href", "start": "Start"}, "next": {"href": "Href", "start": "Start"}, "prev": {"href": "Href", "start": "Start"}, "last": {"href": "Href", "start": "Start"}, "audits": [{"id": "ID", "_rev": "Rev", "created": "2019-01-01T12:00:00.000Z", "change_type": "ChangeType", "target_type": "TargetType", "target_id": "TargetID", "who_email": "WhoEmail", "who_delegate_email": "WhoDelegateEmail", "message": "Message"}]}`) })) }) - It(`Invoke PutOfferingInstance successfully with retries`, func() { + It(`Invoke ListOfferingInstanceAudits successfully with retries`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -16405,49 +24305,24 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) catalogManagementService.EnableRetries(0, 0) - // Construct an instance of the OfferingInstanceLastOperation model - offeringInstanceLastOperationModel := new(catalogmanagementv1.OfferingInstanceLastOperation) - offeringInstanceLastOperationModel.Operation = core.StringPtr("testString") - offeringInstanceLastOperationModel.State = core.StringPtr("testString") - offeringInstanceLastOperationModel.Message = core.StringPtr("testString") - offeringInstanceLastOperationModel.TransactionID = core.StringPtr("testString") - offeringInstanceLastOperationModel.Updated = core.StringPtr("testString") - - // Construct an instance of the PutOfferingInstanceOptions model - putOfferingInstanceOptionsModel := new(catalogmanagementv1.PutOfferingInstanceOptions) - putOfferingInstanceOptionsModel.InstanceIdentifier = core.StringPtr("testString") - putOfferingInstanceOptionsModel.XAuthRefreshToken = core.StringPtr("testString") - putOfferingInstanceOptionsModel.ID = core.StringPtr("testString") - putOfferingInstanceOptionsModel.Rev = core.StringPtr("testString") - putOfferingInstanceOptionsModel.URL = core.StringPtr("testString") - putOfferingInstanceOptionsModel.CRN = core.StringPtr("testString") - putOfferingInstanceOptionsModel.Label = core.StringPtr("testString") - putOfferingInstanceOptionsModel.CatalogID = core.StringPtr("testString") - putOfferingInstanceOptionsModel.OfferingID = core.StringPtr("testString") - putOfferingInstanceOptionsModel.KindFormat = core.StringPtr("testString") - putOfferingInstanceOptionsModel.Version = core.StringPtr("testString") - putOfferingInstanceOptionsModel.ClusterID = core.StringPtr("testString") - putOfferingInstanceOptionsModel.ClusterRegion = core.StringPtr("testString") - putOfferingInstanceOptionsModel.ClusterNamespaces = []string{"testString"} - putOfferingInstanceOptionsModel.ClusterAllNamespaces = core.BoolPtr(true) - putOfferingInstanceOptionsModel.SchematicsWorkspaceID = core.StringPtr("testString") - putOfferingInstanceOptionsModel.ResourceGroupID = core.StringPtr("testString") - putOfferingInstanceOptionsModel.InstallPlan = core.StringPtr("testString") - putOfferingInstanceOptionsModel.Channel = core.StringPtr("testString") - putOfferingInstanceOptionsModel.Metadata = make(map[string]interface{}) - putOfferingInstanceOptionsModel.LastOperation = offeringInstanceLastOperationModel - putOfferingInstanceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListOfferingInstanceAuditsOptions model + listOfferingInstanceAuditsOptionsModel := new(catalogmanagementv1.ListOfferingInstanceAuditsOptions) + listOfferingInstanceAuditsOptionsModel.InstanceIdentifier = core.StringPtr("testString") + listOfferingInstanceAuditsOptionsModel.Start = core.StringPtr("testString") + listOfferingInstanceAuditsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listOfferingInstanceAuditsOptionsModel.Lookupnames = core.BoolPtr(true) + listOfferingInstanceAuditsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := catalogManagementService.PutOfferingInstanceWithContext(ctx, putOfferingInstanceOptionsModel) + _, _, operationErr := catalogManagementService.ListOfferingInstanceAuditsWithContext(ctx, listOfferingInstanceAuditsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again catalogManagementService.DisableRetries() - result, response, operationErr := catalogManagementService.PutOfferingInstance(putOfferingInstanceOptionsModel) + result, response, operationErr := catalogManagementService.ListOfferingInstanceAudits(listOfferingInstanceAuditsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -16455,7 +24330,7 @@ var _ = Describe(`CatalogManagementV1`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = catalogManagementService.PutOfferingInstanceWithContext(ctx, putOfferingInstanceOptionsModel) + _, _, operationErr = catalogManagementService.ListOfferingInstanceAuditsWithContext(ctx, listOfferingInstanceAuditsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -16469,34 +24344,19 @@ var _ = Describe(`CatalogManagementV1`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(putOfferingInstancePath)) - Expect(req.Method).To(Equal("PUT")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(listOfferingInstanceAuditsPath)) + Expect(req.Method).To(Equal("GET")) - Expect(req.Header["X-Auth-Refresh-Token"]).ToNot(BeNil()) - Expect(req.Header["X-Auth-Refresh-Token"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + // TODO: Add check for lookupnames query parameter // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "url": "URL", "crn": "CRN", "label": "Label", "catalog_id": "CatalogID", "offering_id": "OfferingID", "kind_format": "KindFormat", "version": "Version", "cluster_id": "ClusterID", "cluster_region": "ClusterRegion", "cluster_namespaces": ["ClusterNamespaces"], "cluster_all_namespaces": true, "schematics_workspace_id": "SchematicsWorkspaceID", "resource_group_id": "ResourceGroupID", "install_plan": "InstallPlan", "channel": "Channel", "metadata": {"mapKey": "anyValue"}, "last_operation": {"operation": "Operation", "state": "State", "message": "Message", "transaction_id": "TransactionID", "updated": "Updated"}}`) + fmt.Fprintf(res, "%s", `{"start": "Start", "limit": 5, "total_count": 10, "resource_count": 13, "first": {"href": "Href", "start": "Start"}, "next": {"href": "Href", "start": "Start"}, "prev": {"href": "Href", "start": "Start"}, "last": {"href": "Href", "start": "Start"}, "audits": [{"id": "ID", "_rev": "Rev", "created": "2019-01-01T12:00:00.000Z", "change_type": "ChangeType", "target_type": "TargetType", "target_id": "TargetID", "who_email": "WhoEmail", "who_delegate_email": "WhoDelegateEmail", "message": "Message"}]}`) })) }) - It(`Invoke PutOfferingInstance successfully`, func() { + It(`Invoke ListOfferingInstanceAudits successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -16505,52 +24365,168 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := catalogManagementService.PutOfferingInstance(nil) + result, response, operationErr := catalogManagementService.ListOfferingInstanceAudits(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the OfferingInstanceLastOperation model - offeringInstanceLastOperationModel := new(catalogmanagementv1.OfferingInstanceLastOperation) - offeringInstanceLastOperationModel.Operation = core.StringPtr("testString") - offeringInstanceLastOperationModel.State = core.StringPtr("testString") - offeringInstanceLastOperationModel.Message = core.StringPtr("testString") - offeringInstanceLastOperationModel.TransactionID = core.StringPtr("testString") - offeringInstanceLastOperationModel.Updated = core.StringPtr("testString") - - // Construct an instance of the PutOfferingInstanceOptions model - putOfferingInstanceOptionsModel := new(catalogmanagementv1.PutOfferingInstanceOptions) - putOfferingInstanceOptionsModel.InstanceIdentifier = core.StringPtr("testString") - putOfferingInstanceOptionsModel.XAuthRefreshToken = core.StringPtr("testString") - putOfferingInstanceOptionsModel.ID = core.StringPtr("testString") - putOfferingInstanceOptionsModel.Rev = core.StringPtr("testString") - putOfferingInstanceOptionsModel.URL = core.StringPtr("testString") - putOfferingInstanceOptionsModel.CRN = core.StringPtr("testString") - putOfferingInstanceOptionsModel.Label = core.StringPtr("testString") - putOfferingInstanceOptionsModel.CatalogID = core.StringPtr("testString") - putOfferingInstanceOptionsModel.OfferingID = core.StringPtr("testString") - putOfferingInstanceOptionsModel.KindFormat = core.StringPtr("testString") - putOfferingInstanceOptionsModel.Version = core.StringPtr("testString") - putOfferingInstanceOptionsModel.ClusterID = core.StringPtr("testString") - putOfferingInstanceOptionsModel.ClusterRegion = core.StringPtr("testString") - putOfferingInstanceOptionsModel.ClusterNamespaces = []string{"testString"} - putOfferingInstanceOptionsModel.ClusterAllNamespaces = core.BoolPtr(true) - putOfferingInstanceOptionsModel.SchematicsWorkspaceID = core.StringPtr("testString") - putOfferingInstanceOptionsModel.ResourceGroupID = core.StringPtr("testString") - putOfferingInstanceOptionsModel.InstallPlan = core.StringPtr("testString") - putOfferingInstanceOptionsModel.Channel = core.StringPtr("testString") - putOfferingInstanceOptionsModel.Metadata = make(map[string]interface{}) - putOfferingInstanceOptionsModel.LastOperation = offeringInstanceLastOperationModel - putOfferingInstanceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListOfferingInstanceAuditsOptions model + listOfferingInstanceAuditsOptionsModel := new(catalogmanagementv1.ListOfferingInstanceAuditsOptions) + listOfferingInstanceAuditsOptionsModel.InstanceIdentifier = core.StringPtr("testString") + listOfferingInstanceAuditsOptionsModel.Start = core.StringPtr("testString") + listOfferingInstanceAuditsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listOfferingInstanceAuditsOptionsModel.Lookupnames = core.BoolPtr(true) + listOfferingInstanceAuditsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = catalogManagementService.PutOfferingInstance(putOfferingInstanceOptionsModel) + result, response, operationErr = catalogManagementService.ListOfferingInstanceAudits(listOfferingInstanceAuditsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke PutOfferingInstance with error: Operation validation and request error`, func() { + It(`Invoke ListOfferingInstanceAudits with error: Operation validation and request error`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Construct an instance of the ListOfferingInstanceAuditsOptions model + listOfferingInstanceAuditsOptionsModel := new(catalogmanagementv1.ListOfferingInstanceAuditsOptions) + listOfferingInstanceAuditsOptionsModel.InstanceIdentifier = core.StringPtr("testString") + listOfferingInstanceAuditsOptionsModel.Start = core.StringPtr("testString") + listOfferingInstanceAuditsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listOfferingInstanceAuditsOptionsModel.Lookupnames = core.BoolPtr(true) + listOfferingInstanceAuditsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := catalogManagementService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := catalogManagementService.ListOfferingInstanceAudits(listOfferingInstanceAuditsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the ListOfferingInstanceAuditsOptions model with no property values + listOfferingInstanceAuditsOptionsModelNew := new(catalogmanagementv1.ListOfferingInstanceAuditsOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = catalogManagementService.ListOfferingInstanceAudits(listOfferingInstanceAuditsOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke ListOfferingInstanceAudits successfully`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Construct an instance of the ListOfferingInstanceAuditsOptions model + listOfferingInstanceAuditsOptionsModel := new(catalogmanagementv1.ListOfferingInstanceAuditsOptions) + listOfferingInstanceAuditsOptionsModel.InstanceIdentifier = core.StringPtr("testString") + listOfferingInstanceAuditsOptionsModel.Start = core.StringPtr("testString") + listOfferingInstanceAuditsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listOfferingInstanceAuditsOptionsModel.Lookupnames = core.BoolPtr(true) + listOfferingInstanceAuditsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := catalogManagementService.ListOfferingInstanceAudits(listOfferingInstanceAuditsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Test pagination helper method on response`, func() { + It(`Invoke GetNextStart successfully`, func() { + responseObject := new(catalogmanagementv1.AuditLogs) + nextObject := new(catalogmanagementv1.PaginationTokenLink) + nextObject.Start = core.StringPtr("abc-123") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(Equal(core.StringPtr("abc-123"))) + }) + It(`Invoke GetNextStart without a "Next" property in the response`, func() { + responseObject := new(catalogmanagementv1.AuditLogs) + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + Context(`Using mock server endpoint - paginated response`, func() { + BeforeEach(func() { + var requestNumber int = 0 + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listOfferingInstanceAuditsPath)) + Expect(req.Method).To(Equal("GET")) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + requestNumber++ + if requestNumber == 1 { + fmt.Fprintf(res, "%s", `{"next":{"start":"1"},"total_count":2,"limit":1,"audits":[{"id":"ID","_rev":"Rev","created":"2019-01-01T12:00:00.000Z","change_type":"ChangeType","target_type":"TargetType","target_id":"TargetID","who_email":"WhoEmail","who_delegate_email":"WhoDelegateEmail","message":"Message"}]}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"audits":[{"id":"ID","_rev":"Rev","created":"2019-01-01T12:00:00.000Z","change_type":"ChangeType","target_type":"TargetType","target_id":"TargetID","who_email":"WhoEmail","who_delegate_email":"WhoDelegateEmail","message":"Message"}]}`) + } else { + res.WriteHeader(400) + } + })) + }) + It(`Use OfferingInstanceAuditsPager.GetNext successfully`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + listOfferingInstanceAuditsOptionsModel := &catalogmanagementv1.ListOfferingInstanceAuditsOptions{ + InstanceIdentifier: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + Lookupnames: core.BoolPtr(true), + } + + pager, err := catalogManagementService.NewOfferingInstanceAuditsPager(listOfferingInstanceAuditsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []catalogmanagementv1.AuditLogDigest + for pager.HasNext() { + nextPage, err := pager.GetNext() + Expect(err).To(BeNil()) + Expect(nextPage).ToNot(BeNil()) + allResults = append(allResults, nextPage...) + } + Expect(len(allResults)).To(Equal(2)) + }) + It(`Use OfferingInstanceAuditsPager.GetAll successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -16558,138 +24534,150 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the OfferingInstanceLastOperation model - offeringInstanceLastOperationModel := new(catalogmanagementv1.OfferingInstanceLastOperation) - offeringInstanceLastOperationModel.Operation = core.StringPtr("testString") - offeringInstanceLastOperationModel.State = core.StringPtr("testString") - offeringInstanceLastOperationModel.Message = core.StringPtr("testString") - offeringInstanceLastOperationModel.TransactionID = core.StringPtr("testString") - offeringInstanceLastOperationModel.Updated = core.StringPtr("testString") + listOfferingInstanceAuditsOptionsModel := &catalogmanagementv1.ListOfferingInstanceAuditsOptions{ + InstanceIdentifier: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + Lookupnames: core.BoolPtr(true), + } - // Construct an instance of the PutOfferingInstanceOptions model - putOfferingInstanceOptionsModel := new(catalogmanagementv1.PutOfferingInstanceOptions) - putOfferingInstanceOptionsModel.InstanceIdentifier = core.StringPtr("testString") - putOfferingInstanceOptionsModel.XAuthRefreshToken = core.StringPtr("testString") - putOfferingInstanceOptionsModel.ID = core.StringPtr("testString") - putOfferingInstanceOptionsModel.Rev = core.StringPtr("testString") - putOfferingInstanceOptionsModel.URL = core.StringPtr("testString") - putOfferingInstanceOptionsModel.CRN = core.StringPtr("testString") - putOfferingInstanceOptionsModel.Label = core.StringPtr("testString") - putOfferingInstanceOptionsModel.CatalogID = core.StringPtr("testString") - putOfferingInstanceOptionsModel.OfferingID = core.StringPtr("testString") - putOfferingInstanceOptionsModel.KindFormat = core.StringPtr("testString") - putOfferingInstanceOptionsModel.Version = core.StringPtr("testString") - putOfferingInstanceOptionsModel.ClusterID = core.StringPtr("testString") - putOfferingInstanceOptionsModel.ClusterRegion = core.StringPtr("testString") - putOfferingInstanceOptionsModel.ClusterNamespaces = []string{"testString"} - putOfferingInstanceOptionsModel.ClusterAllNamespaces = core.BoolPtr(true) - putOfferingInstanceOptionsModel.SchematicsWorkspaceID = core.StringPtr("testString") - putOfferingInstanceOptionsModel.ResourceGroupID = core.StringPtr("testString") - putOfferingInstanceOptionsModel.InstallPlan = core.StringPtr("testString") - putOfferingInstanceOptionsModel.Channel = core.StringPtr("testString") - putOfferingInstanceOptionsModel.Metadata = make(map[string]interface{}) - putOfferingInstanceOptionsModel.LastOperation = offeringInstanceLastOperationModel - putOfferingInstanceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := catalogManagementService.SetServiceURL("") + pager, err := catalogManagementService.NewOfferingInstanceAuditsPager(listOfferingInstanceAuditsOptionsModel) Expect(err).To(BeNil()) - result, response, operationErr := catalogManagementService.PutOfferingInstance(putOfferingInstanceOptionsModel) + Expect(pager).ToNot(BeNil()) + + allResults, err := pager.GetAll() + Expect(err).To(BeNil()) + Expect(allResults).ToNot(BeNil()) + Expect(len(allResults)).To(Equal(2)) + }) + }) + }) + Describe(`GetOfferingInstanceAudit(getOfferingInstanceAuditOptions *GetOfferingInstanceAuditOptions) - Operation response error`, func() { + getOfferingInstanceAuditPath := "/instances/offerings/testString/audits/testString" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getOfferingInstanceAuditPath)) + Expect(req.Method).To(Equal("GET")) + // TODO: Add check for lookupnames query parameter + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke GetOfferingInstanceAudit with error: Operation response processing error`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Construct an instance of the GetOfferingInstanceAuditOptions model + getOfferingInstanceAuditOptionsModel := new(catalogmanagementv1.GetOfferingInstanceAuditOptions) + getOfferingInstanceAuditOptionsModel.InstanceIdentifier = core.StringPtr("testString") + getOfferingInstanceAuditOptionsModel.AuditlogIdentifier = core.StringPtr("testString") + getOfferingInstanceAuditOptionsModel.Lookupnames = core.BoolPtr(true) + getOfferingInstanceAuditOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := catalogManagementService.GetOfferingInstanceAudit(getOfferingInstanceAuditOptionsModel) Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) + Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the PutOfferingInstanceOptions model with no property values - putOfferingInstanceOptionsModelNew := new(catalogmanagementv1.PutOfferingInstanceOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = catalogManagementService.PutOfferingInstance(putOfferingInstanceOptionsModelNew) + + // Enable retries and test again + catalogManagementService.EnableRetries(0, 0) + result, response, operationErr = catalogManagementService.GetOfferingInstanceAudit(getOfferingInstanceAuditOptionsModel) Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) + Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) - Context(`Using mock server endpoint with missing response body`, func() { + }) + Describe(`GetOfferingInstanceAudit(getOfferingInstanceAuditOptions *GetOfferingInstanceAuditOptions)`, func() { + getOfferingInstanceAuditPath := "/instances/offerings/testString/audits/testString" + Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() - // Set success status code with no respoonse body + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getOfferingInstanceAuditPath)) + Expect(req.Method).To(Equal("GET")) + + // TODO: Add check for lookupnames query parameter + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "created": "2019-01-01T12:00:00.000Z", "change_type": "ChangeType", "target_type": "TargetType", "target_id": "TargetID", "who_email": "WhoEmail", "who_delegate_email": "WhoDelegateEmail", "message": "Message", "gid": "Gid", "who_id": "WhoID", "who_name": "WhoName", "who_delegate_id": "WhoDelegateID", "who_delegate_name": "WhoDelegateName", "data": "anyValue"}`) })) }) - It(`Invoke PutOfferingInstance successfully`, func() { + It(`Invoke GetOfferingInstanceAudit successfully with retries`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) + catalogManagementService.EnableRetries(0, 0) - // Construct an instance of the OfferingInstanceLastOperation model - offeringInstanceLastOperationModel := new(catalogmanagementv1.OfferingInstanceLastOperation) - offeringInstanceLastOperationModel.Operation = core.StringPtr("testString") - offeringInstanceLastOperationModel.State = core.StringPtr("testString") - offeringInstanceLastOperationModel.Message = core.StringPtr("testString") - offeringInstanceLastOperationModel.TransactionID = core.StringPtr("testString") - offeringInstanceLastOperationModel.Updated = core.StringPtr("testString") + // Construct an instance of the GetOfferingInstanceAuditOptions model + getOfferingInstanceAuditOptionsModel := new(catalogmanagementv1.GetOfferingInstanceAuditOptions) + getOfferingInstanceAuditOptionsModel.InstanceIdentifier = core.StringPtr("testString") + getOfferingInstanceAuditOptionsModel.AuditlogIdentifier = core.StringPtr("testString") + getOfferingInstanceAuditOptionsModel.Lookupnames = core.BoolPtr(true) + getOfferingInstanceAuditOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Construct an instance of the PutOfferingInstanceOptions model - putOfferingInstanceOptionsModel := new(catalogmanagementv1.PutOfferingInstanceOptions) - putOfferingInstanceOptionsModel.InstanceIdentifier = core.StringPtr("testString") - putOfferingInstanceOptionsModel.XAuthRefreshToken = core.StringPtr("testString") - putOfferingInstanceOptionsModel.ID = core.StringPtr("testString") - putOfferingInstanceOptionsModel.Rev = core.StringPtr("testString") - putOfferingInstanceOptionsModel.URL = core.StringPtr("testString") - putOfferingInstanceOptionsModel.CRN = core.StringPtr("testString") - putOfferingInstanceOptionsModel.Label = core.StringPtr("testString") - putOfferingInstanceOptionsModel.CatalogID = core.StringPtr("testString") - putOfferingInstanceOptionsModel.OfferingID = core.StringPtr("testString") - putOfferingInstanceOptionsModel.KindFormat = core.StringPtr("testString") - putOfferingInstanceOptionsModel.Version = core.StringPtr("testString") - putOfferingInstanceOptionsModel.ClusterID = core.StringPtr("testString") - putOfferingInstanceOptionsModel.ClusterRegion = core.StringPtr("testString") - putOfferingInstanceOptionsModel.ClusterNamespaces = []string{"testString"} - putOfferingInstanceOptionsModel.ClusterAllNamespaces = core.BoolPtr(true) - putOfferingInstanceOptionsModel.SchematicsWorkspaceID = core.StringPtr("testString") - putOfferingInstanceOptionsModel.ResourceGroupID = core.StringPtr("testString") - putOfferingInstanceOptionsModel.InstallPlan = core.StringPtr("testString") - putOfferingInstanceOptionsModel.Channel = core.StringPtr("testString") - putOfferingInstanceOptionsModel.Metadata = make(map[string]interface{}) - putOfferingInstanceOptionsModel.LastOperation = offeringInstanceLastOperationModel - putOfferingInstanceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := catalogManagementService.GetOfferingInstanceAuditWithContext(ctx, getOfferingInstanceAuditOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - // Invoke operation - result, response, operationErr := catalogManagementService.PutOfferingInstance(putOfferingInstanceOptionsModel) + // Disable retries and test again + catalogManagementService.DisableRetries() + result, response, operationErr := catalogManagementService.GetOfferingInstanceAudit(getOfferingInstanceAuditOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) - // Verify a nil result - Expect(result).To(BeNil()) + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = catalogManagementService.GetOfferingInstanceAuditWithContext(ctx, getOfferingInstanceAuditOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) AfterEach(func() { testServer.Close() }) }) - }) - Describe(`DeleteOfferingInstance(deleteOfferingInstanceOptions *DeleteOfferingInstanceOptions)`, func() { - deleteOfferingInstancePath := "/instances/offerings/testString" Context(`Using mock server endpoint`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteOfferingInstancePath)) - Expect(req.Method).To(Equal("DELETE")) + Expect(req.URL.EscapedPath()).To(Equal(getOfferingInstanceAuditPath)) + Expect(req.Method).To(Equal("GET")) - Expect(req.Header["X-Auth-Refresh-Token"]).ToNot(BeNil()) - Expect(req.Header["X-Auth-Refresh-Token"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + // TODO: Add check for lookupnames query parameter + // Set mock response + res.Header().Set("Content-type", "application/json") res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"id": "ID", "_rev": "Rev", "created": "2019-01-01T12:00:00.000Z", "change_type": "ChangeType", "target_type": "TargetType", "target_id": "TargetID", "who_email": "WhoEmail", "who_delegate_email": "WhoDelegateEmail", "message": "Message", "gid": "Gid", "who_id": "WhoID", "who_name": "WhoName", "who_delegate_id": "WhoDelegateID", "who_delegate_name": "WhoDelegateName", "data": "anyValue"}`) })) }) - It(`Invoke DeleteOfferingInstance successfully`, func() { + It(`Invoke GetOfferingInstanceAudit successfully`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -16698,22 +24686,26 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(catalogManagementService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - response, operationErr := catalogManagementService.DeleteOfferingInstance(nil) + result, response, operationErr := catalogManagementService.GetOfferingInstanceAudit(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) + Expect(result).To(BeNil()) - // Construct an instance of the DeleteOfferingInstanceOptions model - deleteOfferingInstanceOptionsModel := new(catalogmanagementv1.DeleteOfferingInstanceOptions) - deleteOfferingInstanceOptionsModel.InstanceIdentifier = core.StringPtr("testString") - deleteOfferingInstanceOptionsModel.XAuthRefreshToken = core.StringPtr("testString") - deleteOfferingInstanceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetOfferingInstanceAuditOptions model + getOfferingInstanceAuditOptionsModel := new(catalogmanagementv1.GetOfferingInstanceAuditOptions) + getOfferingInstanceAuditOptionsModel.InstanceIdentifier = core.StringPtr("testString") + getOfferingInstanceAuditOptionsModel.AuditlogIdentifier = core.StringPtr("testString") + getOfferingInstanceAuditOptionsModel.Lookupnames = core.BoolPtr(true) + getOfferingInstanceAuditOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - response, operationErr = catalogManagementService.DeleteOfferingInstance(deleteOfferingInstanceOptionsModel) + result, response, operationErr = catalogManagementService.GetOfferingInstanceAudit(getOfferingInstanceAuditOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + }) - It(`Invoke DeleteOfferingInstance with error: Operation validation and request error`, func() { + It(`Invoke GetOfferingInstanceAudit with error: Operation validation and request error`, func() { catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, @@ -16721,24 +24713,63 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(serviceErr).To(BeNil()) Expect(catalogManagementService).ToNot(BeNil()) - // Construct an instance of the DeleteOfferingInstanceOptions model - deleteOfferingInstanceOptionsModel := new(catalogmanagementv1.DeleteOfferingInstanceOptions) - deleteOfferingInstanceOptionsModel.InstanceIdentifier = core.StringPtr("testString") - deleteOfferingInstanceOptionsModel.XAuthRefreshToken = core.StringPtr("testString") - deleteOfferingInstanceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetOfferingInstanceAuditOptions model + getOfferingInstanceAuditOptionsModel := new(catalogmanagementv1.GetOfferingInstanceAuditOptions) + getOfferingInstanceAuditOptionsModel.InstanceIdentifier = core.StringPtr("testString") + getOfferingInstanceAuditOptionsModel.AuditlogIdentifier = core.StringPtr("testString") + getOfferingInstanceAuditOptionsModel.Lookupnames = core.BoolPtr(true) + getOfferingInstanceAuditOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := catalogManagementService.SetServiceURL("") Expect(err).To(BeNil()) - response, operationErr := catalogManagementService.DeleteOfferingInstance(deleteOfferingInstanceOptionsModel) + result, response, operationErr := catalogManagementService.GetOfferingInstanceAudit(getOfferingInstanceAuditOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) - // Construct a second instance of the DeleteOfferingInstanceOptions model with no property values - deleteOfferingInstanceOptionsModelNew := new(catalogmanagementv1.DeleteOfferingInstanceOptions) + Expect(result).To(BeNil()) + // Construct a second instance of the GetOfferingInstanceAuditOptions model with no property values + getOfferingInstanceAuditOptionsModelNew := new(catalogmanagementv1.GetOfferingInstanceAuditOptions) // Invoke operation with invalid model (negative test) - response, operationErr = catalogManagementService.DeleteOfferingInstance(deleteOfferingInstanceOptionsModelNew) + result, response, operationErr = catalogManagementService.GetOfferingInstanceAudit(getOfferingInstanceAuditOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke GetOfferingInstanceAudit successfully`, func() { + catalogManagementService, serviceErr := catalogmanagementv1.NewCatalogManagementV1(&catalogmanagementv1.CatalogManagementV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(catalogManagementService).ToNot(BeNil()) + + // Construct an instance of the GetOfferingInstanceAuditOptions model + getOfferingInstanceAuditOptionsModel := new(catalogmanagementv1.GetOfferingInstanceAuditOptions) + getOfferingInstanceAuditOptionsModel.InstanceIdentifier = core.StringPtr("testString") + getOfferingInstanceAuditOptionsModel.AuditlogIdentifier = core.StringPtr("testString") + getOfferingInstanceAuditOptionsModel.Lookupnames = core.BoolPtr(true) + getOfferingInstanceAuditOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := catalogManagementService.GetOfferingInstanceAudit(getOfferingInstanceAuditOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -16778,18 +24809,44 @@ var _ = Describe(`CatalogManagementV1`, func() { // Construct an instance of the AddObjectAccessListOptions model catalogIdentifier := "testString" objectIdentifier := "testString" - accounts := []string{"testString"} - addObjectAccessListOptionsModel := catalogManagementService.NewAddObjectAccessListOptions(catalogIdentifier, objectIdentifier, accounts) + accesses := []string{"testString"} + addObjectAccessListOptionsModel := catalogManagementService.NewAddObjectAccessListOptions(catalogIdentifier, objectIdentifier, accesses) addObjectAccessListOptionsModel.SetCatalogIdentifier("testString") addObjectAccessListOptionsModel.SetObjectIdentifier("testString") - addObjectAccessListOptionsModel.SetAccounts([]string{"testString"}) + addObjectAccessListOptionsModel.SetAccesses([]string{"testString"}) addObjectAccessListOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(addObjectAccessListOptionsModel).ToNot(BeNil()) Expect(addObjectAccessListOptionsModel.CatalogIdentifier).To(Equal(core.StringPtr("testString"))) Expect(addObjectAccessListOptionsModel.ObjectIdentifier).To(Equal(core.StringPtr("testString"))) - Expect(addObjectAccessListOptionsModel.Accounts).To(Equal([]string{"testString"})) + Expect(addObjectAccessListOptionsModel.Accesses).To(Equal([]string{"testString"})) Expect(addObjectAccessListOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewAddOfferingAccessListOptions successfully`, func() { + // Construct an instance of the AddOfferingAccessListOptions model + catalogIdentifier := "testString" + offeringID := "testString" + accesses := []string{"testString"} + addOfferingAccessListOptionsModel := catalogManagementService.NewAddOfferingAccessListOptions(catalogIdentifier, offeringID, accesses) + addOfferingAccessListOptionsModel.SetCatalogIdentifier("testString") + addOfferingAccessListOptionsModel.SetOfferingID("testString") + addOfferingAccessListOptionsModel.SetAccesses([]string{"testString"}) + addOfferingAccessListOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(addOfferingAccessListOptionsModel).ToNot(BeNil()) + Expect(addOfferingAccessListOptionsModel.CatalogIdentifier).To(Equal(core.StringPtr("testString"))) + Expect(addOfferingAccessListOptionsModel.OfferingID).To(Equal(core.StringPtr("testString"))) + Expect(addOfferingAccessListOptionsModel.Accesses).To(Equal([]string{"testString"})) + Expect(addOfferingAccessListOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewArchiveVersionOptions successfully`, func() { + // Construct an instance of the ArchiveVersionOptions model + versionLocID := "testString" + archiveVersionOptionsModel := catalogManagementService.NewArchiveVersionOptions(versionLocID) + archiveVersionOptionsModel.SetVersionLocID("testString") + archiveVersionOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(archiveVersionOptionsModel).ToNot(BeNil()) + Expect(archiveVersionOptionsModel.VersionLocID).To(Equal(core.StringPtr("testString"))) + Expect(archiveVersionOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewCommitVersionOptions successfully`, func() { // Construct an instance of the CommitVersionOptions model versionLocID := "testString" @@ -16800,20 +24857,77 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(commitVersionOptionsModel.VersionLocID).To(Equal(core.StringPtr("testString"))) Expect(commitVersionOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewConsumableShareObjectOptions successfully`, func() { + // Construct an instance of the ConsumableShareObjectOptions model + catalogIdentifier := "testString" + objectIdentifier := "testString" + consumableShareObjectOptionsModel := catalogManagementService.NewConsumableShareObjectOptions(catalogIdentifier, objectIdentifier) + consumableShareObjectOptionsModel.SetCatalogIdentifier("testString") + consumableShareObjectOptionsModel.SetObjectIdentifier("testString") + consumableShareObjectOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(consumableShareObjectOptionsModel).ToNot(BeNil()) + Expect(consumableShareObjectOptionsModel.CatalogIdentifier).To(Equal(core.StringPtr("testString"))) + Expect(consumableShareObjectOptionsModel.ObjectIdentifier).To(Equal(core.StringPtr("testString"))) + Expect(consumableShareObjectOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewConsumableVersionOptions successfully`, func() { + // Construct an instance of the ConsumableVersionOptions model + versionLocID := "testString" + consumableVersionOptionsModel := catalogManagementService.NewConsumableVersionOptions(versionLocID) + consumableVersionOptionsModel.SetVersionLocID("testString") + consumableVersionOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(consumableVersionOptionsModel).ToNot(BeNil()) + Expect(consumableVersionOptionsModel.VersionLocID).To(Equal(core.StringPtr("testString"))) + Expect(consumableVersionOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewCopyFromPreviousVersionOptions successfully`, func() { + // Construct an instance of the CopyFromPreviousVersionOptions model + versionLocID := "testString" + typeVar := "testString" + versionLocIDToCopyFrom := "testString" + copyFromPreviousVersionOptionsModel := catalogManagementService.NewCopyFromPreviousVersionOptions(versionLocID, typeVar, versionLocIDToCopyFrom) + copyFromPreviousVersionOptionsModel.SetVersionLocID("testString") + copyFromPreviousVersionOptionsModel.SetType("testString") + copyFromPreviousVersionOptionsModel.SetVersionLocIDToCopyFrom("testString") + copyFromPreviousVersionOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(copyFromPreviousVersionOptionsModel).ToNot(BeNil()) + Expect(copyFromPreviousVersionOptionsModel.VersionLocID).To(Equal(core.StringPtr("testString"))) + Expect(copyFromPreviousVersionOptionsModel.Type).To(Equal(core.StringPtr("testString"))) + Expect(copyFromPreviousVersionOptionsModel.VersionLocIDToCopyFrom).To(Equal(core.StringPtr("testString"))) + Expect(copyFromPreviousVersionOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewCopyVersionOptions successfully`, func() { + // Construct an instance of the Flavor model + flavorModel := new(catalogmanagementv1.Flavor) + Expect(flavorModel).ToNot(BeNil()) + flavorModel.Name = core.StringPtr("testString") + flavorModel.Label = core.StringPtr("testString") + flavorModel.LabelI18n = make(map[string]string) + flavorModel.Index = core.Int64Ptr(int64(38)) + Expect(flavorModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(flavorModel.Label).To(Equal(core.StringPtr("testString"))) + Expect(flavorModel.LabelI18n).To(Equal(make(map[string]string))) + Expect(flavorModel.Index).To(Equal(core.Int64Ptr(int64(38)))) + // Construct an instance of the CopyVersionOptions model versionLocID := "testString" copyVersionOptionsModel := catalogManagementService.NewCopyVersionOptions(versionLocID) copyVersionOptionsModel.SetVersionLocID("testString") copyVersionOptionsModel.SetTags([]string{"testString"}) - copyVersionOptionsModel.SetTargetKinds([]string{"testString"}) copyVersionOptionsModel.SetContent(*CreateMockByteArray("This is a mock byte array value.")) + copyVersionOptionsModel.SetTargetKinds([]string{"testString"}) + copyVersionOptionsModel.SetFormatKind("testString") + copyVersionOptionsModel.SetFlavor(flavorModel) + copyVersionOptionsModel.SetWorkingDirectory("testString") copyVersionOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(copyVersionOptionsModel).ToNot(BeNil()) Expect(copyVersionOptionsModel.VersionLocID).To(Equal(core.StringPtr("testString"))) Expect(copyVersionOptionsModel.Tags).To(Equal([]string{"testString"})) - Expect(copyVersionOptionsModel.TargetKinds).To(Equal([]string{"testString"})) Expect(copyVersionOptionsModel.Content).To(Equal(CreateMockByteArray("This is a mock byte array value."))) + Expect(copyVersionOptionsModel.TargetKinds).To(Equal([]string{"testString"})) + Expect(copyVersionOptionsModel.FormatKind).To(Equal(core.StringPtr("testString"))) + Expect(copyVersionOptionsModel.Flavor).To(Equal(flavorModel)) + Expect(copyVersionOptionsModel.WorkingDirectory).To(Equal(core.StringPtr("testString"))) Expect(copyVersionOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewCreateCatalogOptions successfully`, func() { @@ -16821,9 +24935,13 @@ var _ = Describe(`CatalogManagementV1`, func() { featureModel := new(catalogmanagementv1.Feature) Expect(featureModel).ToNot(BeNil()) featureModel.Title = core.StringPtr("testString") + featureModel.TitleI18n = make(map[string]string) featureModel.Description = core.StringPtr("testString") + featureModel.DescriptionI18n = make(map[string]string) Expect(featureModel.Title).To(Equal(core.StringPtr("testString"))) + Expect(featureModel.TitleI18n).To(Equal(make(map[string]string))) Expect(featureModel.Description).To(Equal(core.StringPtr("testString"))) + Expect(featureModel.DescriptionI18n).To(Equal(make(map[string]string))) // Construct an instance of the FilterTerms model filterTermsModel := new(catalogmanagementv1.FilterTerms) @@ -16911,7 +25029,9 @@ var _ = Describe(`CatalogManagementV1`, func() { createCatalogOptionsModel.SetID("testString") createCatalogOptionsModel.SetRev("testString") createCatalogOptionsModel.SetLabel("testString") + createCatalogOptionsModel.SetLabelI18n(make(map[string]string)) createCatalogOptionsModel.SetShortDescription("testString") + createCatalogOptionsModel.SetShortDescriptionI18n(make(map[string]string)) createCatalogOptionsModel.SetCatalogIconURL("testString") createCatalogOptionsModel.SetTags([]string{"testString"}) createCatalogOptionsModel.SetFeatures([]catalogmanagementv1.Feature{*featureModel}) @@ -16921,12 +25041,15 @@ var _ = Describe(`CatalogManagementV1`, func() { createCatalogOptionsModel.SetCatalogFilters(filtersModel) createCatalogOptionsModel.SetSyndicationSettings(syndicationResourceModel) createCatalogOptionsModel.SetKind("testString") + createCatalogOptionsModel.SetMetadata(make(map[string]interface{})) createCatalogOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(createCatalogOptionsModel).ToNot(BeNil()) Expect(createCatalogOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(createCatalogOptionsModel.Rev).To(Equal(core.StringPtr("testString"))) Expect(createCatalogOptionsModel.Label).To(Equal(core.StringPtr("testString"))) + Expect(createCatalogOptionsModel.LabelI18n).To(Equal(make(map[string]string))) Expect(createCatalogOptionsModel.ShortDescription).To(Equal(core.StringPtr("testString"))) + Expect(createCatalogOptionsModel.ShortDescriptionI18n).To(Equal(make(map[string]string))) Expect(createCatalogOptionsModel.CatalogIconURL).To(Equal(core.StringPtr("testString"))) Expect(createCatalogOptionsModel.Tags).To(Equal([]string{"testString"})) Expect(createCatalogOptionsModel.Features).To(Equal([]catalogmanagementv1.Feature{*featureModel})) @@ -16936,22 +25059,23 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(createCatalogOptionsModel.CatalogFilters).To(Equal(filtersModel)) Expect(createCatalogOptionsModel.SyndicationSettings).To(Equal(syndicationResourceModel)) Expect(createCatalogOptionsModel.Kind).To(Equal(core.StringPtr("testString"))) + Expect(createCatalogOptionsModel.Metadata).To(Equal(make(map[string]interface{}))) Expect(createCatalogOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewCreateObjectAccessOptions successfully`, func() { // Construct an instance of the CreateObjectAccessOptions model catalogIdentifier := "testString" objectIdentifier := "testString" - accountIdentifier := "testString" - createObjectAccessOptionsModel := catalogManagementService.NewCreateObjectAccessOptions(catalogIdentifier, objectIdentifier, accountIdentifier) + accessIdentifier := "testString" + createObjectAccessOptionsModel := catalogManagementService.NewCreateObjectAccessOptions(catalogIdentifier, objectIdentifier, accessIdentifier) createObjectAccessOptionsModel.SetCatalogIdentifier("testString") createObjectAccessOptionsModel.SetObjectIdentifier("testString") - createObjectAccessOptionsModel.SetAccountIdentifier("testString") + createObjectAccessOptionsModel.SetAccessIdentifier("testString") createObjectAccessOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(createObjectAccessOptionsModel).ToNot(BeNil()) Expect(createObjectAccessOptionsModel.CatalogIdentifier).To(Equal(core.StringPtr("testString"))) Expect(createObjectAccessOptionsModel.ObjectIdentifier).To(Equal(core.StringPtr("testString"))) - Expect(createObjectAccessOptionsModel.AccountIdentifier).To(Equal(core.StringPtr("testString"))) + Expect(createObjectAccessOptionsModel.AccessIdentifier).To(Equal(core.StringPtr("testString"))) Expect(createObjectAccessOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewCreateObjectOptions successfully`, func() { @@ -16993,13 +25117,13 @@ var _ = Describe(`CatalogManagementV1`, func() { createObjectOptionsModel.SetCRN("testString") createObjectOptionsModel.SetURL("testString") createObjectOptionsModel.SetParentID("testString") - createObjectOptionsModel.SetLabelI18n("testString") + createObjectOptionsModel.SetLabelI18n(make(map[string]string)) createObjectOptionsModel.SetLabel("testString") createObjectOptionsModel.SetTags([]string{"testString"}) createObjectOptionsModel.SetCreated(CreateMockDateTime("2019-01-01T12:00:00.000Z")) createObjectOptionsModel.SetUpdated(CreateMockDateTime("2019-01-01T12:00:00.000Z")) createObjectOptionsModel.SetShortDescription("testString") - createObjectOptionsModel.SetShortDescriptionI18n("testString") + createObjectOptionsModel.SetShortDescriptionI18n(make(map[string]string)) createObjectOptionsModel.SetKind("testString") createObjectOptionsModel.SetPublish(publishObjectModel) createObjectOptionsModel.SetState(stateModel) @@ -17015,13 +25139,13 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(createObjectOptionsModel.CRN).To(Equal(core.StringPtr("testString"))) Expect(createObjectOptionsModel.URL).To(Equal(core.StringPtr("testString"))) Expect(createObjectOptionsModel.ParentID).To(Equal(core.StringPtr("testString"))) - Expect(createObjectOptionsModel.LabelI18n).To(Equal(core.StringPtr("testString"))) + Expect(createObjectOptionsModel.LabelI18n).To(Equal(make(map[string]string))) Expect(createObjectOptionsModel.Label).To(Equal(core.StringPtr("testString"))) Expect(createObjectOptionsModel.Tags).To(Equal([]string{"testString"})) Expect(createObjectOptionsModel.Created).To(Equal(CreateMockDateTime("2019-01-01T12:00:00.000Z"))) Expect(createObjectOptionsModel.Updated).To(Equal(CreateMockDateTime("2019-01-01T12:00:00.000Z"))) Expect(createObjectOptionsModel.ShortDescription).To(Equal(core.StringPtr("testString"))) - Expect(createObjectOptionsModel.ShortDescriptionI18n).To(Equal(core.StringPtr("testString"))) + Expect(createObjectOptionsModel.ShortDescriptionI18n).To(Equal(make(map[string]string))) Expect(createObjectOptionsModel.Kind).To(Equal(core.StringPtr("testString"))) Expect(createObjectOptionsModel.Publish).To(Equal(publishObjectModel)) Expect(createObjectOptionsModel.State).To(Equal(stateModel)) @@ -17038,12 +25162,14 @@ var _ = Describe(`CatalogManagementV1`, func() { offeringInstanceLastOperationModel.State = core.StringPtr("testString") offeringInstanceLastOperationModel.Message = core.StringPtr("testString") offeringInstanceLastOperationModel.TransactionID = core.StringPtr("testString") - offeringInstanceLastOperationModel.Updated = core.StringPtr("testString") + offeringInstanceLastOperationModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + offeringInstanceLastOperationModel.Code = core.StringPtr("testString") Expect(offeringInstanceLastOperationModel.Operation).To(Equal(core.StringPtr("testString"))) Expect(offeringInstanceLastOperationModel.State).To(Equal(core.StringPtr("testString"))) Expect(offeringInstanceLastOperationModel.Message).To(Equal(core.StringPtr("testString"))) Expect(offeringInstanceLastOperationModel.TransactionID).To(Equal(core.StringPtr("testString"))) - Expect(offeringInstanceLastOperationModel.Updated).To(Equal(core.StringPtr("testString"))) + Expect(offeringInstanceLastOperationModel.Updated).To(Equal(CreateMockDateTime("2019-01-01T12:00:00.000Z"))) + Expect(offeringInstanceLastOperationModel.Code).To(Equal(core.StringPtr("testString"))) // Construct an instance of the CreateOfferingInstanceOptions model xAuthRefreshToken := "testString" @@ -17058,16 +25184,24 @@ var _ = Describe(`CatalogManagementV1`, func() { createOfferingInstanceOptionsModel.SetOfferingID("testString") createOfferingInstanceOptionsModel.SetKindFormat("testString") createOfferingInstanceOptionsModel.SetVersion("testString") + createOfferingInstanceOptionsModel.SetVersionID("testString") createOfferingInstanceOptionsModel.SetClusterID("testString") createOfferingInstanceOptionsModel.SetClusterRegion("testString") createOfferingInstanceOptionsModel.SetClusterNamespaces([]string{"testString"}) createOfferingInstanceOptionsModel.SetClusterAllNamespaces(true) createOfferingInstanceOptionsModel.SetSchematicsWorkspaceID("testString") - createOfferingInstanceOptionsModel.SetResourceGroupID("testString") createOfferingInstanceOptionsModel.SetInstallPlan("testString") createOfferingInstanceOptionsModel.SetChannel("testString") + createOfferingInstanceOptionsModel.SetCreated(CreateMockDateTime("2019-01-01T12:00:00.000Z")) + createOfferingInstanceOptionsModel.SetUpdated(CreateMockDateTime("2019-01-01T12:00:00.000Z")) createOfferingInstanceOptionsModel.SetMetadata(make(map[string]interface{})) + createOfferingInstanceOptionsModel.SetResourceGroupID("testString") + createOfferingInstanceOptionsModel.SetLocation("testString") + createOfferingInstanceOptionsModel.SetDisabled(true) + createOfferingInstanceOptionsModel.SetAccount("testString") createOfferingInstanceOptionsModel.SetLastOperation(offeringInstanceLastOperationModel) + createOfferingInstanceOptionsModel.SetKindTarget("testString") + createOfferingInstanceOptionsModel.SetSha("testString") createOfferingInstanceOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(createOfferingInstanceOptionsModel).ToNot(BeNil()) Expect(createOfferingInstanceOptionsModel.XAuthRefreshToken).To(Equal(core.StringPtr("testString"))) @@ -17080,16 +25214,24 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(createOfferingInstanceOptionsModel.OfferingID).To(Equal(core.StringPtr("testString"))) Expect(createOfferingInstanceOptionsModel.KindFormat).To(Equal(core.StringPtr("testString"))) Expect(createOfferingInstanceOptionsModel.Version).To(Equal(core.StringPtr("testString"))) + Expect(createOfferingInstanceOptionsModel.VersionID).To(Equal(core.StringPtr("testString"))) Expect(createOfferingInstanceOptionsModel.ClusterID).To(Equal(core.StringPtr("testString"))) Expect(createOfferingInstanceOptionsModel.ClusterRegion).To(Equal(core.StringPtr("testString"))) Expect(createOfferingInstanceOptionsModel.ClusterNamespaces).To(Equal([]string{"testString"})) Expect(createOfferingInstanceOptionsModel.ClusterAllNamespaces).To(Equal(core.BoolPtr(true))) Expect(createOfferingInstanceOptionsModel.SchematicsWorkspaceID).To(Equal(core.StringPtr("testString"))) - Expect(createOfferingInstanceOptionsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) Expect(createOfferingInstanceOptionsModel.InstallPlan).To(Equal(core.StringPtr("testString"))) Expect(createOfferingInstanceOptionsModel.Channel).To(Equal(core.StringPtr("testString"))) + Expect(createOfferingInstanceOptionsModel.Created).To(Equal(CreateMockDateTime("2019-01-01T12:00:00.000Z"))) + Expect(createOfferingInstanceOptionsModel.Updated).To(Equal(CreateMockDateTime("2019-01-01T12:00:00.000Z"))) Expect(createOfferingInstanceOptionsModel.Metadata).To(Equal(make(map[string]interface{}))) + Expect(createOfferingInstanceOptionsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) + Expect(createOfferingInstanceOptionsModel.Location).To(Equal(core.StringPtr("testString"))) + Expect(createOfferingInstanceOptionsModel.Disabled).To(Equal(core.BoolPtr(true))) + Expect(createOfferingInstanceOptionsModel.Account).To(Equal(core.StringPtr("testString"))) Expect(createOfferingInstanceOptionsModel.LastOperation).To(Equal(offeringInstanceLastOperationModel)) + Expect(createOfferingInstanceOptionsModel.KindTarget).To(Equal(core.StringPtr("testString"))) + Expect(createOfferingInstanceOptionsModel.Sha).To(Equal(core.StringPtr("testString"))) Expect(createOfferingInstanceOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewCreateOfferingOptions successfully`, func() { @@ -17109,9 +25251,55 @@ var _ = Describe(`CatalogManagementV1`, func() { featureModel := new(catalogmanagementv1.Feature) Expect(featureModel).ToNot(BeNil()) featureModel.Title = core.StringPtr("testString") + featureModel.TitleI18n = make(map[string]string) featureModel.Description = core.StringPtr("testString") + featureModel.DescriptionI18n = make(map[string]string) Expect(featureModel.Title).To(Equal(core.StringPtr("testString"))) + Expect(featureModel.TitleI18n).To(Equal(make(map[string]string))) Expect(featureModel.Description).To(Equal(core.StringPtr("testString"))) + Expect(featureModel.DescriptionI18n).To(Equal(make(map[string]string))) + + // Construct an instance of the Flavor model + flavorModel := new(catalogmanagementv1.Flavor) + Expect(flavorModel).ToNot(BeNil()) + flavorModel.Name = core.StringPtr("testString") + flavorModel.Label = core.StringPtr("testString") + flavorModel.LabelI18n = make(map[string]string) + flavorModel.Index = core.Int64Ptr(int64(38)) + Expect(flavorModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(flavorModel.Label).To(Equal(core.StringPtr("testString"))) + Expect(flavorModel.LabelI18n).To(Equal(make(map[string]string))) + Expect(flavorModel.Index).To(Equal(core.Int64Ptr(int64(38)))) + + // Construct an instance of the RenderTypeAssociationsParametersItem model + renderTypeAssociationsParametersItemModel := new(catalogmanagementv1.RenderTypeAssociationsParametersItem) + Expect(renderTypeAssociationsParametersItemModel).ToNot(BeNil()) + renderTypeAssociationsParametersItemModel.Name = core.StringPtr("testString") + renderTypeAssociationsParametersItemModel.OptionsRefresh = core.BoolPtr(true) + Expect(renderTypeAssociationsParametersItemModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(renderTypeAssociationsParametersItemModel.OptionsRefresh).To(Equal(core.BoolPtr(true))) + + // Construct an instance of the RenderTypeAssociations model + renderTypeAssociationsModel := new(catalogmanagementv1.RenderTypeAssociations) + Expect(renderTypeAssociationsModel).ToNot(BeNil()) + renderTypeAssociationsModel.Parameters = []catalogmanagementv1.RenderTypeAssociationsParametersItem{*renderTypeAssociationsParametersItemModel} + Expect(renderTypeAssociationsModel.Parameters).To(Equal([]catalogmanagementv1.RenderTypeAssociationsParametersItem{*renderTypeAssociationsParametersItemModel})) + + // Construct an instance of the RenderType model + renderTypeModel := new(catalogmanagementv1.RenderType) + Expect(renderTypeModel).ToNot(BeNil()) + renderTypeModel.Type = core.StringPtr("testString") + renderTypeModel.Grouping = core.StringPtr("testString") + renderTypeModel.OriginalGrouping = core.StringPtr("testString") + renderTypeModel.GroupingIndex = core.Int64Ptr(int64(38)) + renderTypeModel.ConfigConstraints = map[string]interface{}{"anyKey": "anyValue"} + renderTypeModel.Associations = renderTypeAssociationsModel + Expect(renderTypeModel.Type).To(Equal(core.StringPtr("testString"))) + Expect(renderTypeModel.Grouping).To(Equal(core.StringPtr("testString"))) + Expect(renderTypeModel.OriginalGrouping).To(Equal(core.StringPtr("testString"))) + Expect(renderTypeModel.GroupingIndex).To(Equal(core.Int64Ptr(int64(38)))) + Expect(renderTypeModel.ConfigConstraints).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) + Expect(renderTypeModel.Associations).To(Equal(renderTypeAssociationsModel)) // Construct an instance of the Configuration model configurationModel := new(catalogmanagementv1.Configuration) @@ -17119,19 +25307,53 @@ var _ = Describe(`CatalogManagementV1`, func() { configurationModel.Key = core.StringPtr("testString") configurationModel.Type = core.StringPtr("testString") configurationModel.DefaultValue = core.StringPtr("testString") + configurationModel.DisplayName = core.StringPtr("testString") configurationModel.ValueConstraint = core.StringPtr("testString") configurationModel.Description = core.StringPtr("testString") configurationModel.Required = core.BoolPtr(true) configurationModel.Options = []interface{}{"testString"} configurationModel.Hidden = core.BoolPtr(true) + configurationModel.CustomConfig = renderTypeModel + configurationModel.TypeMetadata = core.StringPtr("testString") Expect(configurationModel.Key).To(Equal(core.StringPtr("testString"))) Expect(configurationModel.Type).To(Equal(core.StringPtr("testString"))) Expect(configurationModel.DefaultValue).To(Equal(core.StringPtr("testString"))) + Expect(configurationModel.DisplayName).To(Equal(core.StringPtr("testString"))) Expect(configurationModel.ValueConstraint).To(Equal(core.StringPtr("testString"))) Expect(configurationModel.Description).To(Equal(core.StringPtr("testString"))) Expect(configurationModel.Required).To(Equal(core.BoolPtr(true))) Expect(configurationModel.Options).To(Equal([]interface{}{"testString"})) Expect(configurationModel.Hidden).To(Equal(core.BoolPtr(true))) + Expect(configurationModel.CustomConfig).To(Equal(renderTypeModel)) + Expect(configurationModel.TypeMetadata).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the Output model + outputModel := new(catalogmanagementv1.Output) + Expect(outputModel).ToNot(BeNil()) + outputModel.Key = core.StringPtr("testString") + outputModel.Description = core.StringPtr("testString") + Expect(outputModel.Key).To(Equal(core.StringPtr("testString"))) + Expect(outputModel.Description).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the IamResource model + iamResourceModel := new(catalogmanagementv1.IamResource) + Expect(iamResourceModel).ToNot(BeNil()) + iamResourceModel.Name = core.StringPtr("testString") + iamResourceModel.Description = core.StringPtr("testString") + iamResourceModel.RoleCrns = []string{"testString"} + Expect(iamResourceModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(iamResourceModel.Description).To(Equal(core.StringPtr("testString"))) + Expect(iamResourceModel.RoleCrns).To(Equal([]string{"testString"})) + + // Construct an instance of the IamPermission model + iamPermissionModel := new(catalogmanagementv1.IamPermission) + Expect(iamPermissionModel).ToNot(BeNil()) + iamPermissionModel.ServiceName = core.StringPtr("testString") + iamPermissionModel.RoleCrns = []string{"testString"} + iamPermissionModel.Resources = []catalogmanagementv1.IamResource{*iamResourceModel} + Expect(iamPermissionModel.ServiceName).To(Equal(core.StringPtr("testString"))) + Expect(iamPermissionModel.RoleCrns).To(Equal([]string{"testString"})) + Expect(iamPermissionModel.Resources).To(Equal([]catalogmanagementv1.IamResource{*iamResourceModel})) // Construct an instance of the Validation model validationModel := new(catalogmanagementv1.Validation) @@ -17141,11 +25363,13 @@ var _ = Describe(`CatalogManagementV1`, func() { validationModel.State = core.StringPtr("testString") validationModel.LastOperation = core.StringPtr("testString") validationModel.Target = make(map[string]interface{}) + validationModel.Message = core.StringPtr("testString") Expect(validationModel.Validated).To(Equal(CreateMockDateTime("2019-01-01T12:00:00.000Z"))) Expect(validationModel.Requested).To(Equal(CreateMockDateTime("2019-01-01T12:00:00.000Z"))) Expect(validationModel.State).To(Equal(core.StringPtr("testString"))) Expect(validationModel.LastOperation).To(Equal(core.StringPtr("testString"))) Expect(validationModel.Target).To(Equal(make(map[string]interface{}))) + Expect(validationModel.Message).To(Equal(core.StringPtr("testString"))) // Construct an instance of the Resource model resourceModel := new(catalogmanagementv1.Resource) @@ -17159,11 +25383,13 @@ var _ = Describe(`CatalogManagementV1`, func() { scriptModel := new(catalogmanagementv1.Script) Expect(scriptModel).ToNot(BeNil()) scriptModel.Instructions = core.StringPtr("testString") + scriptModel.InstructionsI18n = make(map[string]string) scriptModel.Script = core.StringPtr("testString") scriptModel.ScriptPermission = core.StringPtr("testString") scriptModel.DeleteScript = core.StringPtr("testString") scriptModel.Scope = core.StringPtr("testString") Expect(scriptModel.Instructions).To(Equal(core.StringPtr("testString"))) + Expect(scriptModel.InstructionsI18n).To(Equal(make(map[string]string))) Expect(scriptModel.Script).To(Equal(core.StringPtr("testString"))) Expect(scriptModel.ScriptPermission).To(Equal(core.StringPtr("testString"))) Expect(scriptModel.DeleteScript).To(Equal(core.StringPtr("testString"))) @@ -17211,6 +25437,180 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(stateModel.PendingRequested).To(Equal(CreateMockDateTime("2019-01-01T12:00:00.000Z"))) Expect(stateModel.Previous).To(Equal(core.StringPtr("testString"))) + // Construct an instance of the DeprecatePending model + deprecatePendingModel := new(catalogmanagementv1.DeprecatePending) + Expect(deprecatePendingModel).ToNot(BeNil()) + deprecatePendingModel.DeprecateDate = CreateMockDateTime("2019-01-01T12:00:00.000Z") + deprecatePendingModel.DeprecateState = core.StringPtr("testString") + deprecatePendingModel.Description = core.StringPtr("testString") + Expect(deprecatePendingModel.DeprecateDate).To(Equal(CreateMockDateTime("2019-01-01T12:00:00.000Z"))) + Expect(deprecatePendingModel.DeprecateState).To(Equal(core.StringPtr("testString"))) + Expect(deprecatePendingModel.Description).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the URLProxy model + urlProxyModel := new(catalogmanagementv1.URLProxy) + Expect(urlProxyModel).ToNot(BeNil()) + urlProxyModel.URL = core.StringPtr("testString") + urlProxyModel.Sha = core.StringPtr("testString") + Expect(urlProxyModel.URL).To(Equal(core.StringPtr("testString"))) + Expect(urlProxyModel.Sha).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the MediaItem model + mediaItemModel := new(catalogmanagementv1.MediaItem) + Expect(mediaItemModel).ToNot(BeNil()) + mediaItemModel.URL = core.StringPtr("testString") + mediaItemModel.APIURL = core.StringPtr("testString") + mediaItemModel.URLProxy = urlProxyModel + mediaItemModel.Caption = core.StringPtr("testString") + mediaItemModel.CaptionI18n = make(map[string]string) + mediaItemModel.Type = core.StringPtr("testString") + mediaItemModel.ThumbnailURL = core.StringPtr("testString") + Expect(mediaItemModel.URL).To(Equal(core.StringPtr("testString"))) + Expect(mediaItemModel.APIURL).To(Equal(core.StringPtr("testString"))) + Expect(mediaItemModel.URLProxy).To(Equal(urlProxyModel)) + Expect(mediaItemModel.Caption).To(Equal(core.StringPtr("testString"))) + Expect(mediaItemModel.CaptionI18n).To(Equal(make(map[string]string))) + Expect(mediaItemModel.Type).To(Equal(core.StringPtr("testString"))) + Expect(mediaItemModel.ThumbnailURL).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the ArchitectureDiagram model + architectureDiagramModel := new(catalogmanagementv1.ArchitectureDiagram) + Expect(architectureDiagramModel).ToNot(BeNil()) + architectureDiagramModel.Diagram = mediaItemModel + architectureDiagramModel.Description = core.StringPtr("testString") + architectureDiagramModel.DescriptionI18n = make(map[string]string) + Expect(architectureDiagramModel.Diagram).To(Equal(mediaItemModel)) + Expect(architectureDiagramModel.Description).To(Equal(core.StringPtr("testString"))) + Expect(architectureDiagramModel.DescriptionI18n).To(Equal(make(map[string]string))) + + // Construct an instance of the CostComponent model + costComponentModel := new(catalogmanagementv1.CostComponent) + Expect(costComponentModel).ToNot(BeNil()) + costComponentModel.Name = core.StringPtr("testString") + costComponentModel.Unit = core.StringPtr("testString") + costComponentModel.HourlyQuantity = core.StringPtr("testString") + costComponentModel.MonthlyQuantity = core.StringPtr("testString") + costComponentModel.Price = core.StringPtr("testString") + costComponentModel.HourlyCost = core.StringPtr("testString") + costComponentModel.MonthlyCost = core.StringPtr("testString") + Expect(costComponentModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(costComponentModel.Unit).To(Equal(core.StringPtr("testString"))) + Expect(costComponentModel.HourlyQuantity).To(Equal(core.StringPtr("testString"))) + Expect(costComponentModel.MonthlyQuantity).To(Equal(core.StringPtr("testString"))) + Expect(costComponentModel.Price).To(Equal(core.StringPtr("testString"))) + Expect(costComponentModel.HourlyCost).To(Equal(core.StringPtr("testString"))) + Expect(costComponentModel.MonthlyCost).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the CostResource model + costResourceModel := new(catalogmanagementv1.CostResource) + Expect(costResourceModel).ToNot(BeNil()) + costResourceModel.Name = core.StringPtr("testString") + costResourceModel.Metadata = make(map[string]interface{}) + costResourceModel.HourlyCost = core.StringPtr("testString") + costResourceModel.MonthlyCost = core.StringPtr("testString") + costResourceModel.CostComponents = []catalogmanagementv1.CostComponent{*costComponentModel} + Expect(costResourceModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(costResourceModel.Metadata).To(Equal(make(map[string]interface{}))) + Expect(costResourceModel.HourlyCost).To(Equal(core.StringPtr("testString"))) + Expect(costResourceModel.MonthlyCost).To(Equal(core.StringPtr("testString"))) + Expect(costResourceModel.CostComponents).To(Equal([]catalogmanagementv1.CostComponent{*costComponentModel})) + + // Construct an instance of the CostBreakdown model + costBreakdownModel := new(catalogmanagementv1.CostBreakdown) + Expect(costBreakdownModel).ToNot(BeNil()) + costBreakdownModel.TotalHourlyCost = core.StringPtr("testString") + costBreakdownModel.TotalMonthlyCOst = core.StringPtr("testString") + costBreakdownModel.Resources = []catalogmanagementv1.CostResource{*costResourceModel} + Expect(costBreakdownModel.TotalHourlyCost).To(Equal(core.StringPtr("testString"))) + Expect(costBreakdownModel.TotalMonthlyCOst).To(Equal(core.StringPtr("testString"))) + Expect(costBreakdownModel.Resources).To(Equal([]catalogmanagementv1.CostResource{*costResourceModel})) + + // Construct an instance of the CostSummary model + costSummaryModel := new(catalogmanagementv1.CostSummary) + Expect(costSummaryModel).ToNot(BeNil()) + costSummaryModel.TotalDetectedResources = core.Int64Ptr(int64(38)) + costSummaryModel.TotalSupportedResources = core.Int64Ptr(int64(38)) + costSummaryModel.TotalUnsupportedResources = core.Int64Ptr(int64(38)) + costSummaryModel.TotalUsageBasedResources = core.Int64Ptr(int64(38)) + costSummaryModel.TotalNoPriceResources = core.Int64Ptr(int64(38)) + costSummaryModel.UnsupportedResourceCounts = make(map[string]int64) + costSummaryModel.NoPriceResourceCounts = make(map[string]int64) + Expect(costSummaryModel.TotalDetectedResources).To(Equal(core.Int64Ptr(int64(38)))) + Expect(costSummaryModel.TotalSupportedResources).To(Equal(core.Int64Ptr(int64(38)))) + Expect(costSummaryModel.TotalUnsupportedResources).To(Equal(core.Int64Ptr(int64(38)))) + Expect(costSummaryModel.TotalUsageBasedResources).To(Equal(core.Int64Ptr(int64(38)))) + Expect(costSummaryModel.TotalNoPriceResources).To(Equal(core.Int64Ptr(int64(38)))) + Expect(costSummaryModel.UnsupportedResourceCounts).To(Equal(make(map[string]int64))) + Expect(costSummaryModel.NoPriceResourceCounts).To(Equal(make(map[string]int64))) + + // Construct an instance of the Project model + projectModel := new(catalogmanagementv1.Project) + Expect(projectModel).ToNot(BeNil()) + projectModel.Name = core.StringPtr("testString") + projectModel.Metadata = make(map[string]interface{}) + projectModel.PastBreakdown = costBreakdownModel + projectModel.Breakdown = costBreakdownModel + projectModel.Diff = costBreakdownModel + projectModel.Summary = costSummaryModel + Expect(projectModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(projectModel.Metadata).To(Equal(make(map[string]interface{}))) + Expect(projectModel.PastBreakdown).To(Equal(costBreakdownModel)) + Expect(projectModel.Breakdown).To(Equal(costBreakdownModel)) + Expect(projectModel.Diff).To(Equal(costBreakdownModel)) + Expect(projectModel.Summary).To(Equal(costSummaryModel)) + + // Construct an instance of the CostEstimate model + costEstimateModel := new(catalogmanagementv1.CostEstimate) + Expect(costEstimateModel).ToNot(BeNil()) + costEstimateModel.Version = core.StringPtr("testString") + costEstimateModel.Currency = core.StringPtr("testString") + costEstimateModel.Projects = []catalogmanagementv1.Project{*projectModel} + costEstimateModel.Summary = costSummaryModel + costEstimateModel.TotalHourlyCost = core.StringPtr("testString") + costEstimateModel.TotalMonthlyCost = core.StringPtr("testString") + costEstimateModel.PastTotalHourlyCost = core.StringPtr("testString") + costEstimateModel.PastTotalMonthlyCost = core.StringPtr("testString") + costEstimateModel.DiffTotalHourlyCost = core.StringPtr("testString") + costEstimateModel.DiffTotalMonthlyCost = core.StringPtr("testString") + costEstimateModel.TimeGenerated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + Expect(costEstimateModel.Version).To(Equal(core.StringPtr("testString"))) + Expect(costEstimateModel.Currency).To(Equal(core.StringPtr("testString"))) + Expect(costEstimateModel.Projects).To(Equal([]catalogmanagementv1.Project{*projectModel})) + Expect(costEstimateModel.Summary).To(Equal(costSummaryModel)) + Expect(costEstimateModel.TotalHourlyCost).To(Equal(core.StringPtr("testString"))) + Expect(costEstimateModel.TotalMonthlyCost).To(Equal(core.StringPtr("testString"))) + Expect(costEstimateModel.PastTotalHourlyCost).To(Equal(core.StringPtr("testString"))) + Expect(costEstimateModel.PastTotalMonthlyCost).To(Equal(core.StringPtr("testString"))) + Expect(costEstimateModel.DiffTotalHourlyCost).To(Equal(core.StringPtr("testString"))) + Expect(costEstimateModel.DiffTotalMonthlyCost).To(Equal(core.StringPtr("testString"))) + Expect(costEstimateModel.TimeGenerated).To(Equal(CreateMockDateTime("2019-01-01T12:00:00.000Z"))) + + // Construct an instance of the Dependency model + dependencyModel := new(catalogmanagementv1.Dependency) + Expect(dependencyModel).ToNot(BeNil()) + dependencyModel.CatalogID = core.StringPtr("testString") + dependencyModel.ID = core.StringPtr("testString") + dependencyModel.Name = core.StringPtr("testString") + dependencyModel.Version = core.StringPtr("testString") + dependencyModel.Flavors = []string{"testString"} + Expect(dependencyModel.CatalogID).To(Equal(core.StringPtr("testString"))) + Expect(dependencyModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(dependencyModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(dependencyModel.Version).To(Equal(core.StringPtr("testString"))) + Expect(dependencyModel.Flavors).To(Equal([]string{"testString"})) + + // Construct an instance of the SolutionInfo model + solutionInfoModel := new(catalogmanagementv1.SolutionInfo) + Expect(solutionInfoModel).ToNot(BeNil()) + solutionInfoModel.ArchitectureDiagrams = []catalogmanagementv1.ArchitectureDiagram{*architectureDiagramModel} + solutionInfoModel.Features = []catalogmanagementv1.Feature{*featureModel} + solutionInfoModel.CostEstimate = costEstimateModel + solutionInfoModel.Dependencies = []catalogmanagementv1.Dependency{*dependencyModel} + Expect(solutionInfoModel.ArchitectureDiagrams).To(Equal([]catalogmanagementv1.ArchitectureDiagram{*architectureDiagramModel})) + Expect(solutionInfoModel.Features).To(Equal([]catalogmanagementv1.Feature{*featureModel})) + Expect(solutionInfoModel.CostEstimate).To(Equal(costEstimateModel)) + Expect(solutionInfoModel.Dependencies).To(Equal([]catalogmanagementv1.Dependency{*dependencyModel})) + // Construct an instance of the Version model versionModel := new(catalogmanagementv1.Version) Expect(versionModel).ToNot(BeNil()) @@ -17218,6 +25618,7 @@ var _ = Describe(`CatalogManagementV1`, func() { versionModel.Rev = core.StringPtr("testString") versionModel.CRN = core.StringPtr("testString") versionModel.Version = core.StringPtr("testString") + versionModel.Flavor = flavorModel versionModel.Sha = core.StringPtr("testString") versionModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") versionModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") @@ -17229,6 +25630,8 @@ var _ = Describe(`CatalogManagementV1`, func() { versionModel.SourceURL = core.StringPtr("testString") versionModel.TgzURL = core.StringPtr("testString") versionModel.Configuration = []catalogmanagementv1.Configuration{*configurationModel} + versionModel.Outputs = []catalogmanagementv1.Output{*outputModel} + versionModel.IamPermissions = []catalogmanagementv1.IamPermission{*iamPermissionModel} versionModel.Metadata = make(map[string]interface{}) versionModel.Validation = validationModel versionModel.RequiredResources = []catalogmanagementv1.Resource{*resourceModel} @@ -17242,13 +25645,18 @@ var _ = Describe(`CatalogManagementV1`, func() { versionModel.PackageVersion = core.StringPtr("testString") versionModel.State = stateModel versionModel.VersionLocator = core.StringPtr("testString") - versionModel.ConsoleURL = core.StringPtr("testString") versionModel.LongDescription = core.StringPtr("testString") + versionModel.LongDescriptionI18n = make(map[string]string) versionModel.WhitelistedAccounts = []string{"testString"} + versionModel.ImagePullKeyName = core.StringPtr("testString") + versionModel.DeprecatePending = deprecatePendingModel + versionModel.SolutionInfo = solutionInfoModel + versionModel.IsConsumable = core.BoolPtr(true) Expect(versionModel.ID).To(Equal(core.StringPtr("testString"))) Expect(versionModel.Rev).To(Equal(core.StringPtr("testString"))) Expect(versionModel.CRN).To(Equal(core.StringPtr("testString"))) Expect(versionModel.Version).To(Equal(core.StringPtr("testString"))) + Expect(versionModel.Flavor).To(Equal(flavorModel)) Expect(versionModel.Sha).To(Equal(core.StringPtr("testString"))) Expect(versionModel.Created).To(Equal(CreateMockDateTime("2019-01-01T12:00:00.000Z"))) Expect(versionModel.Updated).To(Equal(CreateMockDateTime("2019-01-01T12:00:00.000Z"))) @@ -17260,6 +25668,8 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(versionModel.SourceURL).To(Equal(core.StringPtr("testString"))) Expect(versionModel.TgzURL).To(Equal(core.StringPtr("testString"))) Expect(versionModel.Configuration).To(Equal([]catalogmanagementv1.Configuration{*configurationModel})) + Expect(versionModel.Outputs).To(Equal([]catalogmanagementv1.Output{*outputModel})) + Expect(versionModel.IamPermissions).To(Equal([]catalogmanagementv1.IamPermission{*iamPermissionModel})) Expect(versionModel.Metadata).To(Equal(make(map[string]interface{}))) Expect(versionModel.Validation).To(Equal(validationModel)) Expect(versionModel.RequiredResources).To(Equal([]catalogmanagementv1.Resource{*resourceModel})) @@ -17273,9 +25683,13 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(versionModel.PackageVersion).To(Equal(core.StringPtr("testString"))) Expect(versionModel.State).To(Equal(stateModel)) Expect(versionModel.VersionLocator).To(Equal(core.StringPtr("testString"))) - Expect(versionModel.ConsoleURL).To(Equal(core.StringPtr("testString"))) Expect(versionModel.LongDescription).To(Equal(core.StringPtr("testString"))) + Expect(versionModel.LongDescriptionI18n).To(Equal(make(map[string]string))) Expect(versionModel.WhitelistedAccounts).To(Equal([]string{"testString"})) + Expect(versionModel.ImagePullKeyName).To(Equal(core.StringPtr("testString"))) + Expect(versionModel.DeprecatePending).To(Equal(deprecatePendingModel)) + Expect(versionModel.SolutionInfo).To(Equal(solutionInfoModel)) + Expect(versionModel.IsConsumable).To(Equal(core.BoolPtr(true))) // Construct an instance of the Deployment model deploymentModel := new(catalogmanagementv1.Deployment) @@ -17330,9 +25744,9 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(kindModel).ToNot(BeNil()) kindModel.ID = core.StringPtr("testString") kindModel.FormatKind = core.StringPtr("testString") + kindModel.InstallKind = core.StringPtr("testString") kindModel.TargetKind = core.StringPtr("testString") kindModel.Metadata = make(map[string]interface{}) - kindModel.InstallDescription = core.StringPtr("testString") kindModel.Tags = []string{"testString"} kindModel.AdditionalFeatures = []catalogmanagementv1.Feature{*featureModel} kindModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") @@ -17341,9 +25755,9 @@ var _ = Describe(`CatalogManagementV1`, func() { kindModel.Plans = []catalogmanagementv1.Plan{*planModel} Expect(kindModel.ID).To(Equal(core.StringPtr("testString"))) Expect(kindModel.FormatKind).To(Equal(core.StringPtr("testString"))) + Expect(kindModel.InstallKind).To(Equal(core.StringPtr("testString"))) Expect(kindModel.TargetKind).To(Equal(core.StringPtr("testString"))) Expect(kindModel.Metadata).To(Equal(make(map[string]interface{}))) - Expect(kindModel.InstallDescription).To(Equal(core.StringPtr("testString"))) Expect(kindModel.Tags).To(Equal([]string{"testString"})) Expect(kindModel.AdditionalFeatures).To(Equal([]catalogmanagementv1.Feature{*featureModel})) Expect(kindModel.Created).To(Equal(CreateMockDateTime("2019-01-01T12:00:00.000Z"))) @@ -17367,27 +25781,123 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(repoInfoModel.Token).To(Equal(core.StringPtr("testString"))) Expect(repoInfoModel.Type).To(Equal(core.StringPtr("testString"))) + // Construct an instance of the ImagePullKey model + imagePullKeyModel := new(catalogmanagementv1.ImagePullKey) + Expect(imagePullKeyModel).ToNot(BeNil()) + imagePullKeyModel.Name = core.StringPtr("testString") + imagePullKeyModel.Value = core.StringPtr("testString") + imagePullKeyModel.Description = core.StringPtr("testString") + Expect(imagePullKeyModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(imagePullKeyModel.Value).To(Equal(core.StringPtr("testString"))) + Expect(imagePullKeyModel.Description).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the SupportWaitTime model + supportWaitTimeModel := new(catalogmanagementv1.SupportWaitTime) + Expect(supportWaitTimeModel).ToNot(BeNil()) + supportWaitTimeModel.Value = core.Int64Ptr(int64(38)) + supportWaitTimeModel.Type = core.StringPtr("testString") + Expect(supportWaitTimeModel.Value).To(Equal(core.Int64Ptr(int64(38)))) + Expect(supportWaitTimeModel.Type).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the SupportTime model + supportTimeModel := new(catalogmanagementv1.SupportTime) + Expect(supportTimeModel).ToNot(BeNil()) + supportTimeModel.Day = core.Int64Ptr(int64(38)) + supportTimeModel.StartTime = core.StringPtr("testString") + supportTimeModel.EndTime = core.StringPtr("testString") + Expect(supportTimeModel.Day).To(Equal(core.Int64Ptr(int64(38)))) + Expect(supportTimeModel.StartTime).To(Equal(core.StringPtr("testString"))) + Expect(supportTimeModel.EndTime).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the SupportAvailability model + supportAvailabilityModel := new(catalogmanagementv1.SupportAvailability) + Expect(supportAvailabilityModel).ToNot(BeNil()) + supportAvailabilityModel.Times = []catalogmanagementv1.SupportTime{*supportTimeModel} + supportAvailabilityModel.Timezone = core.StringPtr("testString") + supportAvailabilityModel.AlwaysAvailable = core.BoolPtr(true) + Expect(supportAvailabilityModel.Times).To(Equal([]catalogmanagementv1.SupportTime{*supportTimeModel})) + Expect(supportAvailabilityModel.Timezone).To(Equal(core.StringPtr("testString"))) + Expect(supportAvailabilityModel.AlwaysAvailable).To(Equal(core.BoolPtr(true))) + + // Construct an instance of the SupportDetail model + supportDetailModel := new(catalogmanagementv1.SupportDetail) + Expect(supportDetailModel).ToNot(BeNil()) + supportDetailModel.Type = core.StringPtr("testString") + supportDetailModel.Contact = core.StringPtr("testString") + supportDetailModel.ResponseWaitTime = supportWaitTimeModel + supportDetailModel.Availability = supportAvailabilityModel + Expect(supportDetailModel.Type).To(Equal(core.StringPtr("testString"))) + Expect(supportDetailModel.Contact).To(Equal(core.StringPtr("testString"))) + Expect(supportDetailModel.ResponseWaitTime).To(Equal(supportWaitTimeModel)) + Expect(supportDetailModel.Availability).To(Equal(supportAvailabilityModel)) + + // Construct an instance of the SupportEscalation model + supportEscalationModel := new(catalogmanagementv1.SupportEscalation) + Expect(supportEscalationModel).ToNot(BeNil()) + supportEscalationModel.EscalationWaitTime = supportWaitTimeModel + supportEscalationModel.ResponseWaitTime = supportWaitTimeModel + supportEscalationModel.Contact = core.StringPtr("testString") + Expect(supportEscalationModel.EscalationWaitTime).To(Equal(supportWaitTimeModel)) + Expect(supportEscalationModel.ResponseWaitTime).To(Equal(supportWaitTimeModel)) + Expect(supportEscalationModel.Contact).To(Equal(core.StringPtr("testString"))) + // Construct an instance of the Support model supportModel := new(catalogmanagementv1.Support) Expect(supportModel).ToNot(BeNil()) supportModel.URL = core.StringPtr("testString") supportModel.Process = core.StringPtr("testString") + supportModel.ProcessI18n = make(map[string]string) supportModel.Locations = []string{"testString"} + supportModel.SupportDetails = []catalogmanagementv1.SupportDetail{*supportDetailModel} + supportModel.SupportEscalation = supportEscalationModel + supportModel.SupportType = core.StringPtr("testString") Expect(supportModel.URL).To(Equal(core.StringPtr("testString"))) Expect(supportModel.Process).To(Equal(core.StringPtr("testString"))) + Expect(supportModel.ProcessI18n).To(Equal(make(map[string]string))) Expect(supportModel.Locations).To(Equal([]string{"testString"})) - - // Construct an instance of the MediaItem model - mediaItemModel := new(catalogmanagementv1.MediaItem) - Expect(mediaItemModel).ToNot(BeNil()) - mediaItemModel.URL = core.StringPtr("testString") - mediaItemModel.Caption = core.StringPtr("testString") - mediaItemModel.Type = core.StringPtr("testString") - mediaItemModel.ThumbnailURL = core.StringPtr("testString") - Expect(mediaItemModel.URL).To(Equal(core.StringPtr("testString"))) - Expect(mediaItemModel.Caption).To(Equal(core.StringPtr("testString"))) - Expect(mediaItemModel.Type).To(Equal(core.StringPtr("testString"))) - Expect(mediaItemModel.ThumbnailURL).To(Equal(core.StringPtr("testString"))) + Expect(supportModel.SupportDetails).To(Equal([]catalogmanagementv1.SupportDetail{*supportDetailModel})) + Expect(supportModel.SupportEscalation).To(Equal(supportEscalationModel)) + Expect(supportModel.SupportType).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the LearnMoreLinks model + learnMoreLinksModel := new(catalogmanagementv1.LearnMoreLinks) + Expect(learnMoreLinksModel).ToNot(BeNil()) + learnMoreLinksModel.FirstParty = core.StringPtr("testString") + learnMoreLinksModel.ThirdParty = core.StringPtr("testString") + Expect(learnMoreLinksModel.FirstParty).To(Equal(core.StringPtr("testString"))) + Expect(learnMoreLinksModel.ThirdParty).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the Constraint model + constraintModel := new(catalogmanagementv1.Constraint) + Expect(constraintModel).ToNot(BeNil()) + constraintModel.Type = core.StringPtr("testString") + constraintModel.Rule = core.StringPtr("testString") + Expect(constraintModel.Type).To(Equal(core.StringPtr("testString"))) + Expect(constraintModel.Rule).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the Badge model + badgeModel := new(catalogmanagementv1.Badge) + Expect(badgeModel).ToNot(BeNil()) + badgeModel.ID = core.StringPtr("testString") + badgeModel.Label = core.StringPtr("testString") + badgeModel.LabelI18n = make(map[string]string) + badgeModel.Description = core.StringPtr("testString") + badgeModel.DescriptionI18n = make(map[string]string) + badgeModel.Icon = core.StringPtr("testString") + badgeModel.Authority = core.StringPtr("testString") + badgeModel.Tag = core.StringPtr("testString") + badgeModel.LearnMoreLinks = learnMoreLinksModel + badgeModel.Constraints = []catalogmanagementv1.Constraint{*constraintModel} + Expect(badgeModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(badgeModel.Label).To(Equal(core.StringPtr("testString"))) + Expect(badgeModel.LabelI18n).To(Equal(make(map[string]string))) + Expect(badgeModel.Description).To(Equal(core.StringPtr("testString"))) + Expect(badgeModel.DescriptionI18n).To(Equal(make(map[string]string))) + Expect(badgeModel.Icon).To(Equal(core.StringPtr("testString"))) + Expect(badgeModel.Authority).To(Equal(core.StringPtr("testString"))) + Expect(badgeModel.Tag).To(Equal(core.StringPtr("testString"))) + Expect(badgeModel.LearnMoreLinks).To(Equal(learnMoreLinksModel)) + Expect(badgeModel.Constraints).To(Equal([]catalogmanagementv1.Constraint{*constraintModel})) // Construct an instance of the CreateOfferingOptions model catalogIdentifier := "testString" @@ -17398,6 +25908,7 @@ var _ = Describe(`CatalogManagementV1`, func() { createOfferingOptionsModel.SetURL("testString") createOfferingOptionsModel.SetCRN("testString") createOfferingOptionsModel.SetLabel("testString") + createOfferingOptionsModel.SetLabelI18n(make(map[string]string)) createOfferingOptionsModel.SetName("testString") createOfferingOptionsModel.SetOfferingIconURL("testString") createOfferingOptionsModel.SetOfferingDocsURL("testString") @@ -17408,9 +25919,16 @@ var _ = Describe(`CatalogManagementV1`, func() { createOfferingOptionsModel.SetCreated(CreateMockDateTime("2019-01-01T12:00:00.000Z")) createOfferingOptionsModel.SetUpdated(CreateMockDateTime("2019-01-01T12:00:00.000Z")) createOfferingOptionsModel.SetShortDescription("testString") + createOfferingOptionsModel.SetShortDescriptionI18n(make(map[string]string)) createOfferingOptionsModel.SetLongDescription("testString") + createOfferingOptionsModel.SetLongDescriptionI18n(make(map[string]string)) createOfferingOptionsModel.SetFeatures([]catalogmanagementv1.Feature{*featureModel}) createOfferingOptionsModel.SetKinds([]catalogmanagementv1.Kind{*kindModel}) + createOfferingOptionsModel.SetPcManaged(true) + createOfferingOptionsModel.SetPublishApproved(true) + createOfferingOptionsModel.SetShareWithAll(true) + createOfferingOptionsModel.SetShareWithIBM(true) + createOfferingOptionsModel.SetShareEnabled(true) createOfferingOptionsModel.SetPermitRequestIBMPublicPublish(true) createOfferingOptionsModel.SetIBMPublishApproved(true) createOfferingOptionsModel.SetPublicPublishApproved(true) @@ -17426,8 +25944,12 @@ var _ = Describe(`CatalogManagementV1`, func() { createOfferingOptionsModel.SetProvider("testString") createOfferingOptionsModel.SetProviderInfo(providerInfoModel) createOfferingOptionsModel.SetRepoInfo(repoInfoModel) + createOfferingOptionsModel.SetImagePullKeys([]catalogmanagementv1.ImagePullKey{*imagePullKeyModel}) createOfferingOptionsModel.SetSupport(supportModel) createOfferingOptionsModel.SetMedia([]catalogmanagementv1.MediaItem{*mediaItemModel}) + createOfferingOptionsModel.SetDeprecatePending(deprecatePendingModel) + createOfferingOptionsModel.SetProductKind("testString") + createOfferingOptionsModel.SetBadges([]catalogmanagementv1.Badge{*badgeModel}) createOfferingOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(createOfferingOptionsModel).ToNot(BeNil()) Expect(createOfferingOptionsModel.CatalogIdentifier).To(Equal(core.StringPtr("testString"))) @@ -17436,6 +25958,7 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(createOfferingOptionsModel.URL).To(Equal(core.StringPtr("testString"))) Expect(createOfferingOptionsModel.CRN).To(Equal(core.StringPtr("testString"))) Expect(createOfferingOptionsModel.Label).To(Equal(core.StringPtr("testString"))) + Expect(createOfferingOptionsModel.LabelI18n).To(Equal(make(map[string]string))) Expect(createOfferingOptionsModel.Name).To(Equal(core.StringPtr("testString"))) Expect(createOfferingOptionsModel.OfferingIconURL).To(Equal(core.StringPtr("testString"))) Expect(createOfferingOptionsModel.OfferingDocsURL).To(Equal(core.StringPtr("testString"))) @@ -17446,9 +25969,16 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(createOfferingOptionsModel.Created).To(Equal(CreateMockDateTime("2019-01-01T12:00:00.000Z"))) Expect(createOfferingOptionsModel.Updated).To(Equal(CreateMockDateTime("2019-01-01T12:00:00.000Z"))) Expect(createOfferingOptionsModel.ShortDescription).To(Equal(core.StringPtr("testString"))) + Expect(createOfferingOptionsModel.ShortDescriptionI18n).To(Equal(make(map[string]string))) Expect(createOfferingOptionsModel.LongDescription).To(Equal(core.StringPtr("testString"))) + Expect(createOfferingOptionsModel.LongDescriptionI18n).To(Equal(make(map[string]string))) Expect(createOfferingOptionsModel.Features).To(Equal([]catalogmanagementv1.Feature{*featureModel})) Expect(createOfferingOptionsModel.Kinds).To(Equal([]catalogmanagementv1.Kind{*kindModel})) + Expect(createOfferingOptionsModel.PcManaged).To(Equal(core.BoolPtr(true))) + Expect(createOfferingOptionsModel.PublishApproved).To(Equal(core.BoolPtr(true))) + Expect(createOfferingOptionsModel.ShareWithAll).To(Equal(core.BoolPtr(true))) + Expect(createOfferingOptionsModel.ShareWithIBM).To(Equal(core.BoolPtr(true))) + Expect(createOfferingOptionsModel.ShareEnabled).To(Equal(core.BoolPtr(true))) Expect(createOfferingOptionsModel.PermitRequestIBMPublicPublish).To(Equal(core.BoolPtr(true))) Expect(createOfferingOptionsModel.IBMPublishApproved).To(Equal(core.BoolPtr(true))) Expect(createOfferingOptionsModel.PublicPublishApproved).To(Equal(core.BoolPtr(true))) @@ -17464,8 +25994,12 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(createOfferingOptionsModel.Provider).To(Equal(core.StringPtr("testString"))) Expect(createOfferingOptionsModel.ProviderInfo).To(Equal(providerInfoModel)) Expect(createOfferingOptionsModel.RepoInfo).To(Equal(repoInfoModel)) + Expect(createOfferingOptionsModel.ImagePullKeys).To(Equal([]catalogmanagementv1.ImagePullKey{*imagePullKeyModel})) Expect(createOfferingOptionsModel.Support).To(Equal(supportModel)) Expect(createOfferingOptionsModel.Media).To(Equal([]catalogmanagementv1.MediaItem{*mediaItemModel})) + Expect(createOfferingOptionsModel.DeprecatePending).To(Equal(deprecatePendingModel)) + Expect(createOfferingOptionsModel.ProductKind).To(Equal(core.StringPtr("testString"))) + Expect(createOfferingOptionsModel.Badges).To(Equal([]catalogmanagementv1.Badge{*badgeModel})) Expect(createOfferingOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewDeleteCatalogOptions successfully`, func() { @@ -17482,32 +26016,32 @@ var _ = Describe(`CatalogManagementV1`, func() { // Construct an instance of the DeleteObjectAccessListOptions model catalogIdentifier := "testString" objectIdentifier := "testString" - accounts := []string{"testString"} - deleteObjectAccessListOptionsModel := catalogManagementService.NewDeleteObjectAccessListOptions(catalogIdentifier, objectIdentifier, accounts) + accesses := []string{"testString"} + deleteObjectAccessListOptionsModel := catalogManagementService.NewDeleteObjectAccessListOptions(catalogIdentifier, objectIdentifier, accesses) deleteObjectAccessListOptionsModel.SetCatalogIdentifier("testString") deleteObjectAccessListOptionsModel.SetObjectIdentifier("testString") - deleteObjectAccessListOptionsModel.SetAccounts([]string{"testString"}) + deleteObjectAccessListOptionsModel.SetAccesses([]string{"testString"}) deleteObjectAccessListOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(deleteObjectAccessListOptionsModel).ToNot(BeNil()) Expect(deleteObjectAccessListOptionsModel.CatalogIdentifier).To(Equal(core.StringPtr("testString"))) Expect(deleteObjectAccessListOptionsModel.ObjectIdentifier).To(Equal(core.StringPtr("testString"))) - Expect(deleteObjectAccessListOptionsModel.Accounts).To(Equal([]string{"testString"})) + Expect(deleteObjectAccessListOptionsModel.Accesses).To(Equal([]string{"testString"})) Expect(deleteObjectAccessListOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewDeleteObjectAccessOptions successfully`, func() { // Construct an instance of the DeleteObjectAccessOptions model catalogIdentifier := "testString" objectIdentifier := "testString" - accountIdentifier := "testString" - deleteObjectAccessOptionsModel := catalogManagementService.NewDeleteObjectAccessOptions(catalogIdentifier, objectIdentifier, accountIdentifier) + accessIdentifier := "testString" + deleteObjectAccessOptionsModel := catalogManagementService.NewDeleteObjectAccessOptions(catalogIdentifier, objectIdentifier, accessIdentifier) deleteObjectAccessOptionsModel.SetCatalogIdentifier("testString") deleteObjectAccessOptionsModel.SetObjectIdentifier("testString") - deleteObjectAccessOptionsModel.SetAccountIdentifier("testString") + deleteObjectAccessOptionsModel.SetAccessIdentifier("testString") deleteObjectAccessOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(deleteObjectAccessOptionsModel).ToNot(BeNil()) Expect(deleteObjectAccessOptionsModel.CatalogIdentifier).To(Equal(core.StringPtr("testString"))) Expect(deleteObjectAccessOptionsModel.ObjectIdentifier).To(Equal(core.StringPtr("testString"))) - Expect(deleteObjectAccessOptionsModel.AccountIdentifier).To(Equal(core.StringPtr("testString"))) + Expect(deleteObjectAccessOptionsModel.AccessIdentifier).To(Equal(core.StringPtr("testString"))) Expect(deleteObjectAccessOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewDeleteObjectOptions successfully`, func() { @@ -17523,6 +26057,22 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(deleteObjectOptionsModel.ObjectIdentifier).To(Equal(core.StringPtr("testString"))) Expect(deleteObjectOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewDeleteOfferingAccessListOptions successfully`, func() { + // Construct an instance of the DeleteOfferingAccessListOptions model + catalogIdentifier := "testString" + offeringID := "testString" + accesses := []string{"testString"} + deleteOfferingAccessListOptionsModel := catalogManagementService.NewDeleteOfferingAccessListOptions(catalogIdentifier, offeringID, accesses) + deleteOfferingAccessListOptionsModel.SetCatalogIdentifier("testString") + deleteOfferingAccessListOptionsModel.SetOfferingID("testString") + deleteOfferingAccessListOptionsModel.SetAccesses([]string{"testString"}) + deleteOfferingAccessListOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteOfferingAccessListOptionsModel).ToNot(BeNil()) + Expect(deleteOfferingAccessListOptionsModel.CatalogIdentifier).To(Equal(core.StringPtr("testString"))) + Expect(deleteOfferingAccessListOptionsModel.OfferingID).To(Equal(core.StringPtr("testString"))) + Expect(deleteOfferingAccessListOptionsModel.Accesses).To(Equal([]string{"testString"})) + Expect(deleteOfferingAccessListOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewDeleteOfferingInstanceOptions successfully`, func() { // Construct an instance of the DeleteOfferingInstanceOptions model instanceIdentifier := "testString" @@ -17588,6 +26138,8 @@ var _ = Describe(`CatalogManagementV1`, func() { deployOperatorsOptionsModel.SetNamespaces([]string{"testString"}) deployOperatorsOptionsModel.SetAllNamespaces(true) deployOperatorsOptionsModel.SetVersionLocatorID("testString") + deployOperatorsOptionsModel.SetChannel("testString") + deployOperatorsOptionsModel.SetInstallPlan("testString") deployOperatorsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(deployOperatorsOptionsModel).ToNot(BeNil()) Expect(deployOperatorsOptionsModel.XAuthRefreshToken).To(Equal(core.StringPtr("testString"))) @@ -17596,6 +26148,8 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(deployOperatorsOptionsModel.Namespaces).To(Equal([]string{"testString"})) Expect(deployOperatorsOptionsModel.AllNamespaces).To(Equal(core.BoolPtr(true))) Expect(deployOperatorsOptionsModel.VersionLocatorID).To(Equal(core.StringPtr("testString"))) + Expect(deployOperatorsOptionsModel.Channel).To(Equal(core.StringPtr("testString"))) + Expect(deployOperatorsOptionsModel.InstallPlan).To(Equal(core.StringPtr("testString"))) Expect(deployOperatorsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewDeprecateOfferingOptions successfully`, func() { @@ -17630,9 +26184,14 @@ var _ = Describe(`CatalogManagementV1`, func() { }) It(`Invoke NewGetCatalogAccountAuditOptions successfully`, func() { // Construct an instance of the GetCatalogAccountAuditOptions model - getCatalogAccountAuditOptionsModel := catalogManagementService.NewGetCatalogAccountAuditOptions() + auditlogIdentifier := "testString" + getCatalogAccountAuditOptionsModel := catalogManagementService.NewGetCatalogAccountAuditOptions(auditlogIdentifier) + getCatalogAccountAuditOptionsModel.SetAuditlogIdentifier("testString") + getCatalogAccountAuditOptionsModel.SetLookupnames(true) getCatalogAccountAuditOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(getCatalogAccountAuditOptionsModel).ToNot(BeNil()) + Expect(getCatalogAccountAuditOptionsModel.AuditlogIdentifier).To(Equal(core.StringPtr("testString"))) + Expect(getCatalogAccountAuditOptionsModel.Lookupnames).To(Equal(core.BoolPtr(true))) Expect(getCatalogAccountAuditOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewGetCatalogAccountFiltersOptions successfully`, func() { @@ -17654,11 +26213,16 @@ var _ = Describe(`CatalogManagementV1`, func() { It(`Invoke NewGetCatalogAuditOptions successfully`, func() { // Construct an instance of the GetCatalogAuditOptions model catalogIdentifier := "testString" - getCatalogAuditOptionsModel := catalogManagementService.NewGetCatalogAuditOptions(catalogIdentifier) + auditlogIdentifier := "testString" + getCatalogAuditOptionsModel := catalogManagementService.NewGetCatalogAuditOptions(catalogIdentifier, auditlogIdentifier) getCatalogAuditOptionsModel.SetCatalogIdentifier("testString") + getCatalogAuditOptionsModel.SetAuditlogIdentifier("testString") + getCatalogAuditOptionsModel.SetLookupnames(true) getCatalogAuditOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(getCatalogAuditOptionsModel).ToNot(BeNil()) Expect(getCatalogAuditOptionsModel.CatalogIdentifier).To(Equal(core.StringPtr("testString"))) + Expect(getCatalogAuditOptionsModel.AuditlogIdentifier).To(Equal(core.StringPtr("testString"))) + Expect(getCatalogAuditOptionsModel.Lookupnames).To(Equal(core.BoolPtr(true))) Expect(getCatalogAuditOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewGetCatalogOptions successfully`, func() { @@ -17706,6 +26270,21 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(getConsumptionOfferingsOptionsModel.Offset).To(Equal(core.Int64Ptr(int64(38)))) Expect(getConsumptionOfferingsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewGetEnterpriseAuditOptions successfully`, func() { + // Construct an instance of the GetEnterpriseAuditOptions model + enterpriseIdentifier := "testString" + auditlogIdentifier := "testString" + getEnterpriseAuditOptionsModel := catalogManagementService.NewGetEnterpriseAuditOptions(enterpriseIdentifier, auditlogIdentifier) + getEnterpriseAuditOptionsModel.SetEnterpriseIdentifier("testString") + getEnterpriseAuditOptionsModel.SetAuditlogIdentifier("testString") + getEnterpriseAuditOptionsModel.SetLookupnames(true) + getEnterpriseAuditOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getEnterpriseAuditOptionsModel).ToNot(BeNil()) + Expect(getEnterpriseAuditOptionsModel.EnterpriseIdentifier).To(Equal(core.StringPtr("testString"))) + Expect(getEnterpriseAuditOptionsModel.AuditlogIdentifier).To(Equal(core.StringPtr("testString"))) + Expect(getEnterpriseAuditOptionsModel.Lookupnames).To(Equal(core.BoolPtr(true))) + Expect(getEnterpriseAuditOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewGetNamespacesOptions successfully`, func() { // Construct an instance of the GetNamespacesOptions model clusterID := "testString" @@ -17726,6 +26305,23 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(getNamespacesOptionsModel.Offset).To(Equal(core.Int64Ptr(int64(38)))) Expect(getNamespacesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewGetObjectAccessListDeprecatedOptions successfully`, func() { + // Construct an instance of the GetObjectAccessListDeprecatedOptions model + catalogIdentifier := "testString" + objectIdentifier := "testString" + getObjectAccessListDeprecatedOptionsModel := catalogManagementService.NewGetObjectAccessListDeprecatedOptions(catalogIdentifier, objectIdentifier) + getObjectAccessListDeprecatedOptionsModel.SetCatalogIdentifier("testString") + getObjectAccessListDeprecatedOptionsModel.SetObjectIdentifier("testString") + getObjectAccessListDeprecatedOptionsModel.SetLimit(int64(1000)) + getObjectAccessListDeprecatedOptionsModel.SetOffset(int64(38)) + getObjectAccessListDeprecatedOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getObjectAccessListDeprecatedOptionsModel).ToNot(BeNil()) + Expect(getObjectAccessListDeprecatedOptionsModel.CatalogIdentifier).To(Equal(core.StringPtr("testString"))) + Expect(getObjectAccessListDeprecatedOptionsModel.ObjectIdentifier).To(Equal(core.StringPtr("testString"))) + Expect(getObjectAccessListDeprecatedOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1000)))) + Expect(getObjectAccessListDeprecatedOptionsModel.Offset).To(Equal(core.Int64Ptr(int64(38)))) + Expect(getObjectAccessListDeprecatedOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewGetObjectAccessListOptions successfully`, func() { // Construct an instance of the GetObjectAccessListOptions model catalogIdentifier := "testString" @@ -17733,43 +26329,48 @@ var _ = Describe(`CatalogManagementV1`, func() { getObjectAccessListOptionsModel := catalogManagementService.NewGetObjectAccessListOptions(catalogIdentifier, objectIdentifier) getObjectAccessListOptionsModel.SetCatalogIdentifier("testString") getObjectAccessListOptionsModel.SetObjectIdentifier("testString") - getObjectAccessListOptionsModel.SetLimit(int64(1000)) - getObjectAccessListOptionsModel.SetOffset(int64(38)) + getObjectAccessListOptionsModel.SetStart("testString") + getObjectAccessListOptionsModel.SetLimit(int64(10)) getObjectAccessListOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(getObjectAccessListOptionsModel).ToNot(BeNil()) Expect(getObjectAccessListOptionsModel.CatalogIdentifier).To(Equal(core.StringPtr("testString"))) Expect(getObjectAccessListOptionsModel.ObjectIdentifier).To(Equal(core.StringPtr("testString"))) - Expect(getObjectAccessListOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1000)))) - Expect(getObjectAccessListOptionsModel.Offset).To(Equal(core.Int64Ptr(int64(38)))) + Expect(getObjectAccessListOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(getObjectAccessListOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) Expect(getObjectAccessListOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewGetObjectAccessOptions successfully`, func() { // Construct an instance of the GetObjectAccessOptions model catalogIdentifier := "testString" objectIdentifier := "testString" - accountIdentifier := "testString" - getObjectAccessOptionsModel := catalogManagementService.NewGetObjectAccessOptions(catalogIdentifier, objectIdentifier, accountIdentifier) + accessIdentifier := "testString" + getObjectAccessOptionsModel := catalogManagementService.NewGetObjectAccessOptions(catalogIdentifier, objectIdentifier, accessIdentifier) getObjectAccessOptionsModel.SetCatalogIdentifier("testString") getObjectAccessOptionsModel.SetObjectIdentifier("testString") - getObjectAccessOptionsModel.SetAccountIdentifier("testString") + getObjectAccessOptionsModel.SetAccessIdentifier("testString") getObjectAccessOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(getObjectAccessOptionsModel).ToNot(BeNil()) Expect(getObjectAccessOptionsModel.CatalogIdentifier).To(Equal(core.StringPtr("testString"))) Expect(getObjectAccessOptionsModel.ObjectIdentifier).To(Equal(core.StringPtr("testString"))) - Expect(getObjectAccessOptionsModel.AccountIdentifier).To(Equal(core.StringPtr("testString"))) + Expect(getObjectAccessOptionsModel.AccessIdentifier).To(Equal(core.StringPtr("testString"))) Expect(getObjectAccessOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewGetObjectAuditOptions successfully`, func() { // Construct an instance of the GetObjectAuditOptions model catalogIdentifier := "testString" objectIdentifier := "testString" - getObjectAuditOptionsModel := catalogManagementService.NewGetObjectAuditOptions(catalogIdentifier, objectIdentifier) + auditlogIdentifier := "testString" + getObjectAuditOptionsModel := catalogManagementService.NewGetObjectAuditOptions(catalogIdentifier, objectIdentifier, auditlogIdentifier) getObjectAuditOptionsModel.SetCatalogIdentifier("testString") getObjectAuditOptionsModel.SetObjectIdentifier("testString") + getObjectAuditOptionsModel.SetAuditlogIdentifier("testString") + getObjectAuditOptionsModel.SetLookupnames(true) getObjectAuditOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(getObjectAuditOptionsModel).ToNot(BeNil()) Expect(getObjectAuditOptionsModel.CatalogIdentifier).To(Equal(core.StringPtr("testString"))) Expect(getObjectAuditOptionsModel.ObjectIdentifier).To(Equal(core.StringPtr("testString"))) + Expect(getObjectAuditOptionsModel.AuditlogIdentifier).To(Equal(core.StringPtr("testString"))) + Expect(getObjectAuditOptionsModel.Lookupnames).To(Equal(core.BoolPtr(true))) Expect(getObjectAuditOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewGetObjectOptions successfully`, func() { @@ -17795,17 +26396,55 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(getOfferingAboutOptionsModel.VersionLocID).To(Equal(core.StringPtr("testString"))) Expect(getOfferingAboutOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewGetOfferingAccessListOptions successfully`, func() { + // Construct an instance of the GetOfferingAccessListOptions model + catalogIdentifier := "testString" + offeringID := "testString" + getOfferingAccessListOptionsModel := catalogManagementService.NewGetOfferingAccessListOptions(catalogIdentifier, offeringID) + getOfferingAccessListOptionsModel.SetCatalogIdentifier("testString") + getOfferingAccessListOptionsModel.SetOfferingID("testString") + getOfferingAccessListOptionsModel.SetStart("testString") + getOfferingAccessListOptionsModel.SetLimit(int64(10)) + getOfferingAccessListOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getOfferingAccessListOptionsModel).ToNot(BeNil()) + Expect(getOfferingAccessListOptionsModel.CatalogIdentifier).To(Equal(core.StringPtr("testString"))) + Expect(getOfferingAccessListOptionsModel.OfferingID).To(Equal(core.StringPtr("testString"))) + Expect(getOfferingAccessListOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(getOfferingAccessListOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) + Expect(getOfferingAccessListOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetOfferingAccessOptions successfully`, func() { + // Construct an instance of the GetOfferingAccessOptions model + catalogIdentifier := "testString" + offeringID := "testString" + accessIdentifier := "testString" + getOfferingAccessOptionsModel := catalogManagementService.NewGetOfferingAccessOptions(catalogIdentifier, offeringID, accessIdentifier) + getOfferingAccessOptionsModel.SetCatalogIdentifier("testString") + getOfferingAccessOptionsModel.SetOfferingID("testString") + getOfferingAccessOptionsModel.SetAccessIdentifier("testString") + getOfferingAccessOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getOfferingAccessOptionsModel).ToNot(BeNil()) + Expect(getOfferingAccessOptionsModel.CatalogIdentifier).To(Equal(core.StringPtr("testString"))) + Expect(getOfferingAccessOptionsModel.OfferingID).To(Equal(core.StringPtr("testString"))) + Expect(getOfferingAccessOptionsModel.AccessIdentifier).To(Equal(core.StringPtr("testString"))) + Expect(getOfferingAccessOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewGetOfferingAuditOptions successfully`, func() { // Construct an instance of the GetOfferingAuditOptions model catalogIdentifier := "testString" offeringID := "testString" - getOfferingAuditOptionsModel := catalogManagementService.NewGetOfferingAuditOptions(catalogIdentifier, offeringID) + auditlogIdentifier := "testString" + getOfferingAuditOptionsModel := catalogManagementService.NewGetOfferingAuditOptions(catalogIdentifier, offeringID, auditlogIdentifier) getOfferingAuditOptionsModel.SetCatalogIdentifier("testString") getOfferingAuditOptionsModel.SetOfferingID("testString") + getOfferingAuditOptionsModel.SetAuditlogIdentifier("testString") + getOfferingAuditOptionsModel.SetLookupnames(true) getOfferingAuditOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(getOfferingAuditOptionsModel).ToNot(BeNil()) Expect(getOfferingAuditOptionsModel.CatalogIdentifier).To(Equal(core.StringPtr("testString"))) Expect(getOfferingAuditOptionsModel.OfferingID).To(Equal(core.StringPtr("testString"))) + Expect(getOfferingAuditOptionsModel.AuditlogIdentifier).To(Equal(core.StringPtr("testString"))) + Expect(getOfferingAuditOptionsModel.Lookupnames).To(Equal(core.BoolPtr(true))) Expect(getOfferingAuditOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewGetOfferingContainerImagesOptions successfully`, func() { @@ -17818,6 +26457,21 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(getOfferingContainerImagesOptionsModel.VersionLocID).To(Equal(core.StringPtr("testString"))) Expect(getOfferingContainerImagesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewGetOfferingInstanceAuditOptions successfully`, func() { + // Construct an instance of the GetOfferingInstanceAuditOptions model + instanceIdentifier := "testString" + auditlogIdentifier := "testString" + getOfferingInstanceAuditOptionsModel := catalogManagementService.NewGetOfferingInstanceAuditOptions(instanceIdentifier, auditlogIdentifier) + getOfferingInstanceAuditOptionsModel.SetInstanceIdentifier("testString") + getOfferingInstanceAuditOptionsModel.SetAuditlogIdentifier("testString") + getOfferingInstanceAuditOptionsModel.SetLookupnames(true) + getOfferingInstanceAuditOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getOfferingInstanceAuditOptionsModel).ToNot(BeNil()) + Expect(getOfferingInstanceAuditOptionsModel.InstanceIdentifier).To(Equal(core.StringPtr("testString"))) + Expect(getOfferingInstanceAuditOptionsModel.AuditlogIdentifier).To(Equal(core.StringPtr("testString"))) + Expect(getOfferingInstanceAuditOptionsModel.Lookupnames).To(Equal(core.BoolPtr(true))) + Expect(getOfferingInstanceAuditOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewGetOfferingInstanceOptions successfully`, func() { // Construct an instance of the GetOfferingInstanceOptions model instanceIdentifier := "testString" @@ -17880,6 +26534,24 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(getOfferingSourceOptionsModel.Channel).To(Equal(core.StringPtr("testString"))) Expect(getOfferingSourceOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewGetOfferingSourceURLOptions successfully`, func() { + // Construct an instance of the GetOfferingSourceURLOptions model + keyIdentifier := "testString" + getOfferingSourceURLOptionsModel := catalogManagementService.NewGetOfferingSourceURLOptions(keyIdentifier) + getOfferingSourceURLOptionsModel.SetKeyIdentifier("testString") + getOfferingSourceURLOptionsModel.SetAccept("application/yaml") + getOfferingSourceURLOptionsModel.SetCatalogID("testString") + getOfferingSourceURLOptionsModel.SetName("testString") + getOfferingSourceURLOptionsModel.SetID("testString") + getOfferingSourceURLOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getOfferingSourceURLOptionsModel).ToNot(BeNil()) + Expect(getOfferingSourceURLOptionsModel.KeyIdentifier).To(Equal(core.StringPtr("testString"))) + Expect(getOfferingSourceURLOptionsModel.Accept).To(Equal(core.StringPtr("application/yaml"))) + Expect(getOfferingSourceURLOptionsModel.CatalogID).To(Equal(core.StringPtr("testString"))) + Expect(getOfferingSourceURLOptionsModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(getOfferingSourceURLOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getOfferingSourceURLOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewGetOfferingUpdatesOptions successfully`, func() { // Construct an instance of the GetOfferingUpdatesOptions model catalogIdentifier := "testString" @@ -18005,36 +26677,176 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(ibmPublishVersionOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewImportOfferingOptions successfully`, func() { + // Construct an instance of the Flavor model + flavorModel := new(catalogmanagementv1.Flavor) + Expect(flavorModel).ToNot(BeNil()) + flavorModel.Name = core.StringPtr("testString") + flavorModel.Label = core.StringPtr("testString") + flavorModel.LabelI18n = make(map[string]string) + flavorModel.Index = core.Int64Ptr(int64(38)) + Expect(flavorModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(flavorModel.Label).To(Equal(core.StringPtr("testString"))) + Expect(flavorModel.LabelI18n).To(Equal(make(map[string]string))) + Expect(flavorModel.Index).To(Equal(core.Int64Ptr(int64(38)))) + + // Construct an instance of the ImportOfferingBodyMetadataOperatingSystem model + importOfferingBodyMetadataOperatingSystemModel := new(catalogmanagementv1.ImportOfferingBodyMetadataOperatingSystem) + Expect(importOfferingBodyMetadataOperatingSystemModel).ToNot(BeNil()) + importOfferingBodyMetadataOperatingSystemModel.DedicatedHostOnly = core.BoolPtr(true) + importOfferingBodyMetadataOperatingSystemModel.Vendor = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.Name = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.Href = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.DisplayName = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.Family = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.Version = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.Architecture = core.StringPtr("testString") + Expect(importOfferingBodyMetadataOperatingSystemModel.DedicatedHostOnly).To(Equal(core.BoolPtr(true))) + Expect(importOfferingBodyMetadataOperatingSystemModel.Vendor).To(Equal(core.StringPtr("testString"))) + Expect(importOfferingBodyMetadataOperatingSystemModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(importOfferingBodyMetadataOperatingSystemModel.Href).To(Equal(core.StringPtr("testString"))) + Expect(importOfferingBodyMetadataOperatingSystemModel.DisplayName).To(Equal(core.StringPtr("testString"))) + Expect(importOfferingBodyMetadataOperatingSystemModel.Family).To(Equal(core.StringPtr("testString"))) + Expect(importOfferingBodyMetadataOperatingSystemModel.Version).To(Equal(core.StringPtr("testString"))) + Expect(importOfferingBodyMetadataOperatingSystemModel.Architecture).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the ImportOfferingBodyMetadataFile model + importOfferingBodyMetadataFileModel := new(catalogmanagementv1.ImportOfferingBodyMetadataFile) + Expect(importOfferingBodyMetadataFileModel).ToNot(BeNil()) + importOfferingBodyMetadataFileModel.Size = core.Int64Ptr(int64(38)) + Expect(importOfferingBodyMetadataFileModel.Size).To(Equal(core.Int64Ptr(int64(38)))) + + // Construct an instance of the ImportOfferingBodyMetadataImagesItem model + importOfferingBodyMetadataImagesItemModel := new(catalogmanagementv1.ImportOfferingBodyMetadataImagesItem) + Expect(importOfferingBodyMetadataImagesItemModel).ToNot(BeNil()) + importOfferingBodyMetadataImagesItemModel.ID = core.StringPtr("testString") + importOfferingBodyMetadataImagesItemModel.Name = core.StringPtr("testString") + importOfferingBodyMetadataImagesItemModel.Region = core.StringPtr("testString") + Expect(importOfferingBodyMetadataImagesItemModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(importOfferingBodyMetadataImagesItemModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(importOfferingBodyMetadataImagesItemModel.Region).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the ImportOfferingBodyMetadata model + importOfferingBodyMetadataModel := new(catalogmanagementv1.ImportOfferingBodyMetadata) + Expect(importOfferingBodyMetadataModel).ToNot(BeNil()) + importOfferingBodyMetadataModel.OperatingSystem = importOfferingBodyMetadataOperatingSystemModel + importOfferingBodyMetadataModel.File = importOfferingBodyMetadataFileModel + importOfferingBodyMetadataModel.MinimumProvisionedSize = core.Int64Ptr(int64(38)) + importOfferingBodyMetadataModel.Images = []catalogmanagementv1.ImportOfferingBodyMetadataImagesItem{*importOfferingBodyMetadataImagesItemModel} + Expect(importOfferingBodyMetadataModel.OperatingSystem).To(Equal(importOfferingBodyMetadataOperatingSystemModel)) + Expect(importOfferingBodyMetadataModel.File).To(Equal(importOfferingBodyMetadataFileModel)) + Expect(importOfferingBodyMetadataModel.MinimumProvisionedSize).To(Equal(core.Int64Ptr(int64(38)))) + Expect(importOfferingBodyMetadataModel.Images).To(Equal([]catalogmanagementv1.ImportOfferingBodyMetadataImagesItem{*importOfferingBodyMetadataImagesItemModel})) + // Construct an instance of the ImportOfferingOptions model catalogIdentifier := "testString" importOfferingOptionsModel := catalogManagementService.NewImportOfferingOptions(catalogIdentifier) importOfferingOptionsModel.SetCatalogIdentifier("testString") importOfferingOptionsModel.SetTags([]string{"testString"}) - importOfferingOptionsModel.SetTargetKinds([]string{"testString"}) importOfferingOptionsModel.SetContent(*CreateMockByteArray("This is a mock byte array value.")) + importOfferingOptionsModel.SetName("testString") + importOfferingOptionsModel.SetLabel("testString") + importOfferingOptionsModel.SetInstallKind("testString") + importOfferingOptionsModel.SetTargetKinds([]string{"testString"}) + importOfferingOptionsModel.SetFormatKind("testString") + importOfferingOptionsModel.SetProductKind("testString") + importOfferingOptionsModel.SetSha("testString") + importOfferingOptionsModel.SetVersion("testString") + importOfferingOptionsModel.SetFlavor(flavorModel) + importOfferingOptionsModel.SetMetadata(importOfferingBodyMetadataModel) + importOfferingOptionsModel.SetWorkingDirectory("testString") importOfferingOptionsModel.SetZipurl("testString") importOfferingOptionsModel.SetOfferingID("testString") importOfferingOptionsModel.SetTargetVersion("testString") importOfferingOptionsModel.SetIncludeConfig(true) importOfferingOptionsModel.SetIsVsi(true) - importOfferingOptionsModel.SetRepoType("testString") + importOfferingOptionsModel.SetRepotype("testString") importOfferingOptionsModel.SetXAuthToken("testString") importOfferingOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(importOfferingOptionsModel).ToNot(BeNil()) Expect(importOfferingOptionsModel.CatalogIdentifier).To(Equal(core.StringPtr("testString"))) Expect(importOfferingOptionsModel.Tags).To(Equal([]string{"testString"})) - Expect(importOfferingOptionsModel.TargetKinds).To(Equal([]string{"testString"})) Expect(importOfferingOptionsModel.Content).To(Equal(CreateMockByteArray("This is a mock byte array value."))) + Expect(importOfferingOptionsModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(importOfferingOptionsModel.Label).To(Equal(core.StringPtr("testString"))) + Expect(importOfferingOptionsModel.InstallKind).To(Equal(core.StringPtr("testString"))) + Expect(importOfferingOptionsModel.TargetKinds).To(Equal([]string{"testString"})) + Expect(importOfferingOptionsModel.FormatKind).To(Equal(core.StringPtr("testString"))) + Expect(importOfferingOptionsModel.ProductKind).To(Equal(core.StringPtr("testString"))) + Expect(importOfferingOptionsModel.Sha).To(Equal(core.StringPtr("testString"))) + Expect(importOfferingOptionsModel.Version).To(Equal(core.StringPtr("testString"))) + Expect(importOfferingOptionsModel.Flavor).To(Equal(flavorModel)) + Expect(importOfferingOptionsModel.Metadata).To(Equal(importOfferingBodyMetadataModel)) + Expect(importOfferingOptionsModel.WorkingDirectory).To(Equal(core.StringPtr("testString"))) Expect(importOfferingOptionsModel.Zipurl).To(Equal(core.StringPtr("testString"))) Expect(importOfferingOptionsModel.OfferingID).To(Equal(core.StringPtr("testString"))) Expect(importOfferingOptionsModel.TargetVersion).To(Equal(core.StringPtr("testString"))) Expect(importOfferingOptionsModel.IncludeConfig).To(Equal(core.BoolPtr(true))) Expect(importOfferingOptionsModel.IsVsi).To(Equal(core.BoolPtr(true))) - Expect(importOfferingOptionsModel.RepoType).To(Equal(core.StringPtr("testString"))) + Expect(importOfferingOptionsModel.Repotype).To(Equal(core.StringPtr("testString"))) Expect(importOfferingOptionsModel.XAuthToken).To(Equal(core.StringPtr("testString"))) Expect(importOfferingOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewImportOfferingVersionOptions successfully`, func() { + // Construct an instance of the Flavor model + flavorModel := new(catalogmanagementv1.Flavor) + Expect(flavorModel).ToNot(BeNil()) + flavorModel.Name = core.StringPtr("testString") + flavorModel.Label = core.StringPtr("testString") + flavorModel.LabelI18n = make(map[string]string) + flavorModel.Index = core.Int64Ptr(int64(38)) + Expect(flavorModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(flavorModel.Label).To(Equal(core.StringPtr("testString"))) + Expect(flavorModel.LabelI18n).To(Equal(make(map[string]string))) + Expect(flavorModel.Index).To(Equal(core.Int64Ptr(int64(38)))) + + // Construct an instance of the ImportOfferingBodyMetadataOperatingSystem model + importOfferingBodyMetadataOperatingSystemModel := new(catalogmanagementv1.ImportOfferingBodyMetadataOperatingSystem) + Expect(importOfferingBodyMetadataOperatingSystemModel).ToNot(BeNil()) + importOfferingBodyMetadataOperatingSystemModel.DedicatedHostOnly = core.BoolPtr(true) + importOfferingBodyMetadataOperatingSystemModel.Vendor = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.Name = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.Href = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.DisplayName = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.Family = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.Version = core.StringPtr("testString") + importOfferingBodyMetadataOperatingSystemModel.Architecture = core.StringPtr("testString") + Expect(importOfferingBodyMetadataOperatingSystemModel.DedicatedHostOnly).To(Equal(core.BoolPtr(true))) + Expect(importOfferingBodyMetadataOperatingSystemModel.Vendor).To(Equal(core.StringPtr("testString"))) + Expect(importOfferingBodyMetadataOperatingSystemModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(importOfferingBodyMetadataOperatingSystemModel.Href).To(Equal(core.StringPtr("testString"))) + Expect(importOfferingBodyMetadataOperatingSystemModel.DisplayName).To(Equal(core.StringPtr("testString"))) + Expect(importOfferingBodyMetadataOperatingSystemModel.Family).To(Equal(core.StringPtr("testString"))) + Expect(importOfferingBodyMetadataOperatingSystemModel.Version).To(Equal(core.StringPtr("testString"))) + Expect(importOfferingBodyMetadataOperatingSystemModel.Architecture).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the ImportOfferingBodyMetadataFile model + importOfferingBodyMetadataFileModel := new(catalogmanagementv1.ImportOfferingBodyMetadataFile) + Expect(importOfferingBodyMetadataFileModel).ToNot(BeNil()) + importOfferingBodyMetadataFileModel.Size = core.Int64Ptr(int64(38)) + Expect(importOfferingBodyMetadataFileModel.Size).To(Equal(core.Int64Ptr(int64(38)))) + + // Construct an instance of the ImportOfferingBodyMetadataImagesItem model + importOfferingBodyMetadataImagesItemModel := new(catalogmanagementv1.ImportOfferingBodyMetadataImagesItem) + Expect(importOfferingBodyMetadataImagesItemModel).ToNot(BeNil()) + importOfferingBodyMetadataImagesItemModel.ID = core.StringPtr("testString") + importOfferingBodyMetadataImagesItemModel.Name = core.StringPtr("testString") + importOfferingBodyMetadataImagesItemModel.Region = core.StringPtr("testString") + Expect(importOfferingBodyMetadataImagesItemModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(importOfferingBodyMetadataImagesItemModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(importOfferingBodyMetadataImagesItemModel.Region).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the ImportOfferingBodyMetadata model + importOfferingBodyMetadataModel := new(catalogmanagementv1.ImportOfferingBodyMetadata) + Expect(importOfferingBodyMetadataModel).ToNot(BeNil()) + importOfferingBodyMetadataModel.OperatingSystem = importOfferingBodyMetadataOperatingSystemModel + importOfferingBodyMetadataModel.File = importOfferingBodyMetadataFileModel + importOfferingBodyMetadataModel.MinimumProvisionedSize = core.Int64Ptr(int64(38)) + importOfferingBodyMetadataModel.Images = []catalogmanagementv1.ImportOfferingBodyMetadataImagesItem{*importOfferingBodyMetadataImagesItemModel} + Expect(importOfferingBodyMetadataModel.OperatingSystem).To(Equal(importOfferingBodyMetadataOperatingSystemModel)) + Expect(importOfferingBodyMetadataModel.File).To(Equal(importOfferingBodyMetadataFileModel)) + Expect(importOfferingBodyMetadataModel.MinimumProvisionedSize).To(Equal(core.Int64Ptr(int64(38)))) + Expect(importOfferingBodyMetadataModel.Images).To(Equal([]catalogmanagementv1.ImportOfferingBodyMetadataImagesItem{*importOfferingBodyMetadataImagesItemModel})) + // Construct an instance of the ImportOfferingVersionOptions model catalogIdentifier := "testString" offeringID := "testString" @@ -18042,28 +26854,90 @@ var _ = Describe(`CatalogManagementV1`, func() { importOfferingVersionOptionsModel.SetCatalogIdentifier("testString") importOfferingVersionOptionsModel.SetOfferingID("testString") importOfferingVersionOptionsModel.SetTags([]string{"testString"}) - importOfferingVersionOptionsModel.SetTargetKinds([]string{"testString"}) importOfferingVersionOptionsModel.SetContent(*CreateMockByteArray("This is a mock byte array value.")) + importOfferingVersionOptionsModel.SetName("testString") + importOfferingVersionOptionsModel.SetLabel("testString") + importOfferingVersionOptionsModel.SetInstallKind("testString") + importOfferingVersionOptionsModel.SetTargetKinds([]string{"testString"}) + importOfferingVersionOptionsModel.SetFormatKind("testString") + importOfferingVersionOptionsModel.SetProductKind("testString") + importOfferingVersionOptionsModel.SetSha("testString") + importOfferingVersionOptionsModel.SetVersion("testString") + importOfferingVersionOptionsModel.SetFlavor(flavorModel) + importOfferingVersionOptionsModel.SetMetadata(importOfferingBodyMetadataModel) + importOfferingVersionOptionsModel.SetWorkingDirectory("testString") importOfferingVersionOptionsModel.SetZipurl("testString") importOfferingVersionOptionsModel.SetTargetVersion("testString") importOfferingVersionOptionsModel.SetIncludeConfig(true) importOfferingVersionOptionsModel.SetIsVsi(true) - importOfferingVersionOptionsModel.SetRepoType("testString") + importOfferingVersionOptionsModel.SetRepotype("testString") + importOfferingVersionOptionsModel.SetXAuthToken("testString") importOfferingVersionOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(importOfferingVersionOptionsModel).ToNot(BeNil()) Expect(importOfferingVersionOptionsModel.CatalogIdentifier).To(Equal(core.StringPtr("testString"))) Expect(importOfferingVersionOptionsModel.OfferingID).To(Equal(core.StringPtr("testString"))) Expect(importOfferingVersionOptionsModel.Tags).To(Equal([]string{"testString"})) - Expect(importOfferingVersionOptionsModel.TargetKinds).To(Equal([]string{"testString"})) Expect(importOfferingVersionOptionsModel.Content).To(Equal(CreateMockByteArray("This is a mock byte array value."))) + Expect(importOfferingVersionOptionsModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(importOfferingVersionOptionsModel.Label).To(Equal(core.StringPtr("testString"))) + Expect(importOfferingVersionOptionsModel.InstallKind).To(Equal(core.StringPtr("testString"))) + Expect(importOfferingVersionOptionsModel.TargetKinds).To(Equal([]string{"testString"})) + Expect(importOfferingVersionOptionsModel.FormatKind).To(Equal(core.StringPtr("testString"))) + Expect(importOfferingVersionOptionsModel.ProductKind).To(Equal(core.StringPtr("testString"))) + Expect(importOfferingVersionOptionsModel.Sha).To(Equal(core.StringPtr("testString"))) + Expect(importOfferingVersionOptionsModel.Version).To(Equal(core.StringPtr("testString"))) + Expect(importOfferingVersionOptionsModel.Flavor).To(Equal(flavorModel)) + Expect(importOfferingVersionOptionsModel.Metadata).To(Equal(importOfferingBodyMetadataModel)) + Expect(importOfferingVersionOptionsModel.WorkingDirectory).To(Equal(core.StringPtr("testString"))) Expect(importOfferingVersionOptionsModel.Zipurl).To(Equal(core.StringPtr("testString"))) Expect(importOfferingVersionOptionsModel.TargetVersion).To(Equal(core.StringPtr("testString"))) Expect(importOfferingVersionOptionsModel.IncludeConfig).To(Equal(core.BoolPtr(true))) Expect(importOfferingVersionOptionsModel.IsVsi).To(Equal(core.BoolPtr(true))) - Expect(importOfferingVersionOptionsModel.RepoType).To(Equal(core.StringPtr("testString"))) + Expect(importOfferingVersionOptionsModel.Repotype).To(Equal(core.StringPtr("testString"))) + Expect(importOfferingVersionOptionsModel.XAuthToken).To(Equal(core.StringPtr("testString"))) Expect(importOfferingVersionOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewInstallVersionOptions successfully`, func() { + // Construct an instance of the DeployRequestBodyOverrideValues model + deployRequestBodyOverrideValuesModel := new(catalogmanagementv1.DeployRequestBodyOverrideValues) + Expect(deployRequestBodyOverrideValuesModel).ToNot(BeNil()) + deployRequestBodyOverrideValuesModel.VsiInstanceName = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.VPCProfile = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.SubnetID = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.VPCID = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.SubnetZone = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.SSHKeyID = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.VPCRegion = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.SetProperty("foo", core.StringPtr("testString")) + Expect(deployRequestBodyOverrideValuesModel.VsiInstanceName).To(Equal(core.StringPtr("testString"))) + Expect(deployRequestBodyOverrideValuesModel.VPCProfile).To(Equal(core.StringPtr("testString"))) + Expect(deployRequestBodyOverrideValuesModel.SubnetID).To(Equal(core.StringPtr("testString"))) + Expect(deployRequestBodyOverrideValuesModel.VPCID).To(Equal(core.StringPtr("testString"))) + Expect(deployRequestBodyOverrideValuesModel.SubnetZone).To(Equal(core.StringPtr("testString"))) + Expect(deployRequestBodyOverrideValuesModel.SSHKeyID).To(Equal(core.StringPtr("testString"))) + Expect(deployRequestBodyOverrideValuesModel.VPCRegion).To(Equal(core.StringPtr("testString"))) + Expect(deployRequestBodyOverrideValuesModel.GetProperties()).ToNot(BeEmpty()) + Expect(deployRequestBodyOverrideValuesModel.GetProperty("foo")).To(Equal(core.StringPtr("testString"))) + + deployRequestBodyOverrideValuesModel.SetProperties(nil) + Expect(deployRequestBodyOverrideValuesModel.GetProperties()).To(BeEmpty()) + + deployRequestBodyOverrideValuesModelExpectedMap := make(map[string]interface{}) + deployRequestBodyOverrideValuesModelExpectedMap["foo"] = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.SetProperties(deployRequestBodyOverrideValuesModelExpectedMap) + deployRequestBodyOverrideValuesModelActualMap := deployRequestBodyOverrideValuesModel.GetProperties() + Expect(deployRequestBodyOverrideValuesModelActualMap).To(Equal(deployRequestBodyOverrideValuesModelExpectedMap)) + + // Construct an instance of the DeployRequestBodyEnvironmentVariablesItem model + deployRequestBodyEnvironmentVariablesItemModel := new(catalogmanagementv1.DeployRequestBodyEnvironmentVariablesItem) + Expect(deployRequestBodyEnvironmentVariablesItemModel).ToNot(BeNil()) + deployRequestBodyEnvironmentVariablesItemModel.Name = core.StringPtr("testString") + deployRequestBodyEnvironmentVariablesItemModel.Value = core.StringPtr("testString") + deployRequestBodyEnvironmentVariablesItemModel.Secure = core.BoolPtr(true) + Expect(deployRequestBodyEnvironmentVariablesItemModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(deployRequestBodyEnvironmentVariablesItemModel.Value).To(Equal(core.StringPtr("testString"))) + Expect(deployRequestBodyEnvironmentVariablesItemModel.Secure).To(Equal(core.BoolPtr(true))) + // Construct an instance of the DeployRequestBodySchematics model deployRequestBodySchematicsModel := new(catalogmanagementv1.DeployRequestBodySchematics) Expect(deployRequestBodySchematicsModel).ToNot(BeNil()) @@ -18071,10 +26945,14 @@ var _ = Describe(`CatalogManagementV1`, func() { deployRequestBodySchematicsModel.Description = core.StringPtr("testString") deployRequestBodySchematicsModel.Tags = []string{"testString"} deployRequestBodySchematicsModel.ResourceGroupID = core.StringPtr("testString") + deployRequestBodySchematicsModel.TerraformVersion = core.StringPtr("testString") + deployRequestBodySchematicsModel.Region = core.StringPtr("testString") Expect(deployRequestBodySchematicsModel.Name).To(Equal(core.StringPtr("testString"))) Expect(deployRequestBodySchematicsModel.Description).To(Equal(core.StringPtr("testString"))) Expect(deployRequestBodySchematicsModel.Tags).To(Equal([]string{"testString"})) Expect(deployRequestBodySchematicsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) + Expect(deployRequestBodySchematicsModel.TerraformVersion).To(Equal(core.StringPtr("testString"))) + Expect(deployRequestBodySchematicsModel.Region).To(Equal(core.StringPtr("testString"))) // Construct an instance of the InstallVersionOptions model versionLocID := "testString" @@ -18085,16 +26963,17 @@ var _ = Describe(`CatalogManagementV1`, func() { installVersionOptionsModel.SetClusterID("testString") installVersionOptionsModel.SetRegion("testString") installVersionOptionsModel.SetNamespace("testString") - installVersionOptionsModel.SetOverrideValues(make(map[string]interface{})) + installVersionOptionsModel.SetOverrideValues(deployRequestBodyOverrideValuesModel) + installVersionOptionsModel.SetEnvironmentVariables([]catalogmanagementv1.DeployRequestBodyEnvironmentVariablesItem{*deployRequestBodyEnvironmentVariablesItemModel}) installVersionOptionsModel.SetEntitlementApikey("testString") installVersionOptionsModel.SetSchematics(deployRequestBodySchematicsModel) installVersionOptionsModel.SetScript("testString") installVersionOptionsModel.SetScriptID("testString") installVersionOptionsModel.SetVersionLocatorID("testString") installVersionOptionsModel.SetVcenterID("testString") + installVersionOptionsModel.SetVcenterLocation("testString") installVersionOptionsModel.SetVcenterUser("testString") installVersionOptionsModel.SetVcenterPassword("testString") - installVersionOptionsModel.SetVcenterLocation("testString") installVersionOptionsModel.SetVcenterDatastore("testString") installVersionOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(installVersionOptionsModel).ToNot(BeNil()) @@ -18103,16 +26982,17 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(installVersionOptionsModel.ClusterID).To(Equal(core.StringPtr("testString"))) Expect(installVersionOptionsModel.Region).To(Equal(core.StringPtr("testString"))) Expect(installVersionOptionsModel.Namespace).To(Equal(core.StringPtr("testString"))) - Expect(installVersionOptionsModel.OverrideValues).To(Equal(make(map[string]interface{}))) + Expect(installVersionOptionsModel.OverrideValues).To(Equal(deployRequestBodyOverrideValuesModel)) + Expect(installVersionOptionsModel.EnvironmentVariables).To(Equal([]catalogmanagementv1.DeployRequestBodyEnvironmentVariablesItem{*deployRequestBodyEnvironmentVariablesItemModel})) Expect(installVersionOptionsModel.EntitlementApikey).To(Equal(core.StringPtr("testString"))) Expect(installVersionOptionsModel.Schematics).To(Equal(deployRequestBodySchematicsModel)) Expect(installVersionOptionsModel.Script).To(Equal(core.StringPtr("testString"))) Expect(installVersionOptionsModel.ScriptID).To(Equal(core.StringPtr("testString"))) Expect(installVersionOptionsModel.VersionLocatorID).To(Equal(core.StringPtr("testString"))) Expect(installVersionOptionsModel.VcenterID).To(Equal(core.StringPtr("testString"))) + Expect(installVersionOptionsModel.VcenterLocation).To(Equal(core.StringPtr("testString"))) Expect(installVersionOptionsModel.VcenterUser).To(Equal(core.StringPtr("testString"))) Expect(installVersionOptionsModel.VcenterPassword).To(Equal(core.StringPtr("testString"))) - Expect(installVersionOptionsModel.VcenterLocation).To(Equal(core.StringPtr("testString"))) Expect(installVersionOptionsModel.VcenterDatastore).To(Equal(core.StringPtr("testString"))) Expect(installVersionOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) @@ -18123,6 +27003,35 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) + It(`Invoke NewListCatalogAccountAuditsOptions successfully`, func() { + // Construct an instance of the ListCatalogAccountAuditsOptions model + listCatalogAccountAuditsOptionsModel := catalogManagementService.NewListCatalogAccountAuditsOptions() + listCatalogAccountAuditsOptionsModel.SetStart("testString") + listCatalogAccountAuditsOptionsModel.SetLimit(int64(10)) + listCatalogAccountAuditsOptionsModel.SetLookupnames(true) + listCatalogAccountAuditsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listCatalogAccountAuditsOptionsModel).ToNot(BeNil()) + Expect(listCatalogAccountAuditsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listCatalogAccountAuditsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) + Expect(listCatalogAccountAuditsOptionsModel.Lookupnames).To(Equal(core.BoolPtr(true))) + Expect(listCatalogAccountAuditsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListCatalogAuditsOptions successfully`, func() { + // Construct an instance of the ListCatalogAuditsOptions model + catalogIdentifier := "testString" + listCatalogAuditsOptionsModel := catalogManagementService.NewListCatalogAuditsOptions(catalogIdentifier) + listCatalogAuditsOptionsModel.SetCatalogIdentifier("testString") + listCatalogAuditsOptionsModel.SetStart("testString") + listCatalogAuditsOptionsModel.SetLimit(int64(10)) + listCatalogAuditsOptionsModel.SetLookupnames(true) + listCatalogAuditsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listCatalogAuditsOptionsModel).ToNot(BeNil()) + Expect(listCatalogAuditsOptionsModel.CatalogIdentifier).To(Equal(core.StringPtr("testString"))) + Expect(listCatalogAuditsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listCatalogAuditsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) + Expect(listCatalogAuditsOptionsModel.Lookupnames).To(Equal(core.BoolPtr(true))) + Expect(listCatalogAuditsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewListCatalogsOptions successfully`, func() { // Construct an instance of the ListCatalogsOptions model listCatalogsOptionsModel := catalogManagementService.NewListCatalogsOptions() @@ -18130,6 +27039,41 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(listCatalogsOptionsModel).ToNot(BeNil()) Expect(listCatalogsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewListEnterpriseAuditsOptions successfully`, func() { + // Construct an instance of the ListEnterpriseAuditsOptions model + enterpriseIdentifier := "testString" + listEnterpriseAuditsOptionsModel := catalogManagementService.NewListEnterpriseAuditsOptions(enterpriseIdentifier) + listEnterpriseAuditsOptionsModel.SetEnterpriseIdentifier("testString") + listEnterpriseAuditsOptionsModel.SetStart("testString") + listEnterpriseAuditsOptionsModel.SetLimit(int64(10)) + listEnterpriseAuditsOptionsModel.SetLookupnames(true) + listEnterpriseAuditsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listEnterpriseAuditsOptionsModel).ToNot(BeNil()) + Expect(listEnterpriseAuditsOptionsModel.EnterpriseIdentifier).To(Equal(core.StringPtr("testString"))) + Expect(listEnterpriseAuditsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listEnterpriseAuditsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) + Expect(listEnterpriseAuditsOptionsModel.Lookupnames).To(Equal(core.BoolPtr(true))) + Expect(listEnterpriseAuditsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListObjectAuditsOptions successfully`, func() { + // Construct an instance of the ListObjectAuditsOptions model + catalogIdentifier := "testString" + objectIdentifier := "testString" + listObjectAuditsOptionsModel := catalogManagementService.NewListObjectAuditsOptions(catalogIdentifier, objectIdentifier) + listObjectAuditsOptionsModel.SetCatalogIdentifier("testString") + listObjectAuditsOptionsModel.SetObjectIdentifier("testString") + listObjectAuditsOptionsModel.SetStart("testString") + listObjectAuditsOptionsModel.SetLimit(int64(10)) + listObjectAuditsOptionsModel.SetLookupnames(true) + listObjectAuditsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listObjectAuditsOptionsModel).ToNot(BeNil()) + Expect(listObjectAuditsOptionsModel.CatalogIdentifier).To(Equal(core.StringPtr("testString"))) + Expect(listObjectAuditsOptionsModel.ObjectIdentifier).To(Equal(core.StringPtr("testString"))) + Expect(listObjectAuditsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listObjectAuditsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) + Expect(listObjectAuditsOptionsModel.Lookupnames).To(Equal(core.BoolPtr(true))) + Expect(listObjectAuditsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewListObjectsOptions successfully`, func() { // Construct an instance of the ListObjectsOptions model catalogIdentifier := "testString" @@ -18148,6 +27092,41 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(listObjectsOptionsModel.Sort).To(Equal(core.StringPtr("testString"))) Expect(listObjectsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewListOfferingAuditsOptions successfully`, func() { + // Construct an instance of the ListOfferingAuditsOptions model + catalogIdentifier := "testString" + offeringID := "testString" + listOfferingAuditsOptionsModel := catalogManagementService.NewListOfferingAuditsOptions(catalogIdentifier, offeringID) + listOfferingAuditsOptionsModel.SetCatalogIdentifier("testString") + listOfferingAuditsOptionsModel.SetOfferingID("testString") + listOfferingAuditsOptionsModel.SetStart("testString") + listOfferingAuditsOptionsModel.SetLimit(int64(10)) + listOfferingAuditsOptionsModel.SetLookupnames(true) + listOfferingAuditsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listOfferingAuditsOptionsModel).ToNot(BeNil()) + Expect(listOfferingAuditsOptionsModel.CatalogIdentifier).To(Equal(core.StringPtr("testString"))) + Expect(listOfferingAuditsOptionsModel.OfferingID).To(Equal(core.StringPtr("testString"))) + Expect(listOfferingAuditsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listOfferingAuditsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) + Expect(listOfferingAuditsOptionsModel.Lookupnames).To(Equal(core.BoolPtr(true))) + Expect(listOfferingAuditsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListOfferingInstanceAuditsOptions successfully`, func() { + // Construct an instance of the ListOfferingInstanceAuditsOptions model + instanceIdentifier := "testString" + listOfferingInstanceAuditsOptionsModel := catalogManagementService.NewListOfferingInstanceAuditsOptions(instanceIdentifier) + listOfferingInstanceAuditsOptionsModel.SetInstanceIdentifier("testString") + listOfferingInstanceAuditsOptionsModel.SetStart("testString") + listOfferingInstanceAuditsOptionsModel.SetLimit(int64(10)) + listOfferingInstanceAuditsOptionsModel.SetLookupnames(true) + listOfferingInstanceAuditsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listOfferingInstanceAuditsOptionsModel).ToNot(BeNil()) + Expect(listOfferingInstanceAuditsOptionsModel.InstanceIdentifier).To(Equal(core.StringPtr("testString"))) + Expect(listOfferingInstanceAuditsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listOfferingInstanceAuditsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) + Expect(listOfferingInstanceAuditsOptionsModel.Lookupnames).To(Equal(core.BoolPtr(true))) + Expect(listOfferingInstanceAuditsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewListOfferingsOptions successfully`, func() { // Construct an instance of the ListOfferingsOptions model catalogIdentifier := "testString" @@ -18158,6 +27137,7 @@ var _ = Describe(`CatalogManagementV1`, func() { listOfferingsOptionsModel.SetOffset(int64(38)) listOfferingsOptionsModel.SetName("testString") listOfferingsOptionsModel.SetSort("testString") + listOfferingsOptionsModel.SetIncludeHidden(true) listOfferingsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(listOfferingsOptionsModel).ToNot(BeNil()) Expect(listOfferingsOptionsModel.CatalogIdentifier).To(Equal(core.StringPtr("testString"))) @@ -18166,6 +27146,7 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(listOfferingsOptionsModel.Offset).To(Equal(core.Int64Ptr(int64(38)))) Expect(listOfferingsOptionsModel.Name).To(Equal(core.StringPtr("testString"))) Expect(listOfferingsOptionsModel.Sort).To(Equal(core.StringPtr("testString"))) + Expect(listOfferingsOptionsModel.IncludeHidden).To(Equal(core.BoolPtr(true))) Expect(listOfferingsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewListOperatorsOptions successfully`, func() { @@ -18187,430 +27168,47 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(listOperatorsOptionsModel.VersionLocatorID).To(Equal(core.StringPtr("testString"))) Expect(listOperatorsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) - It(`Invoke NewOfferingPatch successfully`, func() { - // Construct an instance of the Rating model - ratingModel := new(catalogmanagementv1.Rating) - ratingModel.OneStarCount = core.Int64Ptr(int64(38)) - ratingModel.TwoStarCount = core.Int64Ptr(int64(38)) - ratingModel.ThreeStarCount = core.Int64Ptr(int64(38)) - ratingModel.FourStarCount = core.Int64Ptr(int64(38)) - - // Construct an instance of the Feature model - featureModel := new(catalogmanagementv1.Feature) - featureModel.Title = core.StringPtr("testString") - featureModel.Description = core.StringPtr("testString") - - // Construct an instance of the Configuration model - configurationModel := new(catalogmanagementv1.Configuration) - configurationModel.Key = core.StringPtr("testString") - configurationModel.Type = core.StringPtr("testString") - configurationModel.DefaultValue = core.StringPtr("testString") - configurationModel.ValueConstraint = core.StringPtr("testString") - configurationModel.Description = core.StringPtr("testString") - configurationModel.Required = core.BoolPtr(true) - configurationModel.Options = []interface{}{"testString"} - configurationModel.Hidden = core.BoolPtr(true) - - // Construct an instance of the Validation model - validationModel := new(catalogmanagementv1.Validation) - validationModel.Validated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - validationModel.Requested = CreateMockDateTime("2019-01-01T12:00:00.000Z") - validationModel.State = core.StringPtr("testString") - validationModel.LastOperation = core.StringPtr("testString") - validationModel.Target = make(map[string]interface{}) - - // Construct an instance of the Resource model - resourceModel := new(catalogmanagementv1.Resource) - resourceModel.Type = core.StringPtr("mem") - resourceModel.Value = core.StringPtr("testString") - - // Construct an instance of the Script model - scriptModel := new(catalogmanagementv1.Script) - scriptModel.Instructions = core.StringPtr("testString") - scriptModel.Script = core.StringPtr("testString") - scriptModel.ScriptPermission = core.StringPtr("testString") - scriptModel.DeleteScript = core.StringPtr("testString") - scriptModel.Scope = core.StringPtr("testString") - - // Construct an instance of the VersionEntitlement model - versionEntitlementModel := new(catalogmanagementv1.VersionEntitlement) - versionEntitlementModel.ProviderName = core.StringPtr("testString") - versionEntitlementModel.ProviderID = core.StringPtr("testString") - versionEntitlementModel.ProductID = core.StringPtr("testString") - versionEntitlementModel.PartNumbers = []string{"testString"} - versionEntitlementModel.ImageRepoName = core.StringPtr("testString") - - // Construct an instance of the License model - licenseModel := new(catalogmanagementv1.License) - licenseModel.ID = core.StringPtr("testString") - licenseModel.Name = core.StringPtr("testString") - licenseModel.Type = core.StringPtr("testString") - licenseModel.URL = core.StringPtr("testString") - licenseModel.Description = core.StringPtr("testString") - - // Construct an instance of the State model - stateModel := new(catalogmanagementv1.State) - stateModel.Current = core.StringPtr("testString") - stateModel.CurrentEntered = CreateMockDateTime("2019-01-01T12:00:00.000Z") - stateModel.Pending = core.StringPtr("testString") - stateModel.PendingRequested = CreateMockDateTime("2019-01-01T12:00:00.000Z") - stateModel.Previous = core.StringPtr("testString") - - // Construct an instance of the Version model - versionModel := new(catalogmanagementv1.Version) - versionModel.ID = core.StringPtr("testString") - versionModel.Rev = core.StringPtr("testString") - versionModel.CRN = core.StringPtr("testString") - versionModel.Version = core.StringPtr("testString") - versionModel.Sha = core.StringPtr("testString") - versionModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") - versionModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - versionModel.OfferingID = core.StringPtr("testString") - versionModel.CatalogID = core.StringPtr("testString") - versionModel.KindID = core.StringPtr("testString") - versionModel.Tags = []string{"testString"} - versionModel.RepoURL = core.StringPtr("testString") - versionModel.SourceURL = core.StringPtr("testString") - versionModel.TgzURL = core.StringPtr("testString") - versionModel.Configuration = []catalogmanagementv1.Configuration{*configurationModel} - versionModel.Metadata = make(map[string]interface{}) - versionModel.Validation = validationModel - versionModel.RequiredResources = []catalogmanagementv1.Resource{*resourceModel} - versionModel.SingleInstance = core.BoolPtr(true) - versionModel.Install = scriptModel - versionModel.PreInstall = []catalogmanagementv1.Script{*scriptModel} - versionModel.Entitlement = versionEntitlementModel - versionModel.Licenses = []catalogmanagementv1.License{*licenseModel} - versionModel.ImageManifestURL = core.StringPtr("testString") - versionModel.Deprecated = core.BoolPtr(true) - versionModel.PackageVersion = core.StringPtr("testString") - versionModel.State = stateModel - versionModel.VersionLocator = core.StringPtr("testString") - versionModel.ConsoleURL = core.StringPtr("testString") - versionModel.LongDescription = core.StringPtr("testString") - versionModel.WhitelistedAccounts = []string{"testString"} - - // Construct an instance of the Deployment model - deploymentModel := new(catalogmanagementv1.Deployment) - deploymentModel.ID = core.StringPtr("testString") - deploymentModel.Label = core.StringPtr("testString") - deploymentModel.Name = core.StringPtr("testString") - deploymentModel.ShortDescription = core.StringPtr("testString") - deploymentModel.LongDescription = core.StringPtr("testString") - deploymentModel.Metadata = make(map[string]interface{}) - deploymentModel.Tags = []string{"testString"} - deploymentModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") - deploymentModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - - // Construct an instance of the Plan model - planModel := new(catalogmanagementv1.Plan) - planModel.ID = core.StringPtr("testString") - planModel.Label = core.StringPtr("testString") - planModel.Name = core.StringPtr("testString") - planModel.ShortDescription = core.StringPtr("testString") - planModel.LongDescription = core.StringPtr("testString") - planModel.Metadata = make(map[string]interface{}) - planModel.Tags = []string{"testString"} - planModel.AdditionalFeatures = []catalogmanagementv1.Feature{*featureModel} - planModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") - planModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - planModel.Deployments = []catalogmanagementv1.Deployment{*deploymentModel} - - // Construct an instance of the Kind model - kindModel := new(catalogmanagementv1.Kind) - kindModel.ID = core.StringPtr("testString") - kindModel.FormatKind = core.StringPtr("testString") - kindModel.TargetKind = core.StringPtr("testString") - kindModel.Metadata = make(map[string]interface{}) - kindModel.InstallDescription = core.StringPtr("testString") - kindModel.Tags = []string{"testString"} - kindModel.AdditionalFeatures = []catalogmanagementv1.Feature{*featureModel} - kindModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") - kindModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - kindModel.Versions = []catalogmanagementv1.Version{*versionModel} - kindModel.Plans = []catalogmanagementv1.Plan{*planModel} - - // Construct an instance of the ProviderInfo model - providerInfoModel := new(catalogmanagementv1.ProviderInfo) - providerInfoModel.ID = core.StringPtr("testString") - providerInfoModel.Name = core.StringPtr("testString") - - // Construct an instance of the RepoInfo model - repoInfoModel := new(catalogmanagementv1.RepoInfo) - repoInfoModel.Token = core.StringPtr("testString") - repoInfoModel.Type = core.StringPtr("testString") - - // Construct an instance of the Support model - supportModel := new(catalogmanagementv1.Support) - supportModel.URL = core.StringPtr("testString") - supportModel.Process = core.StringPtr("testString") - supportModel.Locations = []string{"testString"} - - // Construct an instance of the MediaItem model - mediaItemModel := new(catalogmanagementv1.MediaItem) - mediaItemModel.URL = core.StringPtr("testString") - mediaItemModel.Caption = core.StringPtr("testString") - mediaItemModel.Type = core.StringPtr("testString") - mediaItemModel.ThumbnailURL = core.StringPtr("testString") - - // Construct an instance of the Offering model - offering := new(catalogmanagementv1.Offering) - offering.ID = core.StringPtr("testString") - offering.Rev = core.StringPtr("testString") - offering.URL = core.StringPtr("testString") - offering.CRN = core.StringPtr("testString") - offering.Label = core.StringPtr("testString") - offering.Name = core.StringPtr("testString") - offering.OfferingIconURL = core.StringPtr("testString") - offering.OfferingDocsURL = core.StringPtr("testString") - offering.OfferingSupportURL = core.StringPtr("testString") - offering.Tags = []string{"testString"} - offering.Keywords = []string{"testString"} - offering.Rating = ratingModel - offering.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") - offering.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") - offering.ShortDescription = core.StringPtr("testString") - offering.LongDescription = core.StringPtr("testString") - offering.Features = []catalogmanagementv1.Feature{*featureModel} - offering.Kinds = []catalogmanagementv1.Kind{*kindModel} - offering.PermitRequestIBMPublicPublish = core.BoolPtr(true) - offering.IBMPublishApproved = core.BoolPtr(true) - offering.PublicPublishApproved = core.BoolPtr(true) - offering.PublicOriginalCRN = core.StringPtr("testString") - offering.PublishPublicCRN = core.StringPtr("testString") - offering.PortalApprovalRecord = core.StringPtr("testString") - offering.PortalUIURL = core.StringPtr("testString") - offering.CatalogID = core.StringPtr("testString") - offering.CatalogName = core.StringPtr("testString") - offering.Metadata = make(map[string]interface{}) - offering.Disclaimer = core.StringPtr("testString") - offering.Hidden = core.BoolPtr(true) - offering.Provider = core.StringPtr("testString") - offering.ProviderInfo = providerInfoModel - offering.RepoInfo = repoInfoModel - offering.Support = supportModel - offering.Media = []catalogmanagementv1.MediaItem{*mediaItemModel} - - offeringPatch := catalogManagementService.NewOfferingPatch(offering) - Expect(offeringPatch).ToNot(BeNil()) - - _path := func(op interface{}) string { - return *op.(catalogmanagementv1.JSONPatchOperation).Path - } - Expect(offeringPatch).To(MatchAllElements(_path, Elements{ - "/id": MatchAllFields(Fields{ - "Op": PointTo(Equal(catalogmanagementv1.JSONPatchOperationOpAddConst)), - "Path": PointTo(Equal("/id")), - "From": BeNil(), - "Value": Equal(offering.ID), - }), - "/_rev": MatchAllFields(Fields{ - "Op": PointTo(Equal(catalogmanagementv1.JSONPatchOperationOpAddConst)), - "Path": PointTo(Equal("/_rev")), - "From": BeNil(), - "Value": Equal(offering.Rev), - }), - "/url": MatchAllFields(Fields{ - "Op": PointTo(Equal(catalogmanagementv1.JSONPatchOperationOpAddConst)), - "Path": PointTo(Equal("/url")), - "From": BeNil(), - "Value": Equal(offering.URL), - }), - "/crn": MatchAllFields(Fields{ - "Op": PointTo(Equal(catalogmanagementv1.JSONPatchOperationOpAddConst)), - "Path": PointTo(Equal("/crn")), - "From": BeNil(), - "Value": Equal(offering.CRN), - }), - "/label": MatchAllFields(Fields{ - "Op": PointTo(Equal(catalogmanagementv1.JSONPatchOperationOpAddConst)), - "Path": PointTo(Equal("/label")), - "From": BeNil(), - "Value": Equal(offering.Label), - }), - "/name": MatchAllFields(Fields{ - "Op": PointTo(Equal(catalogmanagementv1.JSONPatchOperationOpAddConst)), - "Path": PointTo(Equal("/name")), - "From": BeNil(), - "Value": Equal(offering.Name), - }), - "/offering_icon_url": MatchAllFields(Fields{ - "Op": PointTo(Equal(catalogmanagementv1.JSONPatchOperationOpAddConst)), - "Path": PointTo(Equal("/offering_icon_url")), - "From": BeNil(), - "Value": Equal(offering.OfferingIconURL), - }), - "/offering_docs_url": MatchAllFields(Fields{ - "Op": PointTo(Equal(catalogmanagementv1.JSONPatchOperationOpAddConst)), - "Path": PointTo(Equal("/offering_docs_url")), - "From": BeNil(), - "Value": Equal(offering.OfferingDocsURL), - }), - "/offering_support_url": MatchAllFields(Fields{ - "Op": PointTo(Equal(catalogmanagementv1.JSONPatchOperationOpAddConst)), - "Path": PointTo(Equal("/offering_support_url")), - "From": BeNil(), - "Value": Equal(offering.OfferingSupportURL), - }), - "/tags": MatchAllFields(Fields{ - "Op": PointTo(Equal(catalogmanagementv1.JSONPatchOperationOpAddConst)), - "Path": PointTo(Equal("/tags")), - "From": BeNil(), - "Value": Equal(offering.Tags), - }), - "/keywords": MatchAllFields(Fields{ - "Op": PointTo(Equal(catalogmanagementv1.JSONPatchOperationOpAddConst)), - "Path": PointTo(Equal("/keywords")), - "From": BeNil(), - "Value": Equal(offering.Keywords), - }), - "/rating": MatchAllFields(Fields{ - "Op": PointTo(Equal(catalogmanagementv1.JSONPatchOperationOpAddConst)), - "Path": PointTo(Equal("/rating")), - "From": BeNil(), - "Value": Equal(offering.Rating), - }), - "/created": MatchAllFields(Fields{ - "Op": PointTo(Equal(catalogmanagementv1.JSONPatchOperationOpAddConst)), - "Path": PointTo(Equal("/created")), - "From": BeNil(), - "Value": Equal(offering.Created), - }), - "/updated": MatchAllFields(Fields{ - "Op": PointTo(Equal(catalogmanagementv1.JSONPatchOperationOpAddConst)), - "Path": PointTo(Equal("/updated")), - "From": BeNil(), - "Value": Equal(offering.Updated), - }), - "/short_description": MatchAllFields(Fields{ - "Op": PointTo(Equal(catalogmanagementv1.JSONPatchOperationOpAddConst)), - "Path": PointTo(Equal("/short_description")), - "From": BeNil(), - "Value": Equal(offering.ShortDescription), - }), - "/long_description": MatchAllFields(Fields{ - "Op": PointTo(Equal(catalogmanagementv1.JSONPatchOperationOpAddConst)), - "Path": PointTo(Equal("/long_description")), - "From": BeNil(), - "Value": Equal(offering.LongDescription), - }), - "/features": MatchAllFields(Fields{ - "Op": PointTo(Equal(catalogmanagementv1.JSONPatchOperationOpAddConst)), - "Path": PointTo(Equal("/features")), - "From": BeNil(), - "Value": Equal(offering.Features), - }), - "/kinds": MatchAllFields(Fields{ - "Op": PointTo(Equal(catalogmanagementv1.JSONPatchOperationOpAddConst)), - "Path": PointTo(Equal("/kinds")), - "From": BeNil(), - "Value": Equal(offering.Kinds), - }), - "/permit_request_ibm_public_publish": MatchAllFields(Fields{ - "Op": PointTo(Equal(catalogmanagementv1.JSONPatchOperationOpAddConst)), - "Path": PointTo(Equal("/permit_request_ibm_public_publish")), - "From": BeNil(), - "Value": Equal(offering.PermitRequestIBMPublicPublish), - }), - "/ibm_publish_approved": MatchAllFields(Fields{ - "Op": PointTo(Equal(catalogmanagementv1.JSONPatchOperationOpAddConst)), - "Path": PointTo(Equal("/ibm_publish_approved")), - "From": BeNil(), - "Value": Equal(offering.IBMPublishApproved), - }), - "/public_publish_approved": MatchAllFields(Fields{ - "Op": PointTo(Equal(catalogmanagementv1.JSONPatchOperationOpAddConst)), - "Path": PointTo(Equal("/public_publish_approved")), - "From": BeNil(), - "Value": Equal(offering.PublicPublishApproved), - }), - "/public_original_crn": MatchAllFields(Fields{ - "Op": PointTo(Equal(catalogmanagementv1.JSONPatchOperationOpAddConst)), - "Path": PointTo(Equal("/public_original_crn")), - "From": BeNil(), - "Value": Equal(offering.PublicOriginalCRN), - }), - "/publish_public_crn": MatchAllFields(Fields{ - "Op": PointTo(Equal(catalogmanagementv1.JSONPatchOperationOpAddConst)), - "Path": PointTo(Equal("/publish_public_crn")), - "From": BeNil(), - "Value": Equal(offering.PublishPublicCRN), - }), - "/portal_approval_record": MatchAllFields(Fields{ - "Op": PointTo(Equal(catalogmanagementv1.JSONPatchOperationOpAddConst)), - "Path": PointTo(Equal("/portal_approval_record")), - "From": BeNil(), - "Value": Equal(offering.PortalApprovalRecord), - }), - "/portal_ui_url": MatchAllFields(Fields{ - "Op": PointTo(Equal(catalogmanagementv1.JSONPatchOperationOpAddConst)), - "Path": PointTo(Equal("/portal_ui_url")), - "From": BeNil(), - "Value": Equal(offering.PortalUIURL), - }), - "/catalog_id": MatchAllFields(Fields{ - "Op": PointTo(Equal(catalogmanagementv1.JSONPatchOperationOpAddConst)), - "Path": PointTo(Equal("/catalog_id")), - "From": BeNil(), - "Value": Equal(offering.CatalogID), - }), - "/catalog_name": MatchAllFields(Fields{ - "Op": PointTo(Equal(catalogmanagementv1.JSONPatchOperationOpAddConst)), - "Path": PointTo(Equal("/catalog_name")), - "From": BeNil(), - "Value": Equal(offering.CatalogName), - }), - "/metadata": MatchAllFields(Fields{ - "Op": PointTo(Equal(catalogmanagementv1.JSONPatchOperationOpAddConst)), - "Path": PointTo(Equal("/metadata")), - "From": BeNil(), - "Value": Equal(offering.Metadata), - }), - "/disclaimer": MatchAllFields(Fields{ - "Op": PointTo(Equal(catalogmanagementv1.JSONPatchOperationOpAddConst)), - "Path": PointTo(Equal("/disclaimer")), - "From": BeNil(), - "Value": Equal(offering.Disclaimer), - }), - "/hidden": MatchAllFields(Fields{ - "Op": PointTo(Equal(catalogmanagementv1.JSONPatchOperationOpAddConst)), - "Path": PointTo(Equal("/hidden")), - "From": BeNil(), - "Value": Equal(offering.Hidden), - }), - "/provider": MatchAllFields(Fields{ - "Op": PointTo(Equal(catalogmanagementv1.JSONPatchOperationOpAddConst)), - "Path": PointTo(Equal("/provider")), - "From": BeNil(), - "Value": Equal(offering.Provider), - }), - "/provider_info": MatchAllFields(Fields{ - "Op": PointTo(Equal(catalogmanagementv1.JSONPatchOperationOpAddConst)), - "Path": PointTo(Equal("/provider_info")), - "From": BeNil(), - "Value": Equal(offering.ProviderInfo), - }), - "/repo_info": MatchAllFields(Fields{ - "Op": PointTo(Equal(catalogmanagementv1.JSONPatchOperationOpAddConst)), - "Path": PointTo(Equal("/repo_info")), - "From": BeNil(), - "Value": Equal(offering.RepoInfo), - }), - "/support": MatchAllFields(Fields{ - "Op": PointTo(Equal(catalogmanagementv1.JSONPatchOperationOpAddConst)), - "Path": PointTo(Equal("/support")), - "From": BeNil(), - "Value": Equal(offering.Support), - }), - "/media": MatchAllFields(Fields{ - "Op": PointTo(Equal(catalogmanagementv1.JSONPatchOperationOpAddConst)), - "Path": PointTo(Equal("/media")), - "From": BeNil(), - "Value": Equal(offering.Media), - }), - })) - }) It(`Invoke NewPreinstallVersionOptions successfully`, func() { + // Construct an instance of the DeployRequestBodyOverrideValues model + deployRequestBodyOverrideValuesModel := new(catalogmanagementv1.DeployRequestBodyOverrideValues) + Expect(deployRequestBodyOverrideValuesModel).ToNot(BeNil()) + deployRequestBodyOverrideValuesModel.VsiInstanceName = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.VPCProfile = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.SubnetID = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.VPCID = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.SubnetZone = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.SSHKeyID = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.VPCRegion = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.SetProperty("foo", core.StringPtr("testString")) + Expect(deployRequestBodyOverrideValuesModel.VsiInstanceName).To(Equal(core.StringPtr("testString"))) + Expect(deployRequestBodyOverrideValuesModel.VPCProfile).To(Equal(core.StringPtr("testString"))) + Expect(deployRequestBodyOverrideValuesModel.SubnetID).To(Equal(core.StringPtr("testString"))) + Expect(deployRequestBodyOverrideValuesModel.VPCID).To(Equal(core.StringPtr("testString"))) + Expect(deployRequestBodyOverrideValuesModel.SubnetZone).To(Equal(core.StringPtr("testString"))) + Expect(deployRequestBodyOverrideValuesModel.SSHKeyID).To(Equal(core.StringPtr("testString"))) + Expect(deployRequestBodyOverrideValuesModel.VPCRegion).To(Equal(core.StringPtr("testString"))) + Expect(deployRequestBodyOverrideValuesModel.GetProperties()).ToNot(BeEmpty()) + Expect(deployRequestBodyOverrideValuesModel.GetProperty("foo")).To(Equal(core.StringPtr("testString"))) + + deployRequestBodyOverrideValuesModel.SetProperties(nil) + Expect(deployRequestBodyOverrideValuesModel.GetProperties()).To(BeEmpty()) + + deployRequestBodyOverrideValuesModelExpectedMap := make(map[string]interface{}) + deployRequestBodyOverrideValuesModelExpectedMap["foo"] = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.SetProperties(deployRequestBodyOverrideValuesModelExpectedMap) + deployRequestBodyOverrideValuesModelActualMap := deployRequestBodyOverrideValuesModel.GetProperties() + Expect(deployRequestBodyOverrideValuesModelActualMap).To(Equal(deployRequestBodyOverrideValuesModelExpectedMap)) + + // Construct an instance of the DeployRequestBodyEnvironmentVariablesItem model + deployRequestBodyEnvironmentVariablesItemModel := new(catalogmanagementv1.DeployRequestBodyEnvironmentVariablesItem) + Expect(deployRequestBodyEnvironmentVariablesItemModel).ToNot(BeNil()) + deployRequestBodyEnvironmentVariablesItemModel.Name = core.StringPtr("testString") + deployRequestBodyEnvironmentVariablesItemModel.Value = core.StringPtr("testString") + deployRequestBodyEnvironmentVariablesItemModel.Secure = core.BoolPtr(true) + Expect(deployRequestBodyEnvironmentVariablesItemModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(deployRequestBodyEnvironmentVariablesItemModel.Value).To(Equal(core.StringPtr("testString"))) + Expect(deployRequestBodyEnvironmentVariablesItemModel.Secure).To(Equal(core.BoolPtr(true))) + // Construct an instance of the DeployRequestBodySchematics model deployRequestBodySchematicsModel := new(catalogmanagementv1.DeployRequestBodySchematics) Expect(deployRequestBodySchematicsModel).ToNot(BeNil()) @@ -18618,10 +27216,14 @@ var _ = Describe(`CatalogManagementV1`, func() { deployRequestBodySchematicsModel.Description = core.StringPtr("testString") deployRequestBodySchematicsModel.Tags = []string{"testString"} deployRequestBodySchematicsModel.ResourceGroupID = core.StringPtr("testString") + deployRequestBodySchematicsModel.TerraformVersion = core.StringPtr("testString") + deployRequestBodySchematicsModel.Region = core.StringPtr("testString") Expect(deployRequestBodySchematicsModel.Name).To(Equal(core.StringPtr("testString"))) Expect(deployRequestBodySchematicsModel.Description).To(Equal(core.StringPtr("testString"))) Expect(deployRequestBodySchematicsModel.Tags).To(Equal([]string{"testString"})) Expect(deployRequestBodySchematicsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) + Expect(deployRequestBodySchematicsModel.TerraformVersion).To(Equal(core.StringPtr("testString"))) + Expect(deployRequestBodySchematicsModel.Region).To(Equal(core.StringPtr("testString"))) // Construct an instance of the PreinstallVersionOptions model versionLocID := "testString" @@ -18632,16 +27234,17 @@ var _ = Describe(`CatalogManagementV1`, func() { preinstallVersionOptionsModel.SetClusterID("testString") preinstallVersionOptionsModel.SetRegion("testString") preinstallVersionOptionsModel.SetNamespace("testString") - preinstallVersionOptionsModel.SetOverrideValues(make(map[string]interface{})) + preinstallVersionOptionsModel.SetOverrideValues(deployRequestBodyOverrideValuesModel) + preinstallVersionOptionsModel.SetEnvironmentVariables([]catalogmanagementv1.DeployRequestBodyEnvironmentVariablesItem{*deployRequestBodyEnvironmentVariablesItemModel}) preinstallVersionOptionsModel.SetEntitlementApikey("testString") preinstallVersionOptionsModel.SetSchematics(deployRequestBodySchematicsModel) preinstallVersionOptionsModel.SetScript("testString") preinstallVersionOptionsModel.SetScriptID("testString") preinstallVersionOptionsModel.SetVersionLocatorID("testString") preinstallVersionOptionsModel.SetVcenterID("testString") + preinstallVersionOptionsModel.SetVcenterLocation("testString") preinstallVersionOptionsModel.SetVcenterUser("testString") preinstallVersionOptionsModel.SetVcenterPassword("testString") - preinstallVersionOptionsModel.SetVcenterLocation("testString") preinstallVersionOptionsModel.SetVcenterDatastore("testString") preinstallVersionOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(preinstallVersionOptionsModel).ToNot(BeNil()) @@ -18650,16 +27253,17 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(preinstallVersionOptionsModel.ClusterID).To(Equal(core.StringPtr("testString"))) Expect(preinstallVersionOptionsModel.Region).To(Equal(core.StringPtr("testString"))) Expect(preinstallVersionOptionsModel.Namespace).To(Equal(core.StringPtr("testString"))) - Expect(preinstallVersionOptionsModel.OverrideValues).To(Equal(make(map[string]interface{}))) + Expect(preinstallVersionOptionsModel.OverrideValues).To(Equal(deployRequestBodyOverrideValuesModel)) + Expect(preinstallVersionOptionsModel.EnvironmentVariables).To(Equal([]catalogmanagementv1.DeployRequestBodyEnvironmentVariablesItem{*deployRequestBodyEnvironmentVariablesItemModel})) Expect(preinstallVersionOptionsModel.EntitlementApikey).To(Equal(core.StringPtr("testString"))) Expect(preinstallVersionOptionsModel.Schematics).To(Equal(deployRequestBodySchematicsModel)) Expect(preinstallVersionOptionsModel.Script).To(Equal(core.StringPtr("testString"))) Expect(preinstallVersionOptionsModel.ScriptID).To(Equal(core.StringPtr("testString"))) Expect(preinstallVersionOptionsModel.VersionLocatorID).To(Equal(core.StringPtr("testString"))) Expect(preinstallVersionOptionsModel.VcenterID).To(Equal(core.StringPtr("testString"))) + Expect(preinstallVersionOptionsModel.VcenterLocation).To(Equal(core.StringPtr("testString"))) Expect(preinstallVersionOptionsModel.VcenterUser).To(Equal(core.StringPtr("testString"))) Expect(preinstallVersionOptionsModel.VcenterPassword).To(Equal(core.StringPtr("testString"))) - Expect(preinstallVersionOptionsModel.VcenterLocation).To(Equal(core.StringPtr("testString"))) Expect(preinstallVersionOptionsModel.VcenterDatastore).To(Equal(core.StringPtr("testString"))) Expect(preinstallVersionOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) @@ -18694,12 +27298,14 @@ var _ = Describe(`CatalogManagementV1`, func() { offeringInstanceLastOperationModel.State = core.StringPtr("testString") offeringInstanceLastOperationModel.Message = core.StringPtr("testString") offeringInstanceLastOperationModel.TransactionID = core.StringPtr("testString") - offeringInstanceLastOperationModel.Updated = core.StringPtr("testString") + offeringInstanceLastOperationModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + offeringInstanceLastOperationModel.Code = core.StringPtr("testString") Expect(offeringInstanceLastOperationModel.Operation).To(Equal(core.StringPtr("testString"))) Expect(offeringInstanceLastOperationModel.State).To(Equal(core.StringPtr("testString"))) Expect(offeringInstanceLastOperationModel.Message).To(Equal(core.StringPtr("testString"))) Expect(offeringInstanceLastOperationModel.TransactionID).To(Equal(core.StringPtr("testString"))) - Expect(offeringInstanceLastOperationModel.Updated).To(Equal(core.StringPtr("testString"))) + Expect(offeringInstanceLastOperationModel.Updated).To(Equal(CreateMockDateTime("2019-01-01T12:00:00.000Z"))) + Expect(offeringInstanceLastOperationModel.Code).To(Equal(core.StringPtr("testString"))) // Construct an instance of the PutOfferingInstanceOptions model instanceIdentifier := "testString" @@ -18716,16 +27322,24 @@ var _ = Describe(`CatalogManagementV1`, func() { putOfferingInstanceOptionsModel.SetOfferingID("testString") putOfferingInstanceOptionsModel.SetKindFormat("testString") putOfferingInstanceOptionsModel.SetVersion("testString") + putOfferingInstanceOptionsModel.SetVersionID("testString") putOfferingInstanceOptionsModel.SetClusterID("testString") putOfferingInstanceOptionsModel.SetClusterRegion("testString") putOfferingInstanceOptionsModel.SetClusterNamespaces([]string{"testString"}) putOfferingInstanceOptionsModel.SetClusterAllNamespaces(true) putOfferingInstanceOptionsModel.SetSchematicsWorkspaceID("testString") - putOfferingInstanceOptionsModel.SetResourceGroupID("testString") putOfferingInstanceOptionsModel.SetInstallPlan("testString") putOfferingInstanceOptionsModel.SetChannel("testString") + putOfferingInstanceOptionsModel.SetCreated(CreateMockDateTime("2019-01-01T12:00:00.000Z")) + putOfferingInstanceOptionsModel.SetUpdated(CreateMockDateTime("2019-01-01T12:00:00.000Z")) putOfferingInstanceOptionsModel.SetMetadata(make(map[string]interface{})) + putOfferingInstanceOptionsModel.SetResourceGroupID("testString") + putOfferingInstanceOptionsModel.SetLocation("testString") + putOfferingInstanceOptionsModel.SetDisabled(true) + putOfferingInstanceOptionsModel.SetAccount("testString") putOfferingInstanceOptionsModel.SetLastOperation(offeringInstanceLastOperationModel) + putOfferingInstanceOptionsModel.SetKindTarget("testString") + putOfferingInstanceOptionsModel.SetSha("testString") putOfferingInstanceOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(putOfferingInstanceOptionsModel).ToNot(BeNil()) Expect(putOfferingInstanceOptionsModel.InstanceIdentifier).To(Equal(core.StringPtr("testString"))) @@ -18739,19 +27353,39 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(putOfferingInstanceOptionsModel.OfferingID).To(Equal(core.StringPtr("testString"))) Expect(putOfferingInstanceOptionsModel.KindFormat).To(Equal(core.StringPtr("testString"))) Expect(putOfferingInstanceOptionsModel.Version).To(Equal(core.StringPtr("testString"))) + Expect(putOfferingInstanceOptionsModel.VersionID).To(Equal(core.StringPtr("testString"))) Expect(putOfferingInstanceOptionsModel.ClusterID).To(Equal(core.StringPtr("testString"))) Expect(putOfferingInstanceOptionsModel.ClusterRegion).To(Equal(core.StringPtr("testString"))) Expect(putOfferingInstanceOptionsModel.ClusterNamespaces).To(Equal([]string{"testString"})) Expect(putOfferingInstanceOptionsModel.ClusterAllNamespaces).To(Equal(core.BoolPtr(true))) Expect(putOfferingInstanceOptionsModel.SchematicsWorkspaceID).To(Equal(core.StringPtr("testString"))) - Expect(putOfferingInstanceOptionsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) Expect(putOfferingInstanceOptionsModel.InstallPlan).To(Equal(core.StringPtr("testString"))) Expect(putOfferingInstanceOptionsModel.Channel).To(Equal(core.StringPtr("testString"))) + Expect(putOfferingInstanceOptionsModel.Created).To(Equal(CreateMockDateTime("2019-01-01T12:00:00.000Z"))) + Expect(putOfferingInstanceOptionsModel.Updated).To(Equal(CreateMockDateTime("2019-01-01T12:00:00.000Z"))) Expect(putOfferingInstanceOptionsModel.Metadata).To(Equal(make(map[string]interface{}))) + Expect(putOfferingInstanceOptionsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) + Expect(putOfferingInstanceOptionsModel.Location).To(Equal(core.StringPtr("testString"))) + Expect(putOfferingInstanceOptionsModel.Disabled).To(Equal(core.BoolPtr(true))) + Expect(putOfferingInstanceOptionsModel.Account).To(Equal(core.StringPtr("testString"))) Expect(putOfferingInstanceOptionsModel.LastOperation).To(Equal(offeringInstanceLastOperationModel)) + Expect(putOfferingInstanceOptionsModel.KindTarget).To(Equal(core.StringPtr("testString"))) + Expect(putOfferingInstanceOptionsModel.Sha).To(Equal(core.StringPtr("testString"))) Expect(putOfferingInstanceOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewReloadOfferingOptions successfully`, func() { + // Construct an instance of the Flavor model + flavorModel := new(catalogmanagementv1.Flavor) + Expect(flavorModel).ToNot(BeNil()) + flavorModel.Name = core.StringPtr("testString") + flavorModel.Label = core.StringPtr("testString") + flavorModel.LabelI18n = make(map[string]string) + flavorModel.Index = core.Int64Ptr(int64(38)) + Expect(flavorModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(flavorModel.Label).To(Equal(core.StringPtr("testString"))) + Expect(flavorModel.LabelI18n).To(Equal(make(map[string]string))) + Expect(flavorModel.Index).To(Equal(core.Int64Ptr(int64(38)))) + // Construct an instance of the ReloadOfferingOptions model catalogIdentifier := "testString" offeringID := "testString" @@ -18761,8 +27395,11 @@ var _ = Describe(`CatalogManagementV1`, func() { reloadOfferingOptionsModel.SetOfferingID("testString") reloadOfferingOptionsModel.SetTargetVersion("testString") reloadOfferingOptionsModel.SetTags([]string{"testString"}) - reloadOfferingOptionsModel.SetTargetKinds([]string{"testString"}) reloadOfferingOptionsModel.SetContent(*CreateMockByteArray("This is a mock byte array value.")) + reloadOfferingOptionsModel.SetTargetKinds([]string{"testString"}) + reloadOfferingOptionsModel.SetFormatKind("testString") + reloadOfferingOptionsModel.SetFlavor(flavorModel) + reloadOfferingOptionsModel.SetWorkingDirectory("testString") reloadOfferingOptionsModel.SetZipurl("testString") reloadOfferingOptionsModel.SetRepoType("testString") reloadOfferingOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) @@ -18771,8 +27408,11 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(reloadOfferingOptionsModel.OfferingID).To(Equal(core.StringPtr("testString"))) Expect(reloadOfferingOptionsModel.TargetVersion).To(Equal(core.StringPtr("testString"))) Expect(reloadOfferingOptionsModel.Tags).To(Equal([]string{"testString"})) - Expect(reloadOfferingOptionsModel.TargetKinds).To(Equal([]string{"testString"})) Expect(reloadOfferingOptionsModel.Content).To(Equal(CreateMockByteArray("This is a mock byte array value."))) + Expect(reloadOfferingOptionsModel.TargetKinds).To(Equal([]string{"testString"})) + Expect(reloadOfferingOptionsModel.FormatKind).To(Equal(core.StringPtr("testString"))) + Expect(reloadOfferingOptionsModel.Flavor).To(Equal(flavorModel)) + Expect(reloadOfferingOptionsModel.WorkingDirectory).To(Equal(core.StringPtr("testString"))) Expect(reloadOfferingOptionsModel.Zipurl).To(Equal(core.StringPtr("testString"))) Expect(reloadOfferingOptionsModel.RepoType).To(Equal(core.StringPtr("testString"))) Expect(reloadOfferingOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) @@ -18782,9 +27422,13 @@ var _ = Describe(`CatalogManagementV1`, func() { featureModel := new(catalogmanagementv1.Feature) Expect(featureModel).ToNot(BeNil()) featureModel.Title = core.StringPtr("testString") + featureModel.TitleI18n = make(map[string]string) featureModel.Description = core.StringPtr("testString") + featureModel.DescriptionI18n = make(map[string]string) Expect(featureModel.Title).To(Equal(core.StringPtr("testString"))) + Expect(featureModel.TitleI18n).To(Equal(make(map[string]string))) Expect(featureModel.Description).To(Equal(core.StringPtr("testString"))) + Expect(featureModel.DescriptionI18n).To(Equal(make(map[string]string))) // Construct an instance of the FilterTerms model filterTermsModel := new(catalogmanagementv1.FilterTerms) @@ -18874,7 +27518,9 @@ var _ = Describe(`CatalogManagementV1`, func() { replaceCatalogOptionsModel.SetID("testString") replaceCatalogOptionsModel.SetRev("testString") replaceCatalogOptionsModel.SetLabel("testString") + replaceCatalogOptionsModel.SetLabelI18n(make(map[string]string)) replaceCatalogOptionsModel.SetShortDescription("testString") + replaceCatalogOptionsModel.SetShortDescriptionI18n(make(map[string]string)) replaceCatalogOptionsModel.SetCatalogIconURL("testString") replaceCatalogOptionsModel.SetTags([]string{"testString"}) replaceCatalogOptionsModel.SetFeatures([]catalogmanagementv1.Feature{*featureModel}) @@ -18884,13 +27530,16 @@ var _ = Describe(`CatalogManagementV1`, func() { replaceCatalogOptionsModel.SetCatalogFilters(filtersModel) replaceCatalogOptionsModel.SetSyndicationSettings(syndicationResourceModel) replaceCatalogOptionsModel.SetKind("testString") + replaceCatalogOptionsModel.SetMetadata(make(map[string]interface{})) replaceCatalogOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(replaceCatalogOptionsModel).ToNot(BeNil()) Expect(replaceCatalogOptionsModel.CatalogIdentifier).To(Equal(core.StringPtr("testString"))) Expect(replaceCatalogOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(replaceCatalogOptionsModel.Rev).To(Equal(core.StringPtr("testString"))) Expect(replaceCatalogOptionsModel.Label).To(Equal(core.StringPtr("testString"))) + Expect(replaceCatalogOptionsModel.LabelI18n).To(Equal(make(map[string]string))) Expect(replaceCatalogOptionsModel.ShortDescription).To(Equal(core.StringPtr("testString"))) + Expect(replaceCatalogOptionsModel.ShortDescriptionI18n).To(Equal(make(map[string]string))) Expect(replaceCatalogOptionsModel.CatalogIconURL).To(Equal(core.StringPtr("testString"))) Expect(replaceCatalogOptionsModel.Tags).To(Equal([]string{"testString"})) Expect(replaceCatalogOptionsModel.Features).To(Equal([]catalogmanagementv1.Feature{*featureModel})) @@ -18900,6 +27549,7 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(replaceCatalogOptionsModel.CatalogFilters).To(Equal(filtersModel)) Expect(replaceCatalogOptionsModel.SyndicationSettings).To(Equal(syndicationResourceModel)) Expect(replaceCatalogOptionsModel.Kind).To(Equal(core.StringPtr("testString"))) + Expect(replaceCatalogOptionsModel.Metadata).To(Equal(make(map[string]interface{}))) Expect(replaceCatalogOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewReplaceObjectOptions successfully`, func() { @@ -18943,13 +27593,13 @@ var _ = Describe(`CatalogManagementV1`, func() { replaceObjectOptionsModel.SetCRN("testString") replaceObjectOptionsModel.SetURL("testString") replaceObjectOptionsModel.SetParentID("testString") - replaceObjectOptionsModel.SetLabelI18n("testString") + replaceObjectOptionsModel.SetLabelI18n(make(map[string]string)) replaceObjectOptionsModel.SetLabel("testString") replaceObjectOptionsModel.SetTags([]string{"testString"}) replaceObjectOptionsModel.SetCreated(CreateMockDateTime("2019-01-01T12:00:00.000Z")) replaceObjectOptionsModel.SetUpdated(CreateMockDateTime("2019-01-01T12:00:00.000Z")) replaceObjectOptionsModel.SetShortDescription("testString") - replaceObjectOptionsModel.SetShortDescriptionI18n("testString") + replaceObjectOptionsModel.SetShortDescriptionI18n(make(map[string]string)) replaceObjectOptionsModel.SetKind("testString") replaceObjectOptionsModel.SetPublish(publishObjectModel) replaceObjectOptionsModel.SetState(stateModel) @@ -18966,13 +27616,13 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(replaceObjectOptionsModel.CRN).To(Equal(core.StringPtr("testString"))) Expect(replaceObjectOptionsModel.URL).To(Equal(core.StringPtr("testString"))) Expect(replaceObjectOptionsModel.ParentID).To(Equal(core.StringPtr("testString"))) - Expect(replaceObjectOptionsModel.LabelI18n).To(Equal(core.StringPtr("testString"))) + Expect(replaceObjectOptionsModel.LabelI18n).To(Equal(make(map[string]string))) Expect(replaceObjectOptionsModel.Label).To(Equal(core.StringPtr("testString"))) Expect(replaceObjectOptionsModel.Tags).To(Equal([]string{"testString"})) Expect(replaceObjectOptionsModel.Created).To(Equal(CreateMockDateTime("2019-01-01T12:00:00.000Z"))) Expect(replaceObjectOptionsModel.Updated).To(Equal(CreateMockDateTime("2019-01-01T12:00:00.000Z"))) Expect(replaceObjectOptionsModel.ShortDescription).To(Equal(core.StringPtr("testString"))) - Expect(replaceObjectOptionsModel.ShortDescriptionI18n).To(Equal(core.StringPtr("testString"))) + Expect(replaceObjectOptionsModel.ShortDescriptionI18n).To(Equal(make(map[string]string))) Expect(replaceObjectOptionsModel.Kind).To(Equal(core.StringPtr("testString"))) Expect(replaceObjectOptionsModel.Publish).To(Equal(publishObjectModel)) Expect(replaceObjectOptionsModel.State).To(Equal(stateModel)) @@ -18981,22 +27631,6 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(replaceObjectOptionsModel.Data).To(Equal(make(map[string]interface{}))) Expect(replaceObjectOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) - It(`Invoke NewReplaceOfferingIconOptions successfully`, func() { - // Construct an instance of the ReplaceOfferingIconOptions model - catalogIdentifier := "testString" - offeringID := "testString" - fileName := "testString" - replaceOfferingIconOptionsModel := catalogManagementService.NewReplaceOfferingIconOptions(catalogIdentifier, offeringID, fileName) - replaceOfferingIconOptionsModel.SetCatalogIdentifier("testString") - replaceOfferingIconOptionsModel.SetOfferingID("testString") - replaceOfferingIconOptionsModel.SetFileName("testString") - replaceOfferingIconOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(replaceOfferingIconOptionsModel).ToNot(BeNil()) - Expect(replaceOfferingIconOptionsModel.CatalogIdentifier).To(Equal(core.StringPtr("testString"))) - Expect(replaceOfferingIconOptionsModel.OfferingID).To(Equal(core.StringPtr("testString"))) - Expect(replaceOfferingIconOptionsModel.FileName).To(Equal(core.StringPtr("testString"))) - Expect(replaceOfferingIconOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) It(`Invoke NewReplaceOfferingOptions successfully`, func() { // Construct an instance of the Rating model ratingModel := new(catalogmanagementv1.Rating) @@ -19014,9 +27648,55 @@ var _ = Describe(`CatalogManagementV1`, func() { featureModel := new(catalogmanagementv1.Feature) Expect(featureModel).ToNot(BeNil()) featureModel.Title = core.StringPtr("testString") + featureModel.TitleI18n = make(map[string]string) featureModel.Description = core.StringPtr("testString") + featureModel.DescriptionI18n = make(map[string]string) Expect(featureModel.Title).To(Equal(core.StringPtr("testString"))) + Expect(featureModel.TitleI18n).To(Equal(make(map[string]string))) Expect(featureModel.Description).To(Equal(core.StringPtr("testString"))) + Expect(featureModel.DescriptionI18n).To(Equal(make(map[string]string))) + + // Construct an instance of the Flavor model + flavorModel := new(catalogmanagementv1.Flavor) + Expect(flavorModel).ToNot(BeNil()) + flavorModel.Name = core.StringPtr("testString") + flavorModel.Label = core.StringPtr("testString") + flavorModel.LabelI18n = make(map[string]string) + flavorModel.Index = core.Int64Ptr(int64(38)) + Expect(flavorModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(flavorModel.Label).To(Equal(core.StringPtr("testString"))) + Expect(flavorModel.LabelI18n).To(Equal(make(map[string]string))) + Expect(flavorModel.Index).To(Equal(core.Int64Ptr(int64(38)))) + + // Construct an instance of the RenderTypeAssociationsParametersItem model + renderTypeAssociationsParametersItemModel := new(catalogmanagementv1.RenderTypeAssociationsParametersItem) + Expect(renderTypeAssociationsParametersItemModel).ToNot(BeNil()) + renderTypeAssociationsParametersItemModel.Name = core.StringPtr("testString") + renderTypeAssociationsParametersItemModel.OptionsRefresh = core.BoolPtr(true) + Expect(renderTypeAssociationsParametersItemModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(renderTypeAssociationsParametersItemModel.OptionsRefresh).To(Equal(core.BoolPtr(true))) + + // Construct an instance of the RenderTypeAssociations model + renderTypeAssociationsModel := new(catalogmanagementv1.RenderTypeAssociations) + Expect(renderTypeAssociationsModel).ToNot(BeNil()) + renderTypeAssociationsModel.Parameters = []catalogmanagementv1.RenderTypeAssociationsParametersItem{*renderTypeAssociationsParametersItemModel} + Expect(renderTypeAssociationsModel.Parameters).To(Equal([]catalogmanagementv1.RenderTypeAssociationsParametersItem{*renderTypeAssociationsParametersItemModel})) + + // Construct an instance of the RenderType model + renderTypeModel := new(catalogmanagementv1.RenderType) + Expect(renderTypeModel).ToNot(BeNil()) + renderTypeModel.Type = core.StringPtr("testString") + renderTypeModel.Grouping = core.StringPtr("testString") + renderTypeModel.OriginalGrouping = core.StringPtr("testString") + renderTypeModel.GroupingIndex = core.Int64Ptr(int64(38)) + renderTypeModel.ConfigConstraints = map[string]interface{}{"anyKey": "anyValue"} + renderTypeModel.Associations = renderTypeAssociationsModel + Expect(renderTypeModel.Type).To(Equal(core.StringPtr("testString"))) + Expect(renderTypeModel.Grouping).To(Equal(core.StringPtr("testString"))) + Expect(renderTypeModel.OriginalGrouping).To(Equal(core.StringPtr("testString"))) + Expect(renderTypeModel.GroupingIndex).To(Equal(core.Int64Ptr(int64(38)))) + Expect(renderTypeModel.ConfigConstraints).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) + Expect(renderTypeModel.Associations).To(Equal(renderTypeAssociationsModel)) // Construct an instance of the Configuration model configurationModel := new(catalogmanagementv1.Configuration) @@ -19024,19 +27704,53 @@ var _ = Describe(`CatalogManagementV1`, func() { configurationModel.Key = core.StringPtr("testString") configurationModel.Type = core.StringPtr("testString") configurationModel.DefaultValue = core.StringPtr("testString") + configurationModel.DisplayName = core.StringPtr("testString") configurationModel.ValueConstraint = core.StringPtr("testString") configurationModel.Description = core.StringPtr("testString") configurationModel.Required = core.BoolPtr(true) configurationModel.Options = []interface{}{"testString"} configurationModel.Hidden = core.BoolPtr(true) + configurationModel.CustomConfig = renderTypeModel + configurationModel.TypeMetadata = core.StringPtr("testString") Expect(configurationModel.Key).To(Equal(core.StringPtr("testString"))) Expect(configurationModel.Type).To(Equal(core.StringPtr("testString"))) Expect(configurationModel.DefaultValue).To(Equal(core.StringPtr("testString"))) + Expect(configurationModel.DisplayName).To(Equal(core.StringPtr("testString"))) Expect(configurationModel.ValueConstraint).To(Equal(core.StringPtr("testString"))) Expect(configurationModel.Description).To(Equal(core.StringPtr("testString"))) Expect(configurationModel.Required).To(Equal(core.BoolPtr(true))) Expect(configurationModel.Options).To(Equal([]interface{}{"testString"})) Expect(configurationModel.Hidden).To(Equal(core.BoolPtr(true))) + Expect(configurationModel.CustomConfig).To(Equal(renderTypeModel)) + Expect(configurationModel.TypeMetadata).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the Output model + outputModel := new(catalogmanagementv1.Output) + Expect(outputModel).ToNot(BeNil()) + outputModel.Key = core.StringPtr("testString") + outputModel.Description = core.StringPtr("testString") + Expect(outputModel.Key).To(Equal(core.StringPtr("testString"))) + Expect(outputModel.Description).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the IamResource model + iamResourceModel := new(catalogmanagementv1.IamResource) + Expect(iamResourceModel).ToNot(BeNil()) + iamResourceModel.Name = core.StringPtr("testString") + iamResourceModel.Description = core.StringPtr("testString") + iamResourceModel.RoleCrns = []string{"testString"} + Expect(iamResourceModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(iamResourceModel.Description).To(Equal(core.StringPtr("testString"))) + Expect(iamResourceModel.RoleCrns).To(Equal([]string{"testString"})) + + // Construct an instance of the IamPermission model + iamPermissionModel := new(catalogmanagementv1.IamPermission) + Expect(iamPermissionModel).ToNot(BeNil()) + iamPermissionModel.ServiceName = core.StringPtr("testString") + iamPermissionModel.RoleCrns = []string{"testString"} + iamPermissionModel.Resources = []catalogmanagementv1.IamResource{*iamResourceModel} + Expect(iamPermissionModel.ServiceName).To(Equal(core.StringPtr("testString"))) + Expect(iamPermissionModel.RoleCrns).To(Equal([]string{"testString"})) + Expect(iamPermissionModel.Resources).To(Equal([]catalogmanagementv1.IamResource{*iamResourceModel})) // Construct an instance of the Validation model validationModel := new(catalogmanagementv1.Validation) @@ -19046,11 +27760,13 @@ var _ = Describe(`CatalogManagementV1`, func() { validationModel.State = core.StringPtr("testString") validationModel.LastOperation = core.StringPtr("testString") validationModel.Target = make(map[string]interface{}) + validationModel.Message = core.StringPtr("testString") Expect(validationModel.Validated).To(Equal(CreateMockDateTime("2019-01-01T12:00:00.000Z"))) Expect(validationModel.Requested).To(Equal(CreateMockDateTime("2019-01-01T12:00:00.000Z"))) Expect(validationModel.State).To(Equal(core.StringPtr("testString"))) Expect(validationModel.LastOperation).To(Equal(core.StringPtr("testString"))) Expect(validationModel.Target).To(Equal(make(map[string]interface{}))) + Expect(validationModel.Message).To(Equal(core.StringPtr("testString"))) // Construct an instance of the Resource model resourceModel := new(catalogmanagementv1.Resource) @@ -19064,11 +27780,13 @@ var _ = Describe(`CatalogManagementV1`, func() { scriptModel := new(catalogmanagementv1.Script) Expect(scriptModel).ToNot(BeNil()) scriptModel.Instructions = core.StringPtr("testString") + scriptModel.InstructionsI18n = make(map[string]string) scriptModel.Script = core.StringPtr("testString") scriptModel.ScriptPermission = core.StringPtr("testString") scriptModel.DeleteScript = core.StringPtr("testString") scriptModel.Scope = core.StringPtr("testString") Expect(scriptModel.Instructions).To(Equal(core.StringPtr("testString"))) + Expect(scriptModel.InstructionsI18n).To(Equal(make(map[string]string))) Expect(scriptModel.Script).To(Equal(core.StringPtr("testString"))) Expect(scriptModel.ScriptPermission).To(Equal(core.StringPtr("testString"))) Expect(scriptModel.DeleteScript).To(Equal(core.StringPtr("testString"))) @@ -19116,6 +27834,180 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(stateModel.PendingRequested).To(Equal(CreateMockDateTime("2019-01-01T12:00:00.000Z"))) Expect(stateModel.Previous).To(Equal(core.StringPtr("testString"))) + // Construct an instance of the DeprecatePending model + deprecatePendingModel := new(catalogmanagementv1.DeprecatePending) + Expect(deprecatePendingModel).ToNot(BeNil()) + deprecatePendingModel.DeprecateDate = CreateMockDateTime("2019-01-01T12:00:00.000Z") + deprecatePendingModel.DeprecateState = core.StringPtr("testString") + deprecatePendingModel.Description = core.StringPtr("testString") + Expect(deprecatePendingModel.DeprecateDate).To(Equal(CreateMockDateTime("2019-01-01T12:00:00.000Z"))) + Expect(deprecatePendingModel.DeprecateState).To(Equal(core.StringPtr("testString"))) + Expect(deprecatePendingModel.Description).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the URLProxy model + urlProxyModel := new(catalogmanagementv1.URLProxy) + Expect(urlProxyModel).ToNot(BeNil()) + urlProxyModel.URL = core.StringPtr("testString") + urlProxyModel.Sha = core.StringPtr("testString") + Expect(urlProxyModel.URL).To(Equal(core.StringPtr("testString"))) + Expect(urlProxyModel.Sha).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the MediaItem model + mediaItemModel := new(catalogmanagementv1.MediaItem) + Expect(mediaItemModel).ToNot(BeNil()) + mediaItemModel.URL = core.StringPtr("testString") + mediaItemModel.APIURL = core.StringPtr("testString") + mediaItemModel.URLProxy = urlProxyModel + mediaItemModel.Caption = core.StringPtr("testString") + mediaItemModel.CaptionI18n = make(map[string]string) + mediaItemModel.Type = core.StringPtr("testString") + mediaItemModel.ThumbnailURL = core.StringPtr("testString") + Expect(mediaItemModel.URL).To(Equal(core.StringPtr("testString"))) + Expect(mediaItemModel.APIURL).To(Equal(core.StringPtr("testString"))) + Expect(mediaItemModel.URLProxy).To(Equal(urlProxyModel)) + Expect(mediaItemModel.Caption).To(Equal(core.StringPtr("testString"))) + Expect(mediaItemModel.CaptionI18n).To(Equal(make(map[string]string))) + Expect(mediaItemModel.Type).To(Equal(core.StringPtr("testString"))) + Expect(mediaItemModel.ThumbnailURL).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the ArchitectureDiagram model + architectureDiagramModel := new(catalogmanagementv1.ArchitectureDiagram) + Expect(architectureDiagramModel).ToNot(BeNil()) + architectureDiagramModel.Diagram = mediaItemModel + architectureDiagramModel.Description = core.StringPtr("testString") + architectureDiagramModel.DescriptionI18n = make(map[string]string) + Expect(architectureDiagramModel.Diagram).To(Equal(mediaItemModel)) + Expect(architectureDiagramModel.Description).To(Equal(core.StringPtr("testString"))) + Expect(architectureDiagramModel.DescriptionI18n).To(Equal(make(map[string]string))) + + // Construct an instance of the CostComponent model + costComponentModel := new(catalogmanagementv1.CostComponent) + Expect(costComponentModel).ToNot(BeNil()) + costComponentModel.Name = core.StringPtr("testString") + costComponentModel.Unit = core.StringPtr("testString") + costComponentModel.HourlyQuantity = core.StringPtr("testString") + costComponentModel.MonthlyQuantity = core.StringPtr("testString") + costComponentModel.Price = core.StringPtr("testString") + costComponentModel.HourlyCost = core.StringPtr("testString") + costComponentModel.MonthlyCost = core.StringPtr("testString") + Expect(costComponentModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(costComponentModel.Unit).To(Equal(core.StringPtr("testString"))) + Expect(costComponentModel.HourlyQuantity).To(Equal(core.StringPtr("testString"))) + Expect(costComponentModel.MonthlyQuantity).To(Equal(core.StringPtr("testString"))) + Expect(costComponentModel.Price).To(Equal(core.StringPtr("testString"))) + Expect(costComponentModel.HourlyCost).To(Equal(core.StringPtr("testString"))) + Expect(costComponentModel.MonthlyCost).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the CostResource model + costResourceModel := new(catalogmanagementv1.CostResource) + Expect(costResourceModel).ToNot(BeNil()) + costResourceModel.Name = core.StringPtr("testString") + costResourceModel.Metadata = make(map[string]interface{}) + costResourceModel.HourlyCost = core.StringPtr("testString") + costResourceModel.MonthlyCost = core.StringPtr("testString") + costResourceModel.CostComponents = []catalogmanagementv1.CostComponent{*costComponentModel} + Expect(costResourceModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(costResourceModel.Metadata).To(Equal(make(map[string]interface{}))) + Expect(costResourceModel.HourlyCost).To(Equal(core.StringPtr("testString"))) + Expect(costResourceModel.MonthlyCost).To(Equal(core.StringPtr("testString"))) + Expect(costResourceModel.CostComponents).To(Equal([]catalogmanagementv1.CostComponent{*costComponentModel})) + + // Construct an instance of the CostBreakdown model + costBreakdownModel := new(catalogmanagementv1.CostBreakdown) + Expect(costBreakdownModel).ToNot(BeNil()) + costBreakdownModel.TotalHourlyCost = core.StringPtr("testString") + costBreakdownModel.TotalMonthlyCOst = core.StringPtr("testString") + costBreakdownModel.Resources = []catalogmanagementv1.CostResource{*costResourceModel} + Expect(costBreakdownModel.TotalHourlyCost).To(Equal(core.StringPtr("testString"))) + Expect(costBreakdownModel.TotalMonthlyCOst).To(Equal(core.StringPtr("testString"))) + Expect(costBreakdownModel.Resources).To(Equal([]catalogmanagementv1.CostResource{*costResourceModel})) + + // Construct an instance of the CostSummary model + costSummaryModel := new(catalogmanagementv1.CostSummary) + Expect(costSummaryModel).ToNot(BeNil()) + costSummaryModel.TotalDetectedResources = core.Int64Ptr(int64(38)) + costSummaryModel.TotalSupportedResources = core.Int64Ptr(int64(38)) + costSummaryModel.TotalUnsupportedResources = core.Int64Ptr(int64(38)) + costSummaryModel.TotalUsageBasedResources = core.Int64Ptr(int64(38)) + costSummaryModel.TotalNoPriceResources = core.Int64Ptr(int64(38)) + costSummaryModel.UnsupportedResourceCounts = make(map[string]int64) + costSummaryModel.NoPriceResourceCounts = make(map[string]int64) + Expect(costSummaryModel.TotalDetectedResources).To(Equal(core.Int64Ptr(int64(38)))) + Expect(costSummaryModel.TotalSupportedResources).To(Equal(core.Int64Ptr(int64(38)))) + Expect(costSummaryModel.TotalUnsupportedResources).To(Equal(core.Int64Ptr(int64(38)))) + Expect(costSummaryModel.TotalUsageBasedResources).To(Equal(core.Int64Ptr(int64(38)))) + Expect(costSummaryModel.TotalNoPriceResources).To(Equal(core.Int64Ptr(int64(38)))) + Expect(costSummaryModel.UnsupportedResourceCounts).To(Equal(make(map[string]int64))) + Expect(costSummaryModel.NoPriceResourceCounts).To(Equal(make(map[string]int64))) + + // Construct an instance of the Project model + projectModel := new(catalogmanagementv1.Project) + Expect(projectModel).ToNot(BeNil()) + projectModel.Name = core.StringPtr("testString") + projectModel.Metadata = make(map[string]interface{}) + projectModel.PastBreakdown = costBreakdownModel + projectModel.Breakdown = costBreakdownModel + projectModel.Diff = costBreakdownModel + projectModel.Summary = costSummaryModel + Expect(projectModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(projectModel.Metadata).To(Equal(make(map[string]interface{}))) + Expect(projectModel.PastBreakdown).To(Equal(costBreakdownModel)) + Expect(projectModel.Breakdown).To(Equal(costBreakdownModel)) + Expect(projectModel.Diff).To(Equal(costBreakdownModel)) + Expect(projectModel.Summary).To(Equal(costSummaryModel)) + + // Construct an instance of the CostEstimate model + costEstimateModel := new(catalogmanagementv1.CostEstimate) + Expect(costEstimateModel).ToNot(BeNil()) + costEstimateModel.Version = core.StringPtr("testString") + costEstimateModel.Currency = core.StringPtr("testString") + costEstimateModel.Projects = []catalogmanagementv1.Project{*projectModel} + costEstimateModel.Summary = costSummaryModel + costEstimateModel.TotalHourlyCost = core.StringPtr("testString") + costEstimateModel.TotalMonthlyCost = core.StringPtr("testString") + costEstimateModel.PastTotalHourlyCost = core.StringPtr("testString") + costEstimateModel.PastTotalMonthlyCost = core.StringPtr("testString") + costEstimateModel.DiffTotalHourlyCost = core.StringPtr("testString") + costEstimateModel.DiffTotalMonthlyCost = core.StringPtr("testString") + costEstimateModel.TimeGenerated = CreateMockDateTime("2019-01-01T12:00:00.000Z") + Expect(costEstimateModel.Version).To(Equal(core.StringPtr("testString"))) + Expect(costEstimateModel.Currency).To(Equal(core.StringPtr("testString"))) + Expect(costEstimateModel.Projects).To(Equal([]catalogmanagementv1.Project{*projectModel})) + Expect(costEstimateModel.Summary).To(Equal(costSummaryModel)) + Expect(costEstimateModel.TotalHourlyCost).To(Equal(core.StringPtr("testString"))) + Expect(costEstimateModel.TotalMonthlyCost).To(Equal(core.StringPtr("testString"))) + Expect(costEstimateModel.PastTotalHourlyCost).To(Equal(core.StringPtr("testString"))) + Expect(costEstimateModel.PastTotalMonthlyCost).To(Equal(core.StringPtr("testString"))) + Expect(costEstimateModel.DiffTotalHourlyCost).To(Equal(core.StringPtr("testString"))) + Expect(costEstimateModel.DiffTotalMonthlyCost).To(Equal(core.StringPtr("testString"))) + Expect(costEstimateModel.TimeGenerated).To(Equal(CreateMockDateTime("2019-01-01T12:00:00.000Z"))) + + // Construct an instance of the Dependency model + dependencyModel := new(catalogmanagementv1.Dependency) + Expect(dependencyModel).ToNot(BeNil()) + dependencyModel.CatalogID = core.StringPtr("testString") + dependencyModel.ID = core.StringPtr("testString") + dependencyModel.Name = core.StringPtr("testString") + dependencyModel.Version = core.StringPtr("testString") + dependencyModel.Flavors = []string{"testString"} + Expect(dependencyModel.CatalogID).To(Equal(core.StringPtr("testString"))) + Expect(dependencyModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(dependencyModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(dependencyModel.Version).To(Equal(core.StringPtr("testString"))) + Expect(dependencyModel.Flavors).To(Equal([]string{"testString"})) + + // Construct an instance of the SolutionInfo model + solutionInfoModel := new(catalogmanagementv1.SolutionInfo) + Expect(solutionInfoModel).ToNot(BeNil()) + solutionInfoModel.ArchitectureDiagrams = []catalogmanagementv1.ArchitectureDiagram{*architectureDiagramModel} + solutionInfoModel.Features = []catalogmanagementv1.Feature{*featureModel} + solutionInfoModel.CostEstimate = costEstimateModel + solutionInfoModel.Dependencies = []catalogmanagementv1.Dependency{*dependencyModel} + Expect(solutionInfoModel.ArchitectureDiagrams).To(Equal([]catalogmanagementv1.ArchitectureDiagram{*architectureDiagramModel})) + Expect(solutionInfoModel.Features).To(Equal([]catalogmanagementv1.Feature{*featureModel})) + Expect(solutionInfoModel.CostEstimate).To(Equal(costEstimateModel)) + Expect(solutionInfoModel.Dependencies).To(Equal([]catalogmanagementv1.Dependency{*dependencyModel})) + // Construct an instance of the Version model versionModel := new(catalogmanagementv1.Version) Expect(versionModel).ToNot(BeNil()) @@ -19123,6 +28015,7 @@ var _ = Describe(`CatalogManagementV1`, func() { versionModel.Rev = core.StringPtr("testString") versionModel.CRN = core.StringPtr("testString") versionModel.Version = core.StringPtr("testString") + versionModel.Flavor = flavorModel versionModel.Sha = core.StringPtr("testString") versionModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") versionModel.Updated = CreateMockDateTime("2019-01-01T12:00:00.000Z") @@ -19134,6 +28027,8 @@ var _ = Describe(`CatalogManagementV1`, func() { versionModel.SourceURL = core.StringPtr("testString") versionModel.TgzURL = core.StringPtr("testString") versionModel.Configuration = []catalogmanagementv1.Configuration{*configurationModel} + versionModel.Outputs = []catalogmanagementv1.Output{*outputModel} + versionModel.IamPermissions = []catalogmanagementv1.IamPermission{*iamPermissionModel} versionModel.Metadata = make(map[string]interface{}) versionModel.Validation = validationModel versionModel.RequiredResources = []catalogmanagementv1.Resource{*resourceModel} @@ -19147,13 +28042,18 @@ var _ = Describe(`CatalogManagementV1`, func() { versionModel.PackageVersion = core.StringPtr("testString") versionModel.State = stateModel versionModel.VersionLocator = core.StringPtr("testString") - versionModel.ConsoleURL = core.StringPtr("testString") versionModel.LongDescription = core.StringPtr("testString") + versionModel.LongDescriptionI18n = make(map[string]string) versionModel.WhitelistedAccounts = []string{"testString"} + versionModel.ImagePullKeyName = core.StringPtr("testString") + versionModel.DeprecatePending = deprecatePendingModel + versionModel.SolutionInfo = solutionInfoModel + versionModel.IsConsumable = core.BoolPtr(true) Expect(versionModel.ID).To(Equal(core.StringPtr("testString"))) Expect(versionModel.Rev).To(Equal(core.StringPtr("testString"))) Expect(versionModel.CRN).To(Equal(core.StringPtr("testString"))) Expect(versionModel.Version).To(Equal(core.StringPtr("testString"))) + Expect(versionModel.Flavor).To(Equal(flavorModel)) Expect(versionModel.Sha).To(Equal(core.StringPtr("testString"))) Expect(versionModel.Created).To(Equal(CreateMockDateTime("2019-01-01T12:00:00.000Z"))) Expect(versionModel.Updated).To(Equal(CreateMockDateTime("2019-01-01T12:00:00.000Z"))) @@ -19165,6 +28065,8 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(versionModel.SourceURL).To(Equal(core.StringPtr("testString"))) Expect(versionModel.TgzURL).To(Equal(core.StringPtr("testString"))) Expect(versionModel.Configuration).To(Equal([]catalogmanagementv1.Configuration{*configurationModel})) + Expect(versionModel.Outputs).To(Equal([]catalogmanagementv1.Output{*outputModel})) + Expect(versionModel.IamPermissions).To(Equal([]catalogmanagementv1.IamPermission{*iamPermissionModel})) Expect(versionModel.Metadata).To(Equal(make(map[string]interface{}))) Expect(versionModel.Validation).To(Equal(validationModel)) Expect(versionModel.RequiredResources).To(Equal([]catalogmanagementv1.Resource{*resourceModel})) @@ -19178,9 +28080,13 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(versionModel.PackageVersion).To(Equal(core.StringPtr("testString"))) Expect(versionModel.State).To(Equal(stateModel)) Expect(versionModel.VersionLocator).To(Equal(core.StringPtr("testString"))) - Expect(versionModel.ConsoleURL).To(Equal(core.StringPtr("testString"))) Expect(versionModel.LongDescription).To(Equal(core.StringPtr("testString"))) + Expect(versionModel.LongDescriptionI18n).To(Equal(make(map[string]string))) Expect(versionModel.WhitelistedAccounts).To(Equal([]string{"testString"})) + Expect(versionModel.ImagePullKeyName).To(Equal(core.StringPtr("testString"))) + Expect(versionModel.DeprecatePending).To(Equal(deprecatePendingModel)) + Expect(versionModel.SolutionInfo).To(Equal(solutionInfoModel)) + Expect(versionModel.IsConsumable).To(Equal(core.BoolPtr(true))) // Construct an instance of the Deployment model deploymentModel := new(catalogmanagementv1.Deployment) @@ -19235,9 +28141,9 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(kindModel).ToNot(BeNil()) kindModel.ID = core.StringPtr("testString") kindModel.FormatKind = core.StringPtr("testString") + kindModel.InstallKind = core.StringPtr("testString") kindModel.TargetKind = core.StringPtr("testString") kindModel.Metadata = make(map[string]interface{}) - kindModel.InstallDescription = core.StringPtr("testString") kindModel.Tags = []string{"testString"} kindModel.AdditionalFeatures = []catalogmanagementv1.Feature{*featureModel} kindModel.Created = CreateMockDateTime("2019-01-01T12:00:00.000Z") @@ -19246,9 +28152,9 @@ var _ = Describe(`CatalogManagementV1`, func() { kindModel.Plans = []catalogmanagementv1.Plan{*planModel} Expect(kindModel.ID).To(Equal(core.StringPtr("testString"))) Expect(kindModel.FormatKind).To(Equal(core.StringPtr("testString"))) + Expect(kindModel.InstallKind).To(Equal(core.StringPtr("testString"))) Expect(kindModel.TargetKind).To(Equal(core.StringPtr("testString"))) Expect(kindModel.Metadata).To(Equal(make(map[string]interface{}))) - Expect(kindModel.InstallDescription).To(Equal(core.StringPtr("testString"))) Expect(kindModel.Tags).To(Equal([]string{"testString"})) Expect(kindModel.AdditionalFeatures).To(Equal([]catalogmanagementv1.Feature{*featureModel})) Expect(kindModel.Created).To(Equal(CreateMockDateTime("2019-01-01T12:00:00.000Z"))) @@ -19272,27 +28178,123 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(repoInfoModel.Token).To(Equal(core.StringPtr("testString"))) Expect(repoInfoModel.Type).To(Equal(core.StringPtr("testString"))) + // Construct an instance of the ImagePullKey model + imagePullKeyModel := new(catalogmanagementv1.ImagePullKey) + Expect(imagePullKeyModel).ToNot(BeNil()) + imagePullKeyModel.Name = core.StringPtr("testString") + imagePullKeyModel.Value = core.StringPtr("testString") + imagePullKeyModel.Description = core.StringPtr("testString") + Expect(imagePullKeyModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(imagePullKeyModel.Value).To(Equal(core.StringPtr("testString"))) + Expect(imagePullKeyModel.Description).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the SupportWaitTime model + supportWaitTimeModel := new(catalogmanagementv1.SupportWaitTime) + Expect(supportWaitTimeModel).ToNot(BeNil()) + supportWaitTimeModel.Value = core.Int64Ptr(int64(38)) + supportWaitTimeModel.Type = core.StringPtr("testString") + Expect(supportWaitTimeModel.Value).To(Equal(core.Int64Ptr(int64(38)))) + Expect(supportWaitTimeModel.Type).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the SupportTime model + supportTimeModel := new(catalogmanagementv1.SupportTime) + Expect(supportTimeModel).ToNot(BeNil()) + supportTimeModel.Day = core.Int64Ptr(int64(38)) + supportTimeModel.StartTime = core.StringPtr("testString") + supportTimeModel.EndTime = core.StringPtr("testString") + Expect(supportTimeModel.Day).To(Equal(core.Int64Ptr(int64(38)))) + Expect(supportTimeModel.StartTime).To(Equal(core.StringPtr("testString"))) + Expect(supportTimeModel.EndTime).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the SupportAvailability model + supportAvailabilityModel := new(catalogmanagementv1.SupportAvailability) + Expect(supportAvailabilityModel).ToNot(BeNil()) + supportAvailabilityModel.Times = []catalogmanagementv1.SupportTime{*supportTimeModel} + supportAvailabilityModel.Timezone = core.StringPtr("testString") + supportAvailabilityModel.AlwaysAvailable = core.BoolPtr(true) + Expect(supportAvailabilityModel.Times).To(Equal([]catalogmanagementv1.SupportTime{*supportTimeModel})) + Expect(supportAvailabilityModel.Timezone).To(Equal(core.StringPtr("testString"))) + Expect(supportAvailabilityModel.AlwaysAvailable).To(Equal(core.BoolPtr(true))) + + // Construct an instance of the SupportDetail model + supportDetailModel := new(catalogmanagementv1.SupportDetail) + Expect(supportDetailModel).ToNot(BeNil()) + supportDetailModel.Type = core.StringPtr("testString") + supportDetailModel.Contact = core.StringPtr("testString") + supportDetailModel.ResponseWaitTime = supportWaitTimeModel + supportDetailModel.Availability = supportAvailabilityModel + Expect(supportDetailModel.Type).To(Equal(core.StringPtr("testString"))) + Expect(supportDetailModel.Contact).To(Equal(core.StringPtr("testString"))) + Expect(supportDetailModel.ResponseWaitTime).To(Equal(supportWaitTimeModel)) + Expect(supportDetailModel.Availability).To(Equal(supportAvailabilityModel)) + + // Construct an instance of the SupportEscalation model + supportEscalationModel := new(catalogmanagementv1.SupportEscalation) + Expect(supportEscalationModel).ToNot(BeNil()) + supportEscalationModel.EscalationWaitTime = supportWaitTimeModel + supportEscalationModel.ResponseWaitTime = supportWaitTimeModel + supportEscalationModel.Contact = core.StringPtr("testString") + Expect(supportEscalationModel.EscalationWaitTime).To(Equal(supportWaitTimeModel)) + Expect(supportEscalationModel.ResponseWaitTime).To(Equal(supportWaitTimeModel)) + Expect(supportEscalationModel.Contact).To(Equal(core.StringPtr("testString"))) + // Construct an instance of the Support model supportModel := new(catalogmanagementv1.Support) Expect(supportModel).ToNot(BeNil()) supportModel.URL = core.StringPtr("testString") supportModel.Process = core.StringPtr("testString") + supportModel.ProcessI18n = make(map[string]string) supportModel.Locations = []string{"testString"} + supportModel.SupportDetails = []catalogmanagementv1.SupportDetail{*supportDetailModel} + supportModel.SupportEscalation = supportEscalationModel + supportModel.SupportType = core.StringPtr("testString") Expect(supportModel.URL).To(Equal(core.StringPtr("testString"))) Expect(supportModel.Process).To(Equal(core.StringPtr("testString"))) + Expect(supportModel.ProcessI18n).To(Equal(make(map[string]string))) Expect(supportModel.Locations).To(Equal([]string{"testString"})) - - // Construct an instance of the MediaItem model - mediaItemModel := new(catalogmanagementv1.MediaItem) - Expect(mediaItemModel).ToNot(BeNil()) - mediaItemModel.URL = core.StringPtr("testString") - mediaItemModel.Caption = core.StringPtr("testString") - mediaItemModel.Type = core.StringPtr("testString") - mediaItemModel.ThumbnailURL = core.StringPtr("testString") - Expect(mediaItemModel.URL).To(Equal(core.StringPtr("testString"))) - Expect(mediaItemModel.Caption).To(Equal(core.StringPtr("testString"))) - Expect(mediaItemModel.Type).To(Equal(core.StringPtr("testString"))) - Expect(mediaItemModel.ThumbnailURL).To(Equal(core.StringPtr("testString"))) + Expect(supportModel.SupportDetails).To(Equal([]catalogmanagementv1.SupportDetail{*supportDetailModel})) + Expect(supportModel.SupportEscalation).To(Equal(supportEscalationModel)) + Expect(supportModel.SupportType).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the LearnMoreLinks model + learnMoreLinksModel := new(catalogmanagementv1.LearnMoreLinks) + Expect(learnMoreLinksModel).ToNot(BeNil()) + learnMoreLinksModel.FirstParty = core.StringPtr("testString") + learnMoreLinksModel.ThirdParty = core.StringPtr("testString") + Expect(learnMoreLinksModel.FirstParty).To(Equal(core.StringPtr("testString"))) + Expect(learnMoreLinksModel.ThirdParty).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the Constraint model + constraintModel := new(catalogmanagementv1.Constraint) + Expect(constraintModel).ToNot(BeNil()) + constraintModel.Type = core.StringPtr("testString") + constraintModel.Rule = core.StringPtr("testString") + Expect(constraintModel.Type).To(Equal(core.StringPtr("testString"))) + Expect(constraintModel.Rule).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the Badge model + badgeModel := new(catalogmanagementv1.Badge) + Expect(badgeModel).ToNot(BeNil()) + badgeModel.ID = core.StringPtr("testString") + badgeModel.Label = core.StringPtr("testString") + badgeModel.LabelI18n = make(map[string]string) + badgeModel.Description = core.StringPtr("testString") + badgeModel.DescriptionI18n = make(map[string]string) + badgeModel.Icon = core.StringPtr("testString") + badgeModel.Authority = core.StringPtr("testString") + badgeModel.Tag = core.StringPtr("testString") + badgeModel.LearnMoreLinks = learnMoreLinksModel + badgeModel.Constraints = []catalogmanagementv1.Constraint{*constraintModel} + Expect(badgeModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(badgeModel.Label).To(Equal(core.StringPtr("testString"))) + Expect(badgeModel.LabelI18n).To(Equal(make(map[string]string))) + Expect(badgeModel.Description).To(Equal(core.StringPtr("testString"))) + Expect(badgeModel.DescriptionI18n).To(Equal(make(map[string]string))) + Expect(badgeModel.Icon).To(Equal(core.StringPtr("testString"))) + Expect(badgeModel.Authority).To(Equal(core.StringPtr("testString"))) + Expect(badgeModel.Tag).To(Equal(core.StringPtr("testString"))) + Expect(badgeModel.LearnMoreLinks).To(Equal(learnMoreLinksModel)) + Expect(badgeModel.Constraints).To(Equal([]catalogmanagementv1.Constraint{*constraintModel})) // Construct an instance of the ReplaceOfferingOptions model catalogIdentifier := "testString" @@ -19305,6 +28307,7 @@ var _ = Describe(`CatalogManagementV1`, func() { replaceOfferingOptionsModel.SetURL("testString") replaceOfferingOptionsModel.SetCRN("testString") replaceOfferingOptionsModel.SetLabel("testString") + replaceOfferingOptionsModel.SetLabelI18n(make(map[string]string)) replaceOfferingOptionsModel.SetName("testString") replaceOfferingOptionsModel.SetOfferingIconURL("testString") replaceOfferingOptionsModel.SetOfferingDocsURL("testString") @@ -19315,9 +28318,16 @@ var _ = Describe(`CatalogManagementV1`, func() { replaceOfferingOptionsModel.SetCreated(CreateMockDateTime("2019-01-01T12:00:00.000Z")) replaceOfferingOptionsModel.SetUpdated(CreateMockDateTime("2019-01-01T12:00:00.000Z")) replaceOfferingOptionsModel.SetShortDescription("testString") + replaceOfferingOptionsModel.SetShortDescriptionI18n(make(map[string]string)) replaceOfferingOptionsModel.SetLongDescription("testString") + replaceOfferingOptionsModel.SetLongDescriptionI18n(make(map[string]string)) replaceOfferingOptionsModel.SetFeatures([]catalogmanagementv1.Feature{*featureModel}) replaceOfferingOptionsModel.SetKinds([]catalogmanagementv1.Kind{*kindModel}) + replaceOfferingOptionsModel.SetPcManaged(true) + replaceOfferingOptionsModel.SetPublishApproved(true) + replaceOfferingOptionsModel.SetShareWithAll(true) + replaceOfferingOptionsModel.SetShareWithIBM(true) + replaceOfferingOptionsModel.SetShareEnabled(true) replaceOfferingOptionsModel.SetPermitRequestIBMPublicPublish(true) replaceOfferingOptionsModel.SetIBMPublishApproved(true) replaceOfferingOptionsModel.SetPublicPublishApproved(true) @@ -19333,8 +28343,12 @@ var _ = Describe(`CatalogManagementV1`, func() { replaceOfferingOptionsModel.SetProvider("testString") replaceOfferingOptionsModel.SetProviderInfo(providerInfoModel) replaceOfferingOptionsModel.SetRepoInfo(repoInfoModel) + replaceOfferingOptionsModel.SetImagePullKeys([]catalogmanagementv1.ImagePullKey{*imagePullKeyModel}) replaceOfferingOptionsModel.SetSupport(supportModel) replaceOfferingOptionsModel.SetMedia([]catalogmanagementv1.MediaItem{*mediaItemModel}) + replaceOfferingOptionsModel.SetDeprecatePending(deprecatePendingModel) + replaceOfferingOptionsModel.SetProductKind("testString") + replaceOfferingOptionsModel.SetBadges([]catalogmanagementv1.Badge{*badgeModel}) replaceOfferingOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(replaceOfferingOptionsModel).ToNot(BeNil()) Expect(replaceOfferingOptionsModel.CatalogIdentifier).To(Equal(core.StringPtr("testString"))) @@ -19344,6 +28358,7 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(replaceOfferingOptionsModel.URL).To(Equal(core.StringPtr("testString"))) Expect(replaceOfferingOptionsModel.CRN).To(Equal(core.StringPtr("testString"))) Expect(replaceOfferingOptionsModel.Label).To(Equal(core.StringPtr("testString"))) + Expect(replaceOfferingOptionsModel.LabelI18n).To(Equal(make(map[string]string))) Expect(replaceOfferingOptionsModel.Name).To(Equal(core.StringPtr("testString"))) Expect(replaceOfferingOptionsModel.OfferingIconURL).To(Equal(core.StringPtr("testString"))) Expect(replaceOfferingOptionsModel.OfferingDocsURL).To(Equal(core.StringPtr("testString"))) @@ -19354,9 +28369,16 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(replaceOfferingOptionsModel.Created).To(Equal(CreateMockDateTime("2019-01-01T12:00:00.000Z"))) Expect(replaceOfferingOptionsModel.Updated).To(Equal(CreateMockDateTime("2019-01-01T12:00:00.000Z"))) Expect(replaceOfferingOptionsModel.ShortDescription).To(Equal(core.StringPtr("testString"))) + Expect(replaceOfferingOptionsModel.ShortDescriptionI18n).To(Equal(make(map[string]string))) Expect(replaceOfferingOptionsModel.LongDescription).To(Equal(core.StringPtr("testString"))) + Expect(replaceOfferingOptionsModel.LongDescriptionI18n).To(Equal(make(map[string]string))) Expect(replaceOfferingOptionsModel.Features).To(Equal([]catalogmanagementv1.Feature{*featureModel})) Expect(replaceOfferingOptionsModel.Kinds).To(Equal([]catalogmanagementv1.Kind{*kindModel})) + Expect(replaceOfferingOptionsModel.PcManaged).To(Equal(core.BoolPtr(true))) + Expect(replaceOfferingOptionsModel.PublishApproved).To(Equal(core.BoolPtr(true))) + Expect(replaceOfferingOptionsModel.ShareWithAll).To(Equal(core.BoolPtr(true))) + Expect(replaceOfferingOptionsModel.ShareWithIBM).To(Equal(core.BoolPtr(true))) + Expect(replaceOfferingOptionsModel.ShareEnabled).To(Equal(core.BoolPtr(true))) Expect(replaceOfferingOptionsModel.PermitRequestIBMPublicPublish).To(Equal(core.BoolPtr(true))) Expect(replaceOfferingOptionsModel.IBMPublishApproved).To(Equal(core.BoolPtr(true))) Expect(replaceOfferingOptionsModel.PublicPublishApproved).To(Equal(core.BoolPtr(true))) @@ -19372,8 +28394,12 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(replaceOfferingOptionsModel.Provider).To(Equal(core.StringPtr("testString"))) Expect(replaceOfferingOptionsModel.ProviderInfo).To(Equal(providerInfoModel)) Expect(replaceOfferingOptionsModel.RepoInfo).To(Equal(repoInfoModel)) + Expect(replaceOfferingOptionsModel.ImagePullKeys).To(Equal([]catalogmanagementv1.ImagePullKey{*imagePullKeyModel})) Expect(replaceOfferingOptionsModel.Support).To(Equal(supportModel)) Expect(replaceOfferingOptionsModel.Media).To(Equal([]catalogmanagementv1.MediaItem{*mediaItemModel})) + Expect(replaceOfferingOptionsModel.DeprecatePending).To(Equal(deprecatePendingModel)) + Expect(replaceOfferingOptionsModel.ProductKind).To(Equal(core.StringPtr("testString"))) + Expect(replaceOfferingOptionsModel.Badges).To(Equal([]catalogmanagementv1.Badge{*badgeModel})) Expect(replaceOfferingOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewReplaceOperatorsOptions successfully`, func() { @@ -19386,6 +28412,8 @@ var _ = Describe(`CatalogManagementV1`, func() { replaceOperatorsOptionsModel.SetNamespaces([]string{"testString"}) replaceOperatorsOptionsModel.SetAllNamespaces(true) replaceOperatorsOptionsModel.SetVersionLocatorID("testString") + replaceOperatorsOptionsModel.SetChannel("testString") + replaceOperatorsOptionsModel.SetInstallPlan("testString") replaceOperatorsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(replaceOperatorsOptionsModel).ToNot(BeNil()) Expect(replaceOperatorsOptionsModel.XAuthRefreshToken).To(Equal(core.StringPtr("testString"))) @@ -19394,6 +28422,8 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(replaceOperatorsOptionsModel.Namespaces).To(Equal([]string{"testString"})) Expect(replaceOperatorsOptionsModel.AllNamespaces).To(Equal(core.BoolPtr(true))) Expect(replaceOperatorsOptionsModel.VersionLocatorID).To(Equal(core.StringPtr("testString"))) + Expect(replaceOperatorsOptionsModel.Channel).To(Equal(core.StringPtr("testString"))) + Expect(replaceOperatorsOptionsModel.InstallPlan).To(Equal(core.StringPtr("testString"))) Expect(replaceOperatorsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewSearchObjectsOptions successfully`, func() { @@ -19401,6 +28431,7 @@ var _ = Describe(`CatalogManagementV1`, func() { query := "testString" searchObjectsOptionsModel := catalogManagementService.NewSearchObjectsOptions(query) searchObjectsOptionsModel.SetQuery("testString") + searchObjectsOptionsModel.SetKind("vpe") searchObjectsOptionsModel.SetLimit(int64(1000)) searchObjectsOptionsModel.SetOffset(int64(38)) searchObjectsOptionsModel.SetCollapse(true) @@ -19408,6 +28439,7 @@ var _ = Describe(`CatalogManagementV1`, func() { searchObjectsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(searchObjectsOptionsModel).ToNot(BeNil()) Expect(searchObjectsOptionsModel.Query).To(Equal(core.StringPtr("testString"))) + Expect(searchObjectsOptionsModel.Kind).To(Equal(core.StringPtr("vpe"))) Expect(searchObjectsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1000)))) Expect(searchObjectsOptionsModel.Offset).To(Equal(core.Int64Ptr(int64(38)))) Expect(searchObjectsOptionsModel.Collapse).To(Equal(core.BoolPtr(true))) @@ -19431,6 +28463,69 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(setDeprecateVersionOptionsModel.DaysUntilDeprecate).To(Equal(core.Int64Ptr(int64(38)))) Expect(setDeprecateVersionOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewSetOfferingPublishOptions successfully`, func() { + // Construct an instance of the SetOfferingPublishOptions model + catalogIdentifier := "testString" + offeringID := "testString" + approvalType := "pc_managed" + approved := "true" + setOfferingPublishOptionsModel := catalogManagementService.NewSetOfferingPublishOptions(catalogIdentifier, offeringID, approvalType, approved) + setOfferingPublishOptionsModel.SetCatalogIdentifier("testString") + setOfferingPublishOptionsModel.SetOfferingID("testString") + setOfferingPublishOptionsModel.SetApprovalType("pc_managed") + setOfferingPublishOptionsModel.SetApproved("true") + setOfferingPublishOptionsModel.SetPortalRecord("testString") + setOfferingPublishOptionsModel.SetPortalURL("testString") + setOfferingPublishOptionsModel.SetXApproverToken("testString") + setOfferingPublishOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(setOfferingPublishOptionsModel).ToNot(BeNil()) + Expect(setOfferingPublishOptionsModel.CatalogIdentifier).To(Equal(core.StringPtr("testString"))) + Expect(setOfferingPublishOptionsModel.OfferingID).To(Equal(core.StringPtr("testString"))) + Expect(setOfferingPublishOptionsModel.ApprovalType).To(Equal(core.StringPtr("pc_managed"))) + Expect(setOfferingPublishOptionsModel.Approved).To(Equal(core.StringPtr("true"))) + Expect(setOfferingPublishOptionsModel.PortalRecord).To(Equal(core.StringPtr("testString"))) + Expect(setOfferingPublishOptionsModel.PortalURL).To(Equal(core.StringPtr("testString"))) + Expect(setOfferingPublishOptionsModel.XApproverToken).To(Equal(core.StringPtr("testString"))) + Expect(setOfferingPublishOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewShareObjectOptions successfully`, func() { + // Construct an instance of the ShareObjectOptions model + catalogIdentifier := "testString" + objectIdentifier := "testString" + shareObjectOptionsModel := catalogManagementService.NewShareObjectOptions(catalogIdentifier, objectIdentifier) + shareObjectOptionsModel.SetCatalogIdentifier("testString") + shareObjectOptionsModel.SetObjectIdentifier("testString") + shareObjectOptionsModel.SetIBM(true) + shareObjectOptionsModel.SetPublic(true) + shareObjectOptionsModel.SetEnabled(true) + shareObjectOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(shareObjectOptionsModel).ToNot(BeNil()) + Expect(shareObjectOptionsModel.CatalogIdentifier).To(Equal(core.StringPtr("testString"))) + Expect(shareObjectOptionsModel.ObjectIdentifier).To(Equal(core.StringPtr("testString"))) + Expect(shareObjectOptionsModel.IBM).To(Equal(core.BoolPtr(true))) + Expect(shareObjectOptionsModel.Public).To(Equal(core.BoolPtr(true))) + Expect(shareObjectOptionsModel.Enabled).To(Equal(core.BoolPtr(true))) + Expect(shareObjectOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewShareOfferingOptions successfully`, func() { + // Construct an instance of the ShareOfferingOptions model + catalogIdentifier := "testString" + offeringID := "testString" + shareOfferingOptionsModel := catalogManagementService.NewShareOfferingOptions(catalogIdentifier, offeringID) + shareOfferingOptionsModel.SetCatalogIdentifier("testString") + shareOfferingOptionsModel.SetOfferingID("testString") + shareOfferingOptionsModel.SetIBM(true) + shareOfferingOptionsModel.SetPublic(true) + shareOfferingOptionsModel.SetEnabled(true) + shareOfferingOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(shareOfferingOptionsModel).ToNot(BeNil()) + Expect(shareOfferingOptionsModel.CatalogIdentifier).To(Equal(core.StringPtr("testString"))) + Expect(shareOfferingOptionsModel.OfferingID).To(Equal(core.StringPtr("testString"))) + Expect(shareOfferingOptionsModel.IBM).To(Equal(core.BoolPtr(true))) + Expect(shareOfferingOptionsModel.Public).To(Equal(core.BoolPtr(true))) + Expect(shareOfferingOptionsModel.Enabled).To(Equal(core.BoolPtr(true))) + Expect(shareOfferingOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewSharedPublishObjectOptions successfully`, func() { // Construct an instance of the SharedPublishObjectOptions model catalogIdentifier := "testString" @@ -19444,6 +28539,16 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(sharedPublishObjectOptionsModel.ObjectIdentifier).To(Equal(core.StringPtr("testString"))) Expect(sharedPublishObjectOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewSuspendVersionOptions successfully`, func() { + // Construct an instance of the SuspendVersionOptions model + versionLocID := "testString" + suspendVersionOptionsModel := catalogManagementService.NewSuspendVersionOptions(versionLocID) + suspendVersionOptionsModel.SetVersionLocID("testString") + suspendVersionOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(suspendVersionOptionsModel).ToNot(BeNil()) + Expect(suspendVersionOptionsModel.VersionLocID).To(Equal(core.StringPtr("testString"))) + Expect(suspendVersionOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewUpdateCatalogAccountOptions successfully`, func() { // Construct an instance of the FilterTerms model filterTermsModel := new(catalogmanagementv1.FilterTerms) @@ -19481,46 +28586,29 @@ var _ = Describe(`CatalogManagementV1`, func() { // Construct an instance of the UpdateCatalogAccountOptions model updateCatalogAccountOptionsModel := catalogManagementService.NewUpdateCatalogAccountOptions() updateCatalogAccountOptionsModel.SetID("testString") + updateCatalogAccountOptionsModel.SetRev("testString") updateCatalogAccountOptionsModel.SetHideIBMCloudCatalog(true) updateCatalogAccountOptionsModel.SetAccountFilters(filtersModel) updateCatalogAccountOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateCatalogAccountOptionsModel).ToNot(BeNil()) Expect(updateCatalogAccountOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateCatalogAccountOptionsModel.Rev).To(Equal(core.StringPtr("testString"))) Expect(updateCatalogAccountOptionsModel.HideIBMCloudCatalog).To(Equal(core.BoolPtr(true))) Expect(updateCatalogAccountOptionsModel.AccountFilters).To(Equal(filtersModel)) Expect(updateCatalogAccountOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) - It(`Invoke NewUpdateOfferingIBMOptions successfully`, func() { - // Construct an instance of the UpdateOfferingIBMOptions model - catalogIdentifier := "testString" - offeringID := "testString" - approvalType := "pc_managed" - approved := "true" - updateOfferingIBMOptionsModel := catalogManagementService.NewUpdateOfferingIBMOptions(catalogIdentifier, offeringID, approvalType, approved) - updateOfferingIBMOptionsModel.SetCatalogIdentifier("testString") - updateOfferingIBMOptionsModel.SetOfferingID("testString") - updateOfferingIBMOptionsModel.SetApprovalType("pc_managed") - updateOfferingIBMOptionsModel.SetApproved("true") - updateOfferingIBMOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(updateOfferingIBMOptionsModel).ToNot(BeNil()) - Expect(updateOfferingIBMOptionsModel.CatalogIdentifier).To(Equal(core.StringPtr("testString"))) - Expect(updateOfferingIBMOptionsModel.OfferingID).To(Equal(core.StringPtr("testString"))) - Expect(updateOfferingIBMOptionsModel.ApprovalType).To(Equal(core.StringPtr("pc_managed"))) - Expect(updateOfferingIBMOptionsModel.Approved).To(Equal(core.StringPtr("true"))) - Expect(updateOfferingIBMOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) It(`Invoke NewUpdateOfferingOptions successfully`, func() { // Construct an instance of the JSONPatchOperation model jsonPatchOperationModel := new(catalogmanagementv1.JSONPatchOperation) Expect(jsonPatchOperationModel).ToNot(BeNil()) jsonPatchOperationModel.Op = core.StringPtr("add") jsonPatchOperationModel.Path = core.StringPtr("testString") - jsonPatchOperationModel.From = core.StringPtr("testString") jsonPatchOperationModel.Value = core.StringPtr("testString") + jsonPatchOperationModel.From = core.StringPtr("testString") Expect(jsonPatchOperationModel.Op).To(Equal(core.StringPtr("add"))) Expect(jsonPatchOperationModel.Path).To(Equal(core.StringPtr("testString"))) - Expect(jsonPatchOperationModel.From).To(Equal(core.StringPtr("testString"))) Expect(jsonPatchOperationModel.Value).To(Equal(core.StringPtr("testString"))) + Expect(jsonPatchOperationModel.From).To(Equal(core.StringPtr("testString"))) // Construct an instance of the UpdateOfferingOptions model catalogIdentifier := "testString" @@ -19540,6 +28628,46 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(updateOfferingOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewValidateInstallOptions successfully`, func() { + // Construct an instance of the DeployRequestBodyOverrideValues model + deployRequestBodyOverrideValuesModel := new(catalogmanagementv1.DeployRequestBodyOverrideValues) + Expect(deployRequestBodyOverrideValuesModel).ToNot(BeNil()) + deployRequestBodyOverrideValuesModel.VsiInstanceName = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.VPCProfile = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.SubnetID = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.VPCID = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.SubnetZone = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.SSHKeyID = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.VPCRegion = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.SetProperty("foo", core.StringPtr("testString")) + Expect(deployRequestBodyOverrideValuesModel.VsiInstanceName).To(Equal(core.StringPtr("testString"))) + Expect(deployRequestBodyOverrideValuesModel.VPCProfile).To(Equal(core.StringPtr("testString"))) + Expect(deployRequestBodyOverrideValuesModel.SubnetID).To(Equal(core.StringPtr("testString"))) + Expect(deployRequestBodyOverrideValuesModel.VPCID).To(Equal(core.StringPtr("testString"))) + Expect(deployRequestBodyOverrideValuesModel.SubnetZone).To(Equal(core.StringPtr("testString"))) + Expect(deployRequestBodyOverrideValuesModel.SSHKeyID).To(Equal(core.StringPtr("testString"))) + Expect(deployRequestBodyOverrideValuesModel.VPCRegion).To(Equal(core.StringPtr("testString"))) + Expect(deployRequestBodyOverrideValuesModel.GetProperties()).ToNot(BeEmpty()) + Expect(deployRequestBodyOverrideValuesModel.GetProperty("foo")).To(Equal(core.StringPtr("testString"))) + + deployRequestBodyOverrideValuesModel.SetProperties(nil) + Expect(deployRequestBodyOverrideValuesModel.GetProperties()).To(BeEmpty()) + + deployRequestBodyOverrideValuesModelExpectedMap := make(map[string]interface{}) + deployRequestBodyOverrideValuesModelExpectedMap["foo"] = core.StringPtr("testString") + deployRequestBodyOverrideValuesModel.SetProperties(deployRequestBodyOverrideValuesModelExpectedMap) + deployRequestBodyOverrideValuesModelActualMap := deployRequestBodyOverrideValuesModel.GetProperties() + Expect(deployRequestBodyOverrideValuesModelActualMap).To(Equal(deployRequestBodyOverrideValuesModelExpectedMap)) + + // Construct an instance of the DeployRequestBodyEnvironmentVariablesItem model + deployRequestBodyEnvironmentVariablesItemModel := new(catalogmanagementv1.DeployRequestBodyEnvironmentVariablesItem) + Expect(deployRequestBodyEnvironmentVariablesItemModel).ToNot(BeNil()) + deployRequestBodyEnvironmentVariablesItemModel.Name = core.StringPtr("testString") + deployRequestBodyEnvironmentVariablesItemModel.Value = core.StringPtr("testString") + deployRequestBodyEnvironmentVariablesItemModel.Secure = core.BoolPtr(true) + Expect(deployRequestBodyEnvironmentVariablesItemModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(deployRequestBodyEnvironmentVariablesItemModel.Value).To(Equal(core.StringPtr("testString"))) + Expect(deployRequestBodyEnvironmentVariablesItemModel.Secure).To(Equal(core.BoolPtr(true))) + // Construct an instance of the DeployRequestBodySchematics model deployRequestBodySchematicsModel := new(catalogmanagementv1.DeployRequestBodySchematics) Expect(deployRequestBodySchematicsModel).ToNot(BeNil()) @@ -19547,10 +28675,14 @@ var _ = Describe(`CatalogManagementV1`, func() { deployRequestBodySchematicsModel.Description = core.StringPtr("testString") deployRequestBodySchematicsModel.Tags = []string{"testString"} deployRequestBodySchematicsModel.ResourceGroupID = core.StringPtr("testString") + deployRequestBodySchematicsModel.TerraformVersion = core.StringPtr("testString") + deployRequestBodySchematicsModel.Region = core.StringPtr("testString") Expect(deployRequestBodySchematicsModel.Name).To(Equal(core.StringPtr("testString"))) Expect(deployRequestBodySchematicsModel.Description).To(Equal(core.StringPtr("testString"))) Expect(deployRequestBodySchematicsModel.Tags).To(Equal([]string{"testString"})) Expect(deployRequestBodySchematicsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) + Expect(deployRequestBodySchematicsModel.TerraformVersion).To(Equal(core.StringPtr("testString"))) + Expect(deployRequestBodySchematicsModel.Region).To(Equal(core.StringPtr("testString"))) // Construct an instance of the ValidateInstallOptions model versionLocID := "testString" @@ -19561,16 +28693,17 @@ var _ = Describe(`CatalogManagementV1`, func() { validateInstallOptionsModel.SetClusterID("testString") validateInstallOptionsModel.SetRegion("testString") validateInstallOptionsModel.SetNamespace("testString") - validateInstallOptionsModel.SetOverrideValues(make(map[string]interface{})) + validateInstallOptionsModel.SetOverrideValues(deployRequestBodyOverrideValuesModel) + validateInstallOptionsModel.SetEnvironmentVariables([]catalogmanagementv1.DeployRequestBodyEnvironmentVariablesItem{*deployRequestBodyEnvironmentVariablesItemModel}) validateInstallOptionsModel.SetEntitlementApikey("testString") validateInstallOptionsModel.SetSchematics(deployRequestBodySchematicsModel) validateInstallOptionsModel.SetScript("testString") validateInstallOptionsModel.SetScriptID("testString") validateInstallOptionsModel.SetVersionLocatorID("testString") validateInstallOptionsModel.SetVcenterID("testString") + validateInstallOptionsModel.SetVcenterLocation("testString") validateInstallOptionsModel.SetVcenterUser("testString") validateInstallOptionsModel.SetVcenterPassword("testString") - validateInstallOptionsModel.SetVcenterLocation("testString") validateInstallOptionsModel.SetVcenterDatastore("testString") validateInstallOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(validateInstallOptionsModel).ToNot(BeNil()) @@ -19579,16 +28712,17 @@ var _ = Describe(`CatalogManagementV1`, func() { Expect(validateInstallOptionsModel.ClusterID).To(Equal(core.StringPtr("testString"))) Expect(validateInstallOptionsModel.Region).To(Equal(core.StringPtr("testString"))) Expect(validateInstallOptionsModel.Namespace).To(Equal(core.StringPtr("testString"))) - Expect(validateInstallOptionsModel.OverrideValues).To(Equal(make(map[string]interface{}))) + Expect(validateInstallOptionsModel.OverrideValues).To(Equal(deployRequestBodyOverrideValuesModel)) + Expect(validateInstallOptionsModel.EnvironmentVariables).To(Equal([]catalogmanagementv1.DeployRequestBodyEnvironmentVariablesItem{*deployRequestBodyEnvironmentVariablesItemModel})) Expect(validateInstallOptionsModel.EntitlementApikey).To(Equal(core.StringPtr("testString"))) Expect(validateInstallOptionsModel.Schematics).To(Equal(deployRequestBodySchematicsModel)) Expect(validateInstallOptionsModel.Script).To(Equal(core.StringPtr("testString"))) Expect(validateInstallOptionsModel.ScriptID).To(Equal(core.StringPtr("testString"))) Expect(validateInstallOptionsModel.VersionLocatorID).To(Equal(core.StringPtr("testString"))) Expect(validateInstallOptionsModel.VcenterID).To(Equal(core.StringPtr("testString"))) + Expect(validateInstallOptionsModel.VcenterLocation).To(Equal(core.StringPtr("testString"))) Expect(validateInstallOptionsModel.VcenterUser).To(Equal(core.StringPtr("testString"))) Expect(validateInstallOptionsModel.VcenterPassword).To(Equal(core.StringPtr("testString"))) - Expect(validateInstallOptionsModel.VcenterLocation).To(Equal(core.StringPtr("testString"))) Expect(validateInstallOptionsModel.VcenterDatastore).To(Equal(core.StringPtr("testString"))) Expect(validateInstallOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) })