From ed9a3722b984ea64eec6a34a8bd881f803cf346b Mon Sep 17 00:00:00 2001 From: Phil Adams Date: Thu, 7 May 2020 12:23:13 -0500 Subject: [PATCH] feat(Global Catalog): add service and unit test code to project (#5) * feat(Global Catalog): add service and unit test code to project * test: add global catalog integration tests Co-authored-by: dubeejw --- .gitignore | 3 + .travis.yml | 1 + README.md | 3 +- global_catalog.env.enc | 1 + globalcatalogv1/global_catalog_v1.go | 4517 +++++++++++++++ .../global_catalog_v1_integration_test.go | 536 ++ .../global_catalog_v1_suite_test.go | 28 + globalcatalogv1/global_catalog_v1_test.go | 4841 +++++++++++++++++ go.mod | 3 +- go.sum | 6 +- 10 files changed, 9935 insertions(+), 4 deletions(-) create mode 100644 global_catalog.env.enc create mode 100644 globalcatalogv1/global_catalog_v1.go create mode 100644 globalcatalogv1/global_catalog_v1_integration_test.go create mode 100644 globalcatalogv1/global_catalog_v1_suite_test.go create mode 100644 globalcatalogv1/global_catalog_v1_test.go diff --git a/.gitignore b/.gitignore index 5cc5d9f5..f58c89b5 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,6 @@ vendor/ .openapi-generator/VERSION /.project package-lock.json + +# IDE files +*.idea diff --git a/.travis.yml b/.travis.yml index b403fab4..f6b91c17 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,6 +19,7 @@ before_install: - npm install -g npm@6.x - '[ "${TRAVIS_PULL_REQUEST}" == "false" ] && openssl aes-256-cbc -K $encrypted_3058bc69cb40_key -iv $encrypted_3058bc69cb40_iv -in ghost.env.enc -out ghost.env -d || true' - '[ "${TRAVIS_PULL_REQUEST}" == "false" ] && openssl aes-256-cbc -K $encrypted_66f264007c0d_key -iv $encrypted_66f264007c0d_iv -in iam_access_groups.env.enc -out iam_access_groups.env -d || true' +- '[ "${TRAVIS_PULL_REQUEST}" == "false" ] && openssl aes-256-cbc -K $encrypted_94fa7fdf4df9_key -iv $encrypted_94fa7fdf4df9_iv -in global_catalog.env.enc -out global_catalog.env -d || true' install: - curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $(go env GOPATH)/bin v1.21.0 diff --git a/README.md b/README.md index 049c8854..0a1f500d 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ # IBM Cloud Platform Services Go SDK Version 0.1.0 Go client library to interact with various -[IBM Cloud Platform Service APIs](https://cloud.ibm.com/apidocs?category=platform_services). +[IBM Cloud Platform Service APIs](https://cloud.ibm.com/docs?tab=api-docs&category=platform_services). Disclaimer: this SDK is being released initially as a **pre-release** version. Changes might occur which impact applications that use this SDK. @@ -47,6 +47,7 @@ The IBM Cloud Platform Services Go SDK allows developers to programmatically int Service Name | Package name --- | --- +[Global Catalog](https://cloud.ibm.com/apidocs/resource-catalog/global-catalog) | globalcatalogv1 [Global Search](https://cloud.ibm.com/apidocs/search) | globalsearchv2 [Global Tagging](https://cloud.ibm.com/apidocs/tagging) | globaltaggingv1 [IAM Access Groups](https://cloud.ibm.com/apidocs/iam-access-groups) | iamaccessgroupsv2 diff --git a/global_catalog.env.enc b/global_catalog.env.enc new file mode 100644 index 00000000..8c7b08c0 --- /dev/null +++ b/global_catalog.env.enc @@ -0,0 +1 @@ +xh mgT1vY-4vXXhz"'k[w#DffYMBdA`)X~ NSM05"JmMu4Ѯ4Pg1?(3}SIaYLۼJ }Ԋb˧N1s.Am*0n9bN:ۖv+anwWDjI"Ib(FxT1 \ No newline at end of file diff --git a/globalcatalogv1/global_catalog_v1.go b/globalcatalogv1/global_catalog_v1.go new file mode 100644 index 00000000..95443d07 --- /dev/null +++ b/globalcatalogv1/global_catalog_v1.go @@ -0,0 +1,4517 @@ +/** + * (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 globalcatalogv1 : Operations and models for the GlobalCatalogV1 service +package globalcatalogv1 + +import ( + "encoding/json" + "fmt" + "github.com/IBM/go-sdk-core/v4/core" + common "github.com/IBM/platform-services-go-sdk/common" + "github.com/go-openapi/strfmt" + "io" + "reflect" +) + +// GlobalCatalogV1 : The catalog service manages offerings across geographies as the system of record. The catalog +// supports a RESTful API where users can retrieve information about existing offerings and create, manage, and delete +// their offerings. Start with the base URL and use the endpoints to retrieve metadata about services in the catalog and +// manage service visbility. Depending on the kind of object, the metadata can include information about pricing, +// provisioning, regions, and more. For more information, see the [catalog +// documentation](https://cloud.ibm.com/docs/overview/catalog.html#global-catalog-overview). +// +// Version: 1.0.3 +type GlobalCatalogV1 struct { + Service *core.BaseService +} + +// DefaultServiceURL is the default URL to make service requests to. +const DefaultServiceURL = "https://globalcatalog.cloud.ibm.com/api/v1" + +// DefaultServiceName is the default key used to find external configuration information. +const DefaultServiceName = "global_catalog" + +// GlobalCatalogV1Options : Service options +type GlobalCatalogV1Options struct { + ServiceName string + URL string + Authenticator core.Authenticator +} + +// NewGlobalCatalogV1UsingExternalConfig : constructs an instance of GlobalCatalogV1 with passed in options and external configuration. +func NewGlobalCatalogV1UsingExternalConfig(options *GlobalCatalogV1Options) (globalCatalog *GlobalCatalogV1, err error) { + if options.ServiceName == "" { + options.ServiceName = DefaultServiceName + } + + if options.Authenticator == nil { + options.Authenticator, err = core.GetAuthenticatorFromEnvironment(options.ServiceName) + if err != nil { + return + } + } + + globalCatalog, err = NewGlobalCatalogV1(options) + if err != nil { + return + } + + err = globalCatalog.Service.ConfigureService(options.ServiceName) + if err != nil { + return + } + + if options.URL != "" { + err = globalCatalog.Service.SetServiceURL(options.URL) + } + return +} + +// NewGlobalCatalogV1 : constructs an instance of GlobalCatalogV1 with passed in options. +func NewGlobalCatalogV1(options *GlobalCatalogV1Options) (service *GlobalCatalogV1, err error) { + serviceOptions := &core.ServiceOptions{ + URL: DefaultServiceURL, + Authenticator: options.Authenticator, + } + + baseService, err := core.NewBaseService(serviceOptions) + if err != nil { + return + } + + if options.URL != "" { + err = baseService.SetServiceURL(options.URL) + if err != nil { + return + } + } + + service = &GlobalCatalogV1{ + Service: baseService, + } + + return +} + +// SetServiceURL sets the service URL +func (globalCatalog *GlobalCatalogV1) SetServiceURL(url string) error { + return globalCatalog.Service.SetServiceURL(url) +} + +// ListCatalogEntries : Returns parent catalog entries +// Includes key information, such as ID, name, kind, CRN, tags, and provider. This endpoint is ETag enabled. +func (globalCatalog *GlobalCatalogV1) ListCatalogEntries(listCatalogEntriesOptions *ListCatalogEntriesOptions) (result *EntrySearchResult, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listCatalogEntriesOptions, "listCatalogEntriesOptions") + if err != nil { + return + } + + pathSegments := []string{""} + pathParameters := []string{} + + builder := core.NewRequestBuilder(core.GET) + _, err = builder.ConstructHTTPURL(globalCatalog.Service.Options.URL, pathSegments, pathParameters) + if err != nil { + return + } + + for headerName, headerValue := range listCatalogEntriesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("global_catalog", "V1", "ListCatalogEntries") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + if listCatalogEntriesOptions.Account != nil { + builder.AddQuery("account", fmt.Sprint(*listCatalogEntriesOptions.Account)) + } + if listCatalogEntriesOptions.Include != nil { + builder.AddQuery("include", fmt.Sprint(*listCatalogEntriesOptions.Include)) + } + if listCatalogEntriesOptions.Q != nil { + builder.AddQuery("q", fmt.Sprint(*listCatalogEntriesOptions.Q)) + } + if listCatalogEntriesOptions.SortBy != nil { + builder.AddQuery("sort-by", fmt.Sprint(*listCatalogEntriesOptions.SortBy)) + } + if listCatalogEntriesOptions.Descending != nil { + builder.AddQuery("descending", fmt.Sprint(*listCatalogEntriesOptions.Descending)) + } + if listCatalogEntriesOptions.Languages != nil { + builder.AddQuery("languages", fmt.Sprint(*listCatalogEntriesOptions.Languages)) + } + if listCatalogEntriesOptions.Complete != nil { + builder.AddQuery("complete", fmt.Sprint(*listCatalogEntriesOptions.Complete)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = globalCatalog.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEntrySearchResult) + if err != nil { + return + } + response.Result = result + + return +} + +// CreateCatalogEntry : Create a catalog entry +// The created catalog entry is restricted by default. You must have an administrator or editor role in the scope of the +// provided token. This API will return an ETag that can be used for standard ETag processing, except when depth query +// is used. +func (globalCatalog *GlobalCatalogV1) CreateCatalogEntry(createCatalogEntryOptions *CreateCatalogEntryOptions) (result *CatalogEntry, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createCatalogEntryOptions, "createCatalogEntryOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createCatalogEntryOptions, "createCatalogEntryOptions") + if err != nil { + return + } + + pathSegments := []string{""} + pathParameters := []string{} + + builder := core.NewRequestBuilder(core.POST) + _, err = builder.ConstructHTTPURL(globalCatalog.Service.Options.URL, pathSegments, pathParameters) + if err != nil { + return + } + + for headerName, headerValue := range createCatalogEntryOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("global_catalog", "V1", "CreateCatalogEntry") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + if createCatalogEntryOptions.Account != nil { + builder.AddQuery("account", fmt.Sprint(*createCatalogEntryOptions.Account)) + } + + body := make(map[string]interface{}) + if createCatalogEntryOptions.Name != nil { + body["name"] = createCatalogEntryOptions.Name + } + if createCatalogEntryOptions.Kind != nil { + body["kind"] = createCatalogEntryOptions.Kind + } + if createCatalogEntryOptions.OverviewUi != nil { + body["overview_ui"] = createCatalogEntryOptions.OverviewUi + } + if createCatalogEntryOptions.Images != nil { + body["images"] = createCatalogEntryOptions.Images + } + if createCatalogEntryOptions.Disabled != nil { + body["disabled"] = createCatalogEntryOptions.Disabled + } + if createCatalogEntryOptions.Tags != nil { + body["tags"] = createCatalogEntryOptions.Tags + } + if createCatalogEntryOptions.Provider != nil { + body["provider"] = createCatalogEntryOptions.Provider + } + if createCatalogEntryOptions.ID != nil { + body["id"] = createCatalogEntryOptions.ID + } + if createCatalogEntryOptions.ParentID != nil { + body["parent_id"] = createCatalogEntryOptions.ParentID + } + if createCatalogEntryOptions.Group != nil { + body["group"] = createCatalogEntryOptions.Group + } + if createCatalogEntryOptions.Active != nil { + body["active"] = createCatalogEntryOptions.Active + } + if createCatalogEntryOptions.Metadata != nil { + body["metadata"] = createCatalogEntryOptions.Metadata + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = globalCatalog.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalCatalogEntry) + if err != nil { + return + } + response.Result = result + + return +} + +// GetCatalogEntry : Get a specific catalog object +// This endpoint returns a specific catalog entry using the object's unique identifier, for example +// `/_*service_name*?complete=true`. This endpoint is ETag enabled. +func (globalCatalog *GlobalCatalogV1) GetCatalogEntry(getCatalogEntryOptions *GetCatalogEntryOptions) (result *CatalogEntry, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getCatalogEntryOptions, "getCatalogEntryOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getCatalogEntryOptions, "getCatalogEntryOptions") + if err != nil { + return + } + + pathSegments := []string{""} + pathParameters := []string{*getCatalogEntryOptions.ID} + + builder := core.NewRequestBuilder(core.GET) + _, err = builder.ConstructHTTPURL(globalCatalog.Service.Options.URL, pathSegments, pathParameters) + if err != nil { + return + } + + for headerName, headerValue := range getCatalogEntryOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("global_catalog", "V1", "GetCatalogEntry") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + if getCatalogEntryOptions.Account != nil { + builder.AddQuery("account", fmt.Sprint(*getCatalogEntryOptions.Account)) + } + if getCatalogEntryOptions.Include != nil { + builder.AddQuery("include", fmt.Sprint(*getCatalogEntryOptions.Include)) + } + if getCatalogEntryOptions.Languages != nil { + builder.AddQuery("languages", fmt.Sprint(*getCatalogEntryOptions.Languages)) + } + if getCatalogEntryOptions.Complete != nil { + builder.AddQuery("complete", fmt.Sprint(*getCatalogEntryOptions.Complete)) + } + if getCatalogEntryOptions.Depth != nil { + builder.AddQuery("depth", fmt.Sprint(*getCatalogEntryOptions.Depth)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = globalCatalog.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalCatalogEntry) + if err != nil { + return + } + response.Result = result + + return +} + +// UpdateCatalogEntry : Update a catalog entry +// Update a catalog entry. The visibility of the catalog entry cannot be modified with this endpoint. You must be an +// administrator or editor in the scope of the provided token. This endpoint is ETag enabled. +func (globalCatalog *GlobalCatalogV1) UpdateCatalogEntry(updateCatalogEntryOptions *UpdateCatalogEntryOptions) (result *CatalogEntry, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateCatalogEntryOptions, "updateCatalogEntryOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateCatalogEntryOptions, "updateCatalogEntryOptions") + if err != nil { + return + } + + pathSegments := []string{""} + pathParameters := []string{*updateCatalogEntryOptions.ID} + + builder := core.NewRequestBuilder(core.PUT) + _, err = builder.ConstructHTTPURL(globalCatalog.Service.Options.URL, pathSegments, pathParameters) + if err != nil { + return + } + + for headerName, headerValue := range updateCatalogEntryOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("global_catalog", "V1", "UpdateCatalogEntry") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + if updateCatalogEntryOptions.Account != nil { + builder.AddQuery("account", fmt.Sprint(*updateCatalogEntryOptions.Account)) + } + if updateCatalogEntryOptions.Move != nil { + builder.AddQuery("move", fmt.Sprint(*updateCatalogEntryOptions.Move)) + } + + body := make(map[string]interface{}) + if updateCatalogEntryOptions.Name != nil { + body["name"] = updateCatalogEntryOptions.Name + } + if updateCatalogEntryOptions.Kind != nil { + body["kind"] = updateCatalogEntryOptions.Kind + } + if updateCatalogEntryOptions.OverviewUi != nil { + body["overview_ui"] = updateCatalogEntryOptions.OverviewUi + } + if updateCatalogEntryOptions.Images != nil { + body["images"] = updateCatalogEntryOptions.Images + } + if updateCatalogEntryOptions.Disabled != nil { + body["disabled"] = updateCatalogEntryOptions.Disabled + } + if updateCatalogEntryOptions.Tags != nil { + body["tags"] = updateCatalogEntryOptions.Tags + } + if updateCatalogEntryOptions.Provider != nil { + body["provider"] = updateCatalogEntryOptions.Provider + } + if updateCatalogEntryOptions.ParentID != nil { + body["parent_id"] = updateCatalogEntryOptions.ParentID + } + if updateCatalogEntryOptions.Group != nil { + body["group"] = updateCatalogEntryOptions.Group + } + if updateCatalogEntryOptions.Active != nil { + body["active"] = updateCatalogEntryOptions.Active + } + if updateCatalogEntryOptions.Metadata != nil { + body["metadata"] = updateCatalogEntryOptions.Metadata + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = globalCatalog.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalCatalogEntry) + if err != nil { + return + } + response.Result = result + + return +} + +// DeleteCatalogEntry : Delete a catalog entry +// Delete a catalog entry. This will archive the catalog entry for a minimum of two weeks. While archived, it can be +// restored using the PUT restore API. After two weeks, it will be deleted and cannot be restored. You must have +// administrator role in the scope of the provided token to modify it. This endpoint is ETag enabled. +func (globalCatalog *GlobalCatalogV1) DeleteCatalogEntry(deleteCatalogEntryOptions *DeleteCatalogEntryOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteCatalogEntryOptions, "deleteCatalogEntryOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteCatalogEntryOptions, "deleteCatalogEntryOptions") + if err != nil { + return + } + + pathSegments := []string{""} + pathParameters := []string{*deleteCatalogEntryOptions.ID} + + builder := core.NewRequestBuilder(core.DELETE) + _, err = builder.ConstructHTTPURL(globalCatalog.Service.Options.URL, pathSegments, pathParameters) + if err != nil { + return + } + + for headerName, headerValue := range deleteCatalogEntryOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("global_catalog", "V1", "DeleteCatalogEntry") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + if deleteCatalogEntryOptions.Account != nil { + builder.AddQuery("account", fmt.Sprint(*deleteCatalogEntryOptions.Account)) + } + if deleteCatalogEntryOptions.Force != nil { + builder.AddQuery("force", fmt.Sprint(*deleteCatalogEntryOptions.Force)) + } + + request, err := builder.Build() + if err != nil { + return + } + + response, err = globalCatalog.Service.Request(request, nil) + + return +} + +// GetChildObjects : Get child catalog entries of a specific kind +// Fetch child catalog entries for a catalog entry with a specific id. This endpoint is ETag enabled. +func (globalCatalog *GlobalCatalogV1) GetChildObjects(getChildObjectsOptions *GetChildObjectsOptions) (result *EntrySearchResult, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getChildObjectsOptions, "getChildObjectsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getChildObjectsOptions, "getChildObjectsOptions") + if err != nil { + return + } + + pathSegments := []string{"", ""} + pathParameters := []string{*getChildObjectsOptions.ID, *getChildObjectsOptions.Kind} + + builder := core.NewRequestBuilder(core.GET) + _, err = builder.ConstructHTTPURL(globalCatalog.Service.Options.URL, pathSegments, pathParameters) + if err != nil { + return + } + + for headerName, headerValue := range getChildObjectsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("global_catalog", "V1", "GetChildObjects") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + if getChildObjectsOptions.Account != nil { + builder.AddQuery("account", fmt.Sprint(*getChildObjectsOptions.Account)) + } + if getChildObjectsOptions.Include != nil { + builder.AddQuery("include", fmt.Sprint(*getChildObjectsOptions.Include)) + } + if getChildObjectsOptions.Q != nil { + builder.AddQuery("q", fmt.Sprint(*getChildObjectsOptions.Q)) + } + if getChildObjectsOptions.SortBy != nil { + builder.AddQuery("sort-by", fmt.Sprint(*getChildObjectsOptions.SortBy)) + } + if getChildObjectsOptions.Descending != nil { + builder.AddQuery("descending", fmt.Sprint(*getChildObjectsOptions.Descending)) + } + if getChildObjectsOptions.Languages != nil { + builder.AddQuery("languages", fmt.Sprint(*getChildObjectsOptions.Languages)) + } + if getChildObjectsOptions.Complete != nil { + builder.AddQuery("complete", fmt.Sprint(*getChildObjectsOptions.Complete)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = globalCatalog.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEntrySearchResult) + if err != nil { + return + } + response.Result = result + + return +} + +// RestoreCatalogEntry : Restore archived catalog entry +// Restore an archived catalog entry. You must have an administrator role in the scope of the provided token. +func (globalCatalog *GlobalCatalogV1) RestoreCatalogEntry(restoreCatalogEntryOptions *RestoreCatalogEntryOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(restoreCatalogEntryOptions, "restoreCatalogEntryOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(restoreCatalogEntryOptions, "restoreCatalogEntryOptions") + if err != nil { + return + } + + pathSegments := []string{"", "restore"} + pathParameters := []string{*restoreCatalogEntryOptions.ID} + + builder := core.NewRequestBuilder(core.PUT) + _, err = builder.ConstructHTTPURL(globalCatalog.Service.Options.URL, pathSegments, pathParameters) + if err != nil { + return + } + + for headerName, headerValue := range restoreCatalogEntryOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("global_catalog", "V1", "RestoreCatalogEntry") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + if restoreCatalogEntryOptions.Account != nil { + builder.AddQuery("account", fmt.Sprint(*restoreCatalogEntryOptions.Account)) + } + + request, err := builder.Build() + if err != nil { + return + } + + response, err = globalCatalog.Service.Request(request, nil) + + return +} + +// GetVisibility : Get the visibility constraints for an object +// This endpoint returns the visibility rules for this object. Overall visibility is determined by the parent objects +// and any further restrictions on this object. You must have an administrator role in the scope of the provided token. +// This endpoint is ETag enabled. +func (globalCatalog *GlobalCatalogV1) GetVisibility(getVisibilityOptions *GetVisibilityOptions) (result *Visibility, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVisibilityOptions, "getVisibilityOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getVisibilityOptions, "getVisibilityOptions") + if err != nil { + return + } + + pathSegments := []string{"", "visibility"} + pathParameters := []string{*getVisibilityOptions.ID} + + builder := core.NewRequestBuilder(core.GET) + _, err = builder.ConstructHTTPURL(globalCatalog.Service.Options.URL, pathSegments, pathParameters) + if err != nil { + return + } + + for headerName, headerValue := range getVisibilityOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("global_catalog", "V1", "GetVisibility") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + if getVisibilityOptions.Account != nil { + builder.AddQuery("account", fmt.Sprint(*getVisibilityOptions.Account)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = globalCatalog.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVisibility) + if err != nil { + return + } + response.Result = result + + return +} + +// UpdateVisibility : Update visibility +// Update an Object's Visibility. You must have an administrator role in the scope of the provided token. This endpoint +// is ETag enabled. +func (globalCatalog *GlobalCatalogV1) UpdateVisibility(updateVisibilityOptions *UpdateVisibilityOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVisibilityOptions, "updateVisibilityOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateVisibilityOptions, "updateVisibilityOptions") + if err != nil { + return + } + + pathSegments := []string{"", "visibility"} + pathParameters := []string{*updateVisibilityOptions.ID} + + builder := core.NewRequestBuilder(core.PUT) + _, err = builder.ConstructHTTPURL(globalCatalog.Service.Options.URL, pathSegments, pathParameters) + if err != nil { + return + } + + for headerName, headerValue := range updateVisibilityOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("global_catalog", "V1", "UpdateVisibility") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Content-Type", "application/json") + + if updateVisibilityOptions.Account != nil { + builder.AddQuery("account", fmt.Sprint(*updateVisibilityOptions.Account)) + } + + body := make(map[string]interface{}) + if updateVisibilityOptions.Extendable != nil { + body["extendable"] = updateVisibilityOptions.Extendable + } + if updateVisibilityOptions.Include != nil { + body["include"] = updateVisibilityOptions.Include + } + if updateVisibilityOptions.Exclude != nil { + body["exclude"] = updateVisibilityOptions.Exclude + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + response, err = globalCatalog.Service.Request(request, nil) + + return +} + +// GetPricing : Get the pricing for an object +// This endpoint returns the pricing for an object. Static pricing is defined in the catalog. Dynamic pricing is stored +// in Bluemix Pricing Catalog. +func (globalCatalog *GlobalCatalogV1) GetPricing(getPricingOptions *GetPricingOptions) (result *PricingGet, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getPricingOptions, "getPricingOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getPricingOptions, "getPricingOptions") + if err != nil { + return + } + + pathSegments := []string{"", "pricing"} + pathParameters := []string{*getPricingOptions.ID} + + builder := core.NewRequestBuilder(core.GET) + _, err = builder.ConstructHTTPURL(globalCatalog.Service.Options.URL, pathSegments, pathParameters) + if err != nil { + return + } + + for headerName, headerValue := range getPricingOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("global_catalog", "V1", "GetPricing") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + if getPricingOptions.Account != nil { + builder.AddQuery("account", fmt.Sprint(*getPricingOptions.Account)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = globalCatalog.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPricingGet) + if err != nil { + return + } + response.Result = result + + return +} + +// GetAuditLogs : Get the audit logs for an object +// This endpoint returns the audit logs for an object. Only administrators and editors can get logs. +func (globalCatalog *GlobalCatalogV1) GetAuditLogs(getAuditLogsOptions *GetAuditLogsOptions) (result *AuditSearchResult, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getAuditLogsOptions, "getAuditLogsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getAuditLogsOptions, "getAuditLogsOptions") + if err != nil { + return + } + + pathSegments := []string{"", "logs"} + pathParameters := []string{*getAuditLogsOptions.ID} + + builder := core.NewRequestBuilder(core.GET) + _, err = builder.ConstructHTTPURL(globalCatalog.Service.Options.URL, pathSegments, pathParameters) + if err != nil { + return + } + + for headerName, headerValue := range getAuditLogsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("global_catalog", "V1", "GetAuditLogs") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + if getAuditLogsOptions.Account != nil { + builder.AddQuery("account", fmt.Sprint(*getAuditLogsOptions.Account)) + } + if getAuditLogsOptions.Ascending != nil { + builder.AddQuery("ascending", fmt.Sprint(*getAuditLogsOptions.Ascending)) + } + if getAuditLogsOptions.Startat != nil { + builder.AddQuery("startat", fmt.Sprint(*getAuditLogsOptions.Startat)) + } + if getAuditLogsOptions.Offset != nil { + builder.AddQuery("_offset", fmt.Sprint(*getAuditLogsOptions.Offset)) + } + if getAuditLogsOptions.Limit != nil { + builder.AddQuery("_limit", fmt.Sprint(*getAuditLogsOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = globalCatalog.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAuditSearchResult) + if err != nil { + return + } + response.Result = result + + return +} + +// ListArtifacts : Get artifacts +// This endpoint returns a list of artifacts for an object. +func (globalCatalog *GlobalCatalogV1) ListArtifacts(listArtifactsOptions *ListArtifactsOptions) (result *Artifacts, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listArtifactsOptions, "listArtifactsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listArtifactsOptions, "listArtifactsOptions") + if err != nil { + return + } + + pathSegments := []string{"", "artifacts"} + pathParameters := []string{*listArtifactsOptions.ObjectID} + + builder := core.NewRequestBuilder(core.GET) + _, err = builder.ConstructHTTPURL(globalCatalog.Service.Options.URL, pathSegments, pathParameters) + if err != nil { + return + } + + for headerName, headerValue := range listArtifactsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("global_catalog", "V1", "ListArtifacts") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + if listArtifactsOptions.Account != nil { + builder.AddQuery("account", fmt.Sprint(*listArtifactsOptions.Account)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = globalCatalog.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalArtifacts) + if err != nil { + return + } + response.Result = result + + return +} + +// GetArtifact : Get artifact +// This endpoint returns the binary of an artifact. +func (globalCatalog *GlobalCatalogV1) GetArtifact(getArtifactOptions *GetArtifactOptions) (result io.ReadCloser, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getArtifactOptions, "getArtifactOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getArtifactOptions, "getArtifactOptions") + if err != nil { + return + } + + pathSegments := []string{"", "artifacts"} + pathParameters := []string{*getArtifactOptions.ObjectID, *getArtifactOptions.ArtifactID} + + builder := core.NewRequestBuilder(core.GET) + _, err = builder.ConstructHTTPURL(globalCatalog.Service.Options.URL, pathSegments, pathParameters) + if err != nil { + return + } + + for headerName, headerValue := range getArtifactOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("global_catalog", "V1", "GetArtifact") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "*/*") + if getArtifactOptions.Accept != nil { + builder.AddHeader("Accept", fmt.Sprint(*getArtifactOptions.Accept)) + } + + if getArtifactOptions.Account != nil { + builder.AddQuery("account", fmt.Sprint(*getArtifactOptions.Account)) + } + + request, err := builder.Build() + if err != nil { + return + } + + response, err = globalCatalog.Service.Request(request, &result) + + return +} + +// UploadArtifact : Upload artifact +// This endpoint uploads the binary for an artifact. Only administrators and editors can upload artifacts. +func (globalCatalog *GlobalCatalogV1) UploadArtifact(uploadArtifactOptions *UploadArtifactOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(uploadArtifactOptions, "uploadArtifactOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(uploadArtifactOptions, "uploadArtifactOptions") + if err != nil { + return + } + + pathSegments := []string{"", "artifacts"} + pathParameters := []string{*uploadArtifactOptions.ObjectID, *uploadArtifactOptions.ArtifactID} + + builder := core.NewRequestBuilder(core.PUT) + _, err = builder.ConstructHTTPURL(globalCatalog.Service.Options.URL, pathSegments, pathParameters) + if err != nil { + return + } + + for headerName, headerValue := range uploadArtifactOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("global_catalog", "V1", "UploadArtifact") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + if uploadArtifactOptions.ContentType != nil { + builder.AddHeader("Content-Type", fmt.Sprint(*uploadArtifactOptions.ContentType)) + } + + if uploadArtifactOptions.Account != nil { + builder.AddQuery("account", fmt.Sprint(*uploadArtifactOptions.Account)) + } + + _, err = builder.SetBodyContent(core.StringNilMapper(uploadArtifactOptions.ContentType), nil, nil, uploadArtifactOptions.Artifact) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + response, err = globalCatalog.Service.Request(request, nil) + + return +} + +// DeleteArtifact : Delete artifact +// This endpoint deletes an artifact. Only administrators and editors can delete artifacts. +func (globalCatalog *GlobalCatalogV1) DeleteArtifact(deleteArtifactOptions *DeleteArtifactOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteArtifactOptions, "deleteArtifactOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteArtifactOptions, "deleteArtifactOptions") + if err != nil { + return + } + + pathSegments := []string{"", "artifacts"} + pathParameters := []string{*deleteArtifactOptions.ObjectID, *deleteArtifactOptions.ArtifactID} + + builder := core.NewRequestBuilder(core.DELETE) + _, err = builder.ConstructHTTPURL(globalCatalog.Service.Options.URL, pathSegments, pathParameters) + if err != nil { + return + } + + for headerName, headerValue := range deleteArtifactOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("global_catalog", "V1", "DeleteArtifact") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + if deleteArtifactOptions.Account != nil { + builder.AddQuery("account", fmt.Sprint(*deleteArtifactOptions.Account)) + } + + request, err := builder.Build() + if err != nil { + return + } + + response, err = globalCatalog.Service.Request(request, nil) + + return +} + +// AliasMetaData : Alias-related metadata. +type AliasMetaData struct { + // Type of alias. + Type *string `json:"type,omitempty"` + + // Points to the plan that this object is an alias for. + PlanID *string `json:"plan_id,omitempty"` +} + + +// UnmarshalAliasMetaData unmarshals an instance of AliasMetaData from the specified map of raw messages. +func UnmarshalAliasMetaData(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(AliasMetaData) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "plan_id", &obj.PlanID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Amount : Country-specific pricing information. +type Amount struct { + // Country. + Country *string `json:"country,omitempty"` + + // Currency. + Currency *string `json:"currency,omitempty"` + + // See Price for nested fields. + Prices []Price `json:"prices,omitempty"` +} + + +// UnmarshalAmount unmarshals an instance of Amount from the specified map of raw messages. +func UnmarshalAmount(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Amount) + err = core.UnmarshalPrimitive(m, "country", &obj.Country) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "currency", &obj.Currency) + if err != nil { + return + } + err = core.UnmarshalModel(m, "prices", &obj.Prices, UnmarshalPrice) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Artifact : Artifact Details. +type Artifact struct { + // The name of the artifact. + Name *string `json:"name,omitempty"` + + // The timestamp of the last update to the artifact. + Updated *strfmt.DateTime `json:"updated,omitempty"` + + // The url for the artifact. + URL *string `json:"url,omitempty"` + + // The etag of the artifact. + Etag *string `json:"etag,omitempty"` + + // The content length of the artifact. + Size *int64 `json:"size,omitempty"` +} + + +// UnmarshalArtifact unmarshals an instance of Artifact from the specified map of raw messages. +func UnmarshalArtifact(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Artifact) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated", &obj.Updated) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "url", &obj.URL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "etag", &obj.Etag) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "size", &obj.Size) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Artifacts : Artifacts List. +type Artifacts struct { + // The total number of artifacts. + Count *int64 `json:"count,omitempty"` + + // The list of artifacts. + Resources []Artifact `json:"resources,omitempty"` +} + + +// UnmarshalArtifacts unmarshals an instance of Artifacts from the specified map of raw messages. +func UnmarshalArtifacts(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Artifacts) + err = core.UnmarshalPrimitive(m, "count", &obj.Count) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resources", &obj.Resources, UnmarshalArtifact) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AuditSearchResult : A paginated search result containing audit logs. +type AuditSearchResult struct { + // The offset (origin 0) of the first resource in this page of search results. + Offset *int64 `json:"offset,omitempty"` + + // The maximum number of resources returned in each page of search results. + Limit *int64 `json:"limit,omitempty"` + + // The overall total number of resources in the search result set. + Count *int64 `json:"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"` + + // The resources (audit messages) contained in this page of search results. + Resources []Message `json:"resources,omitempty"` +} + + +// UnmarshalAuditSearchResult unmarshals an instance of AuditSearchResult from the specified map of raw messages. +func UnmarshalAuditSearchResult(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(AuditSearchResult) + 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, "count", &obj.Count) + 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, UnmarshalMessage) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Broker : The broker associated with a catalog entry. +type Broker struct { + // Broker name. + Name *string `json:"name,omitempty"` + + // Broker guid. + Guid *string `json:"guid,omitempty"` +} + + +// UnmarshalBroker unmarshals an instance of Broker from the specified map of raw messages. +func UnmarshalBroker(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Broker) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "guid", &obj.Guid) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Bullets : Information related to list delimiters. +type Bullets struct { + // The bullet title. + Title *string `json:"title,omitempty"` + + // The bullet description. + Description *string `json:"description,omitempty"` + + // The icon to use for rendering the bullet. + Icon *string `json:"icon,omitempty"` + + // The bullet quantity. + Quantity *int64 `json:"quantity,omitempty"` +} + + +// UnmarshalBullets unmarshals an instance of Bullets from the specified map of raw messages. +func UnmarshalBullets(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Bullets) + err = core.UnmarshalPrimitive(m, "title", &obj.Title) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "description", &obj.Description) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "icon", &obj.Icon) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "quantity", &obj.Quantity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// CFMetaData : Service-related metadata. +type CFMetaData struct { + // Type of service. + Type *string `json:"type,omitempty"` + + // Boolean value that describes whether the service is compatible with Identity and Access Management. + IamCompatible *bool `json:"iam_compatible,omitempty"` + + // Boolean value that describes whether the service has a unique API key. + UniqueApiKey *bool `json:"unique_api_key,omitempty"` + + // Boolean value that describes whether the service is provisionable or not. You may need sales or support to create + // this service. + Provisionable *bool `json:"provisionable,omitempty"` + + // Boolean value that describes whether you can create bindings for this service. + Bindable *bool `json:"bindable,omitempty"` + + // Boolean value that describes whether the service supports asynchronous provisioning. + AsyncProvisioningSupported *bool `json:"async_provisioning_supported,omitempty"` + + // Boolean value that describes whether the service supports asynchronous unprovisioning. + AsyncUnprovisioningSupported *bool `json:"async_unprovisioning_supported,omitempty"` + + // Service dependencies. + Requires []string `json:"requires,omitempty"` + + // Boolean value that describes whether the service supports upgrade or downgrade for some plans. + PlanUpdateable *bool `json:"plan_updateable,omitempty"` + + // String that describes whether the service is active or inactive. + State *string `json:"state,omitempty"` + + // Boolean value that describes whether the service check is enabled. + ServiceCheckEnabled *bool `json:"service_check_enabled,omitempty"` + + // Test check interval. + TestCheckInterval *int64 `json:"test_check_interval,omitempty"` + + // Boolean value that describes whether the service supports service keys. + ServiceKeySupported *bool `json:"service_key_supported,omitempty"` + + // If the field is imported from Cloud Foundry, the Cloud Foundry region's GUID. This is a required field. For example, + // `us-south=123`. + CfGuid map[string]string `json:"cf_guid,omitempty"` +} + + +// UnmarshalCFMetaData unmarshals an instance of CFMetaData from the specified map of raw messages. +func UnmarshalCFMetaData(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CFMetaData) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "iam_compatible", &obj.IamCompatible) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "unique_api_key", &obj.UniqueApiKey) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "provisionable", &obj.Provisionable) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "bindable", &obj.Bindable) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "async_provisioning_supported", &obj.AsyncProvisioningSupported) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "async_unprovisioning_supported", &obj.AsyncUnprovisioningSupported) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "requires", &obj.Requires) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "plan_updateable", &obj.PlanUpdateable) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "state", &obj.State) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "service_check_enabled", &obj.ServiceCheckEnabled) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "test_check_interval", &obj.TestCheckInterval) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "service_key_supported", &obj.ServiceKeySupported) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cf_guid", &obj.CfGuid) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Callbacks : Callback-related information associated with a catalog entry. +type Callbacks struct { + // The URL of the deployment controller. + ControllerURL *string `json:"controller_url,omitempty"` + + // The URL of the deployment broker. + BrokerURL *string `json:"broker_url,omitempty"` + + // The URL of the deployment broker SC proxy. + BrokerProxyURL *string `json:"broker_proxy_url,omitempty"` + + // The URL of dashboard callback. + DashboardURL *string `json:"dashboard_url,omitempty"` + + // The URL of dashboard data. + DashboardDataURL *string `json:"dashboard_data_url,omitempty"` + + // The URL of the dashboard detail tab. + DashboardDetailTabURL *string `json:"dashboard_detail_tab_url,omitempty"` + + // The URL of the dashboard detail tab extension. + DashboardDetailTabExtURL *string `json:"dashboard_detail_tab_ext_url,omitempty"` + + // Service monitor API URL. + ServiceMonitorApi *string `json:"service_monitor_api,omitempty"` + + // Service monitor app URL. + ServiceMonitorApp *string `json:"service_monitor_app,omitempty"` + + // API endpoint. + ApiEndpoint map[string]string `json:"api_endpoint,omitempty"` +} + + +// UnmarshalCallbacks unmarshals an instance of Callbacks from the specified map of raw messages. +func UnmarshalCallbacks(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Callbacks) + err = core.UnmarshalPrimitive(m, "controller_url", &obj.ControllerURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "broker_url", &obj.BrokerURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "broker_proxy_url", &obj.BrokerProxyURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "dashboard_url", &obj.DashboardURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "dashboard_data_url", &obj.DashboardDataURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "dashboard_detail_tab_url", &obj.DashboardDetailTabURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "dashboard_detail_tab_ext_url", &obj.DashboardDetailTabExtURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "service_monitor_api", &obj.ServiceMonitorApi) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "service_monitor_app", &obj.ServiceMonitorApp) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "api_endpoint", &obj.ApiEndpoint) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// CatalogEntry : An entry in the global catalog. +type CatalogEntry struct { + // Programmatic name for this catalog entry, which must be formatted like a CRN segment. See the display name in + // OverviewUI for a user-readable name. + Name *string `json:"name" validate:"required"` + + // The type of catalog entry, **service**, **template**, **dashboard**, which determines the type and shape of the + // object. + Kind *string `json:"kind" validate:"required"` + + // Overview is nested in the top level. The key value pair is `[_language_]overview_ui`. + OverviewUi *OverviewUI `json:"overview_ui" validate:"required"` + + // Image annotation for this catalog entry. The image is a URL. + Images *Image `json:"images" validate:"required"` + + // The ID of the parent catalog entry if it exists. + ParentID *string `json:"parent_id,omitempty"` + + // Boolean value that determines the global visibility for the catalog entry, and its children. If it is not enabled, + // all plans are disabled. + Disabled *bool `json:"disabled" validate:"required"` + + // A list of tags. For example, IBM, 3rd Party, Beta, GA, and Single Tenant. + Tags []string `json:"tags" validate:"required"` + + // Boolean value that determines whether the catalog entry is a group. + Group *bool `json:"group,omitempty"` + + // Information related to the provider associated with a catalog entry. + Provider *Provider `json:"provider" validate:"required"` + + // Boolean value that describes whether the service is active. + Active *bool `json:"active,omitempty"` + + // Model used to describe metadata object returned. + Metadata *CatalogEntryMetadata `json:"metadata,omitempty"` + + // Catalog entry's unique ID. It's the same across all catalog instances. + ID *string `json:"id,omitempty"` + + CatalogCrn interface{} `json:"catalog_crn,omitempty"` + + URL interface{} `json:"url,omitempty"` + + ChildrenURL interface{} `json:"children_url,omitempty"` + + GeoTags interface{} `json:"geo_tags,omitempty"` + + PricingTags interface{} `json:"pricing_tags,omitempty"` + + Created interface{} `json:"created,omitempty"` + + Updated interface{} `json:"updated,omitempty"` +} + +// Constants associated with the CatalogEntry.Kind property. +// The type of catalog entry, **service**, **template**, **dashboard**, which determines the type and shape of the +// object. +const ( + CatalogEntry_Kind_Dashboard = "dashboard" + CatalogEntry_Kind_Service = "service" + CatalogEntry_Kind_Template = "template" +) + + +// UnmarshalCatalogEntry unmarshals an instance of CatalogEntry from the specified map of raw messages. +func UnmarshalCatalogEntry(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CatalogEntry) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "kind", &obj.Kind) + if err != nil { + return + } + err = core.UnmarshalModel(m, "overview_ui", &obj.OverviewUi, UnmarshalOverviewUI) + if err != nil { + return + } + err = core.UnmarshalModel(m, "images", &obj.Images, UnmarshalImage) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "parent_id", &obj.ParentID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "disabled", &obj.Disabled) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "group", &obj.Group) + if err != nil { + return + } + err = core.UnmarshalModel(m, "provider", &obj.Provider, UnmarshalProvider) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "active", &obj.Active) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata", &obj.Metadata, UnmarshalCatalogEntryMetadata) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "catalog_crn", &obj.CatalogCrn) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "url", &obj.URL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "children_url", &obj.ChildrenURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "geo_tags", &obj.GeoTags) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "pricing_tags", &obj.PricingTags) + 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 + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// CatalogEntryMetadata : Model used to describe metadata object returned. +type CatalogEntryMetadata struct { + // Boolean value that describes whether the service is compatible with the Resource Controller. + RcCompatible *bool `json:"rc_compatible,omitempty"` + + // Service-related metadata. + Service *CFMetaData `json:"service,omitempty"` + + // Plan-related metadata. + Plan *PlanMetaData `json:"plan,omitempty"` + + // Alias-related metadata. + Alias *AliasMetaData `json:"alias,omitempty"` + + // Template-related metadata. + Template *TemplateMetaData `json:"template,omitempty"` + + // Information related to the UI presentation associated with a catalog entry. + Ui *UIMetaData `json:"ui,omitempty"` + + // Compliance information for HIPAA and PCI. + Compliance []string `json:"compliance,omitempty"` + + // Service Level Agreement related metadata. + Sla *SLAMetaData `json:"sla,omitempty"` + + // Callback-related information associated with a catalog entry. + Callbacks *Callbacks `json:"callbacks,omitempty"` + + // The original name of the object. + OriginalName *string `json:"original_name,omitempty"` + + // Optional version of the object. + Version *string `json:"version,omitempty"` + + // Additional information. + Other map[string]interface{} `json:"other,omitempty"` + + // Pricing-related information. + Pricing *CatalogEntryMetadataPricing `json:"pricing,omitempty"` + + // Deployment-related metadata. + Deployment *CatalogEntryMetadataDeployment `json:"deployment,omitempty"` +} + + +// UnmarshalCatalogEntryMetadata unmarshals an instance of CatalogEntryMetadata from the specified map of raw messages. +func UnmarshalCatalogEntryMetadata(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CatalogEntryMetadata) + err = core.UnmarshalPrimitive(m, "rc_compatible", &obj.RcCompatible) + if err != nil { + return + } + err = core.UnmarshalModel(m, "service", &obj.Service, UnmarshalCFMetaData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "plan", &obj.Plan, UnmarshalPlanMetaData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "alias", &obj.Alias, UnmarshalAliasMetaData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "template", &obj.Template, UnmarshalTemplateMetaData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ui", &obj.Ui, UnmarshalUIMetaData) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "compliance", &obj.Compliance) + if err != nil { + return + } + err = core.UnmarshalModel(m, "sla", &obj.Sla, UnmarshalSLAMetaData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "callbacks", &obj.Callbacks, UnmarshalCallbacks) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "original_name", &obj.OriginalName) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "version", &obj.Version) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "other", &obj.Other) + if err != nil { + return + } + err = core.UnmarshalModel(m, "pricing", &obj.Pricing, UnmarshalCatalogEntryMetadataPricing) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deployment", &obj.Deployment, UnmarshalCatalogEntryMetadataDeployment) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// CatalogEntryMetadataDeployment : Deployment-related metadata. +type CatalogEntryMetadataDeployment struct { + // Describes the region where the service is located. + Location *string `json:"location,omitempty"` + + // Pointer to the location resource in the catalog. + LocationURL *string `json:"location_url,omitempty"` + + // Original service location. + OriginalLocation *string `json:"original_location,omitempty"` + + // A CRN that describes the deployment. crn:v1:[cname]:[ctype]:[location]:[scope]::[resource-type]:[resource]. + TargetCrn *string `json:"target_crn,omitempty"` + + // CRN for the service. + ServiceCrn *string `json:"service_crn,omitempty"` + + // ID for MCCP. + MccpID *string `json:"mccp_id,omitempty"` + + // The broker associated with a catalog entry. + Broker *Broker `json:"broker,omitempty"` + + // This deployment not only supports RC but is ready to migrate and support the RC broker for a location. + SupportsRcMigration *bool `json:"supports_rc_migration,omitempty"` + + // network to use during deployment. + TargetNetwork *string `json:"target_network,omitempty"` +} + + +// UnmarshalCatalogEntryMetadataDeployment unmarshals an instance of CatalogEntryMetadataDeployment from the specified map of raw messages. +func UnmarshalCatalogEntryMetadataDeployment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CatalogEntryMetadataDeployment) + err = core.UnmarshalPrimitive(m, "location", &obj.Location) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "location_url", &obj.LocationURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "original_location", &obj.OriginalLocation) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "target_crn", &obj.TargetCrn) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "service_crn", &obj.ServiceCrn) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mccp_id", &obj.MccpID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "broker", &obj.Broker, UnmarshalBroker) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "supports_rc_migration", &obj.SupportsRcMigration) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "target_network", &obj.TargetNetwork) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// CatalogEntryMetadataPricing : Pricing-related information. +type CatalogEntryMetadataPricing struct { + // Type of plan. Valid values are `free`, `trial`, `paygo`, `bluemix-subscription`, and `ibm-subscription`. + Type *string `json:"type,omitempty"` + + // Defines where the pricing originates. + Origin *string `json:"origin,omitempty"` + + // Plan-specific starting price information. + StartingPrice *StartingPrice `json:"starting_price,omitempty"` + + // Plan-specific cost metric structure. + Metrics []Metrics `json:"metrics,omitempty"` +} + + +// UnmarshalCatalogEntryMetadataPricing unmarshals an instance of CatalogEntryMetadataPricing from the specified map of raw messages. +func UnmarshalCatalogEntryMetadataPricing(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CatalogEntryMetadataPricing) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "origin", &obj.Origin) + if err != nil { + return + } + err = core.UnmarshalModel(m, "starting_price", &obj.StartingPrice, UnmarshalStartingPrice) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metrics", &obj.Metrics, UnmarshalMetrics) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// CreateCatalogEntryOptions : The CreateCatalogEntry options. +type CreateCatalogEntryOptions struct { + // Programmatic name for this catalog entry, which must be formatted like a CRN segment. See the display name in + // OverviewUI for a user-readable name. + Name *string `json:"name" validate:"required"` + + // The type of catalog entry, **service**, **template**, **dashboard**, which determines the type and shape of the + // object. + Kind *string `json:"kind" validate:"required"` + + // Overview is nested in the top level. The key value pair is `[_language_]overview_ui`. + OverviewUi *OverviewUI `json:"overview_ui" validate:"required"` + + // Image annotation for this catalog entry. The image is a URL. + Images *Image `json:"images" validate:"required"` + + // Boolean value that determines the global visibility for the catalog entry, and its children. If it is not enabled, + // all plans are disabled. + Disabled *bool `json:"disabled" validate:"required"` + + // A list of tags. For example, IBM, 3rd Party, Beta, GA, and Single Tenant. + Tags []string `json:"tags" validate:"required"` + + // Information related to the provider associated with a catalog entry. + Provider *Provider `json:"provider" validate:"required"` + + // Catalog entry's unique ID. It's the same across all catalog instances. + ID *string `json:"id" validate:"required"` + + // The ID of the parent catalog entry if it exists. + ParentID *string `json:"parent_id,omitempty"` + + // Boolean value that determines whether the catalog entry is a group. + Group *bool `json:"group,omitempty"` + + // Boolean value that describes whether the service is active. + Active *bool `json:"active,omitempty"` + + // Model used to describe metadata object that can be set. + Metadata *ObjectMetadataSet `json:"metadata,omitempty"` + + // This changes the scope of the request regardless of the authorization header. Example scopes are `account` and + // `global`. `account=global` is reqired if operating with a service ID that has a global admin policy, for example + // `GET /?account=global`. + Account *string `json:"account,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateCatalogEntryOptions.Kind property. +// The type of catalog entry, **service**, **template**, **dashboard**, which determines the type and shape of the +// object. +const ( + CreateCatalogEntryOptions_Kind_Dashboard = "dashboard" + CreateCatalogEntryOptions_Kind_Service = "service" + CreateCatalogEntryOptions_Kind_Template = "template" +) + +// NewCreateCatalogEntryOptions : Instantiate CreateCatalogEntryOptions +func (*GlobalCatalogV1) NewCreateCatalogEntryOptions(name string, kind string, overviewUi *OverviewUI, images *Image, disabled bool, tags []string, provider *Provider, id string) *CreateCatalogEntryOptions { + return &CreateCatalogEntryOptions{ + Name: core.StringPtr(name), + Kind: core.StringPtr(kind), + OverviewUi: overviewUi, + Images: images, + Disabled: core.BoolPtr(disabled), + Tags: tags, + Provider: provider, + ID: core.StringPtr(id), + } +} + +// SetName : Allow user to set Name +func (options *CreateCatalogEntryOptions) SetName(name string) *CreateCatalogEntryOptions { + options.Name = core.StringPtr(name) + return options +} + +// SetKind : Allow user to set Kind +func (options *CreateCatalogEntryOptions) SetKind(kind string) *CreateCatalogEntryOptions { + options.Kind = core.StringPtr(kind) + return options +} + +// SetOverviewUi : Allow user to set OverviewUi +func (options *CreateCatalogEntryOptions) SetOverviewUi(overviewUi *OverviewUI) *CreateCatalogEntryOptions { + options.OverviewUi = overviewUi + return options +} + +// SetImages : Allow user to set Images +func (options *CreateCatalogEntryOptions) SetImages(images *Image) *CreateCatalogEntryOptions { + options.Images = images + return options +} + +// SetDisabled : Allow user to set Disabled +func (options *CreateCatalogEntryOptions) SetDisabled(disabled bool) *CreateCatalogEntryOptions { + options.Disabled = core.BoolPtr(disabled) + return options +} + +// SetTags : Allow user to set Tags +func (options *CreateCatalogEntryOptions) SetTags(tags []string) *CreateCatalogEntryOptions { + options.Tags = tags + return options +} + +// SetProvider : Allow user to set Provider +func (options *CreateCatalogEntryOptions) SetProvider(provider *Provider) *CreateCatalogEntryOptions { + options.Provider = provider + return options +} + +// SetID : Allow user to set ID +func (options *CreateCatalogEntryOptions) SetID(id string) *CreateCatalogEntryOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetParentID : Allow user to set ParentID +func (options *CreateCatalogEntryOptions) SetParentID(parentID string) *CreateCatalogEntryOptions { + options.ParentID = core.StringPtr(parentID) + return options +} + +// SetGroup : Allow user to set Group +func (options *CreateCatalogEntryOptions) SetGroup(group bool) *CreateCatalogEntryOptions { + options.Group = core.BoolPtr(group) + return options +} + +// SetActive : Allow user to set Active +func (options *CreateCatalogEntryOptions) SetActive(active bool) *CreateCatalogEntryOptions { + options.Active = core.BoolPtr(active) + return options +} + +// SetMetadata : Allow user to set Metadata +func (options *CreateCatalogEntryOptions) SetMetadata(metadata *ObjectMetadataSet) *CreateCatalogEntryOptions { + options.Metadata = metadata + return options +} + +// SetAccount : Allow user to set Account +func (options *CreateCatalogEntryOptions) SetAccount(account string) *CreateCatalogEntryOptions { + options.Account = core.StringPtr(account) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateCatalogEntryOptions) SetHeaders(param map[string]string) *CreateCatalogEntryOptions { + options.Headers = param + return options +} + +// DRMetaData : SLA Disaster Recovery-related metadata. +type DRMetaData struct { + // Required boolean value that describes whether disaster recovery is on. + Dr *bool `json:"dr,omitempty"` + + // Description of the disaster recovery implementation. + Description *string `json:"description,omitempty"` +} + + +// UnmarshalDRMetaData unmarshals an instance of DRMetaData from the specified map of raw messages. +func UnmarshalDRMetaData(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DRMetaData) + err = core.UnmarshalPrimitive(m, "dr", &obj.Dr) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "description", &obj.Description) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DeleteArtifactOptions : The DeleteArtifact options. +type DeleteArtifactOptions struct { + // The object's unique ID. + ObjectID *string `json:"object_id" validate:"required"` + + // The artifact's ID. + ArtifactID *string `json:"artifact_id" validate:"required"` + + // This changes the scope of the request regardless of the authorization header. Example scopes are `account` and + // `global`. `account=global` is reqired if operating with a service ID that has a global admin policy, for example + // `GET /?account=global`. + Account *string `json:"account,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteArtifactOptions : Instantiate DeleteArtifactOptions +func (*GlobalCatalogV1) NewDeleteArtifactOptions(objectID string, artifactID string) *DeleteArtifactOptions { + return &DeleteArtifactOptions{ + ObjectID: core.StringPtr(objectID), + ArtifactID: core.StringPtr(artifactID), + } +} + +// SetObjectID : Allow user to set ObjectID +func (options *DeleteArtifactOptions) SetObjectID(objectID string) *DeleteArtifactOptions { + options.ObjectID = core.StringPtr(objectID) + return options +} + +// SetArtifactID : Allow user to set ArtifactID +func (options *DeleteArtifactOptions) SetArtifactID(artifactID string) *DeleteArtifactOptions { + options.ArtifactID = core.StringPtr(artifactID) + return options +} + +// SetAccount : Allow user to set Account +func (options *DeleteArtifactOptions) SetAccount(account string) *DeleteArtifactOptions { + options.Account = core.StringPtr(account) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteArtifactOptions) SetHeaders(param map[string]string) *DeleteArtifactOptions { + options.Headers = param + return options +} + +// DeleteCatalogEntryOptions : The DeleteCatalogEntry options. +type DeleteCatalogEntryOptions struct { + // The object's unique ID. + ID *string `json:"id" validate:"required"` + + // This changes the scope of the request regardless of the authorization header. Example scopes are `account` and + // `global`. `account=global` is reqired if operating with a service ID that has a global admin policy, for example + // `GET /?account=global`. + Account *string `json:"account,omitempty"` + + // This will cause entry to be deleted fully. By default it is archived for two weeks, so that it can be restored if + // necessary. + Force *bool `json:"force,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteCatalogEntryOptions : Instantiate DeleteCatalogEntryOptions +func (*GlobalCatalogV1) NewDeleteCatalogEntryOptions(id string) *DeleteCatalogEntryOptions { + return &DeleteCatalogEntryOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *DeleteCatalogEntryOptions) SetID(id string) *DeleteCatalogEntryOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetAccount : Allow user to set Account +func (options *DeleteCatalogEntryOptions) SetAccount(account string) *DeleteCatalogEntryOptions { + options.Account = core.StringPtr(account) + return options +} + +// SetForce : Allow user to set Force +func (options *DeleteCatalogEntryOptions) SetForce(force bool) *DeleteCatalogEntryOptions { + options.Force = core.BoolPtr(force) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteCatalogEntryOptions) SetHeaders(param map[string]string) *DeleteCatalogEntryOptions { + options.Headers = param + return options +} + +// DeploymentBase : Deployment-related metadata. +type DeploymentBase struct { + // Describes the region where the service is located. + Location *string `json:"location,omitempty"` + + // URL of deployment. + LocationURL *string `json:"location_url,omitempty"` + + // Original service location. + OriginalLocation *string `json:"original_location,omitempty"` + + // A CRN that describes the deployment. crn:v1:[cname]:[ctype]:[location]:[scope]::[resource-type]:[resource]. + TargetCrn *string `json:"target_crn,omitempty"` + + // CRN for the service. + ServiceCrn *string `json:"service_crn,omitempty"` + + // ID for MCCP. + MccpID *string `json:"mccp_id,omitempty"` + + // The broker associated with a catalog entry. + Broker *Broker `json:"broker,omitempty"` + + // This deployment not only supports RC but is ready to migrate and support the RC broker for a location. + SupportsRcMigration *bool `json:"supports_rc_migration,omitempty"` + + // network to use during deployment. + TargetNetwork *string `json:"target_network,omitempty"` +} + + +// UnmarshalDeploymentBase unmarshals an instance of DeploymentBase from the specified map of raw messages. +func UnmarshalDeploymentBase(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DeploymentBase) + err = core.UnmarshalPrimitive(m, "location", &obj.Location) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "location_url", &obj.LocationURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "original_location", &obj.OriginalLocation) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "target_crn", &obj.TargetCrn) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "service_crn", &obj.ServiceCrn) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mccp_id", &obj.MccpID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "broker", &obj.Broker, UnmarshalBroker) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "supports_rc_migration", &obj.SupportsRcMigration) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "target_network", &obj.TargetNetwork) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EntrySearchResult : A paginated search result containing catalog entries. +type EntrySearchResult struct { + // The offset (origin 0) of the first resource in this page of search results. + Offset *int64 `json:"offset,omitempty"` + + // The maximum number of resources returned in each page of search results. + Limit *int64 `json:"limit,omitempty"` + + // The overall total number of resources in the search result set. + Count *int64 `json:"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"` + + // The resources (catalog entries) contained in this page of search results. + Resources []CatalogEntry `json:"resources,omitempty"` +} + + +// UnmarshalEntrySearchResult unmarshals an instance of EntrySearchResult from the specified map of raw messages. +func UnmarshalEntrySearchResult(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EntrySearchResult) + 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, "count", &obj.Count) + 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, UnmarshalCatalogEntry) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// GetArtifactOptions : The GetArtifact options. +type GetArtifactOptions struct { + // The object's unique ID. + ObjectID *string `json:"object_id" validate:"required"` + + // The artifact's ID. + ArtifactID *string `json:"artifact_id" validate:"required"` + + // The type of the response: or *_/_*. + Accept *string `json:"Accept,omitempty"` + + // This changes the scope of the request regardless of the authorization header. Example scopes are `account` and + // `global`. `account=global` is reqired if operating with a service ID that has a global admin policy, for example + // `GET /?account=global`. + Account *string `json:"account,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetArtifactOptions : Instantiate GetArtifactOptions +func (*GlobalCatalogV1) NewGetArtifactOptions(objectID string, artifactID string) *GetArtifactOptions { + return &GetArtifactOptions{ + ObjectID: core.StringPtr(objectID), + ArtifactID: core.StringPtr(artifactID), + } +} + +// SetObjectID : Allow user to set ObjectID +func (options *GetArtifactOptions) SetObjectID(objectID string) *GetArtifactOptions { + options.ObjectID = core.StringPtr(objectID) + return options +} + +// SetArtifactID : Allow user to set ArtifactID +func (options *GetArtifactOptions) SetArtifactID(artifactID string) *GetArtifactOptions { + options.ArtifactID = core.StringPtr(artifactID) + return options +} + +// SetAccept : Allow user to set Accept +func (options *GetArtifactOptions) SetAccept(accept string) *GetArtifactOptions { + options.Accept = core.StringPtr(accept) + return options +} + +// SetAccount : Allow user to set Account +func (options *GetArtifactOptions) SetAccount(account string) *GetArtifactOptions { + options.Account = core.StringPtr(account) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetArtifactOptions) SetHeaders(param map[string]string) *GetArtifactOptions { + options.Headers = param + return options +} + +// GetAuditLogsOptions : The GetAuditLogs options. +type GetAuditLogsOptions struct { + // The object's unique ID. + ID *string `json:"id" validate:"required"` + + // This changes the scope of the request regardless of the authorization header. Example scopes are `account` and + // `global`. `account=global` is reqired if operating with a service ID that has a global admin policy, for example + // `GET /?account=global`. + Account *string `json:"account,omitempty"` + + // Sets the sort order. False is descending. + Ascending *string `json:"ascending,omitempty"` + + // Starting time for the logs. If it's descending then the entries will be equal or earlier. The default is latest. For + // ascending it will entries equal or later. The default is earliest. It can be either a number or a string. If a + // number then it is in the format of Unix timestamps. If it is a string then it is a date in the format + // YYYY-MM-DDTHH:MM:SSZ and the time is UTC. The T and the Z are required. For example: 2017-12-24T12:00:00Z for Noon + // UTC on Dec 24, 2017. + Startat *string `json:"startat,omitempty"` + + // Count of number of log entries to skip before returning logs. The default is zero. + Offset *int64 `json:"_offset,omitempty"` + + // Count of number of entries to return. The default is fifty. The maximum value is two hundred. + Limit *int64 `json:"_limit,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetAuditLogsOptions : Instantiate GetAuditLogsOptions +func (*GlobalCatalogV1) NewGetAuditLogsOptions(id string) *GetAuditLogsOptions { + return &GetAuditLogsOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *GetAuditLogsOptions) SetID(id string) *GetAuditLogsOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetAccount : Allow user to set Account +func (options *GetAuditLogsOptions) SetAccount(account string) *GetAuditLogsOptions { + options.Account = core.StringPtr(account) + return options +} + +// SetAscending : Allow user to set Ascending +func (options *GetAuditLogsOptions) SetAscending(ascending string) *GetAuditLogsOptions { + options.Ascending = core.StringPtr(ascending) + return options +} + +// SetStartat : Allow user to set Startat +func (options *GetAuditLogsOptions) SetStartat(startat string) *GetAuditLogsOptions { + options.Startat = core.StringPtr(startat) + return options +} + +// SetOffset : Allow user to set Offset +func (options *GetAuditLogsOptions) SetOffset(offset int64) *GetAuditLogsOptions { + options.Offset = core.Int64Ptr(offset) + return options +} + +// SetLimit : Allow user to set Limit +func (options *GetAuditLogsOptions) SetLimit(limit int64) *GetAuditLogsOptions { + options.Limit = core.Int64Ptr(limit) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetAuditLogsOptions) SetHeaders(param map[string]string) *GetAuditLogsOptions { + options.Headers = param + return options +} + +// GetCatalogEntryOptions : The GetCatalogEntry options. +type GetCatalogEntryOptions struct { + // The catalog entry's unqiue ID. + ID *string `json:"id" validate:"required"` + + // This changes the scope of the request regardless of the authorization header. Example scopes are `account` and + // `global`. `account=global` is reqired if operating with a service ID that has a global admin policy, for example + // `GET /?account=global`. + Account *string `json:"account,omitempty"` + + // A GET call by default returns a basic set of properties. To include other properties, you must add this parameter. A + // wildcard (`*`) includes all properties for an object, for example `GET /id?include=*`. To include specific metadata + // fields, separate each field with a colon (:), for example `GET /id?include=metadata.ui:metadata.pricing`. + Include *string `json:"include,omitempty"` + + // Return the data strings in the specified langauge. By default the strings returned are of the language preferred by + // your browser through the Accept-Langauge header, which allows an override of the header. Languages are specified in + // standard form, such as `en-us`. To include all languages use a wildcard (*). + Languages *string `json:"languages,omitempty"` + + // Returns all available fields for all languages. Use the value `?complete=true` as shortcut for + // ?include=*&languages=*. + Complete *string `json:"complete,omitempty"` + + // Return the children down to the requested depth. Use * to include the entire children tree. If there are more + // children than the maximum permitted an error will be returned. Be judicious with this as it can cause a large number + // of database accesses and can result in a large amount of data returned. + Depth *int64 `json:"depth,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetCatalogEntryOptions : Instantiate GetCatalogEntryOptions +func (*GlobalCatalogV1) NewGetCatalogEntryOptions(id string) *GetCatalogEntryOptions { + return &GetCatalogEntryOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *GetCatalogEntryOptions) SetID(id string) *GetCatalogEntryOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetAccount : Allow user to set Account +func (options *GetCatalogEntryOptions) SetAccount(account string) *GetCatalogEntryOptions { + options.Account = core.StringPtr(account) + return options +} + +// SetInclude : Allow user to set Include +func (options *GetCatalogEntryOptions) SetInclude(include string) *GetCatalogEntryOptions { + options.Include = core.StringPtr(include) + return options +} + +// SetLanguages : Allow user to set Languages +func (options *GetCatalogEntryOptions) SetLanguages(languages string) *GetCatalogEntryOptions { + options.Languages = core.StringPtr(languages) + return options +} + +// SetComplete : Allow user to set Complete +func (options *GetCatalogEntryOptions) SetComplete(complete string) *GetCatalogEntryOptions { + options.Complete = core.StringPtr(complete) + return options +} + +// SetDepth : Allow user to set Depth +func (options *GetCatalogEntryOptions) SetDepth(depth int64) *GetCatalogEntryOptions { + options.Depth = core.Int64Ptr(depth) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetCatalogEntryOptions) SetHeaders(param map[string]string) *GetCatalogEntryOptions { + options.Headers = param + return options +} + +// GetChildObjectsOptions : The GetChildObjects options. +type GetChildObjectsOptions struct { + // The parent catalog entry's ID. + ID *string `json:"id" validate:"required"` + + // The **kind** of child catalog entries to search for. A wildcard (*) includes all child catalog entries for all + // kinds, for example `GET /service_name/_*`. + Kind *string `json:"kind" validate:"required"` + + // This changes the scope of the request regardless of the authorization header. Example scopes are `account` and + // `global`. `account=global` is reqired if operating with a service ID that has a global admin policy, for example + // `GET /?account=global`. + Account *string `json:"account,omitempty"` + + // A colon (:) separated list of properties to include. A GET call by defaults return a limited set of properties. To + // include other properties, you must add the include parameter. A wildcard (*) includes all properties. + Include *string `json:"include,omitempty"` + + // A query filter, for example, `q=kind:iaas IBM` will filter on entries of **kind** iaas that has `IBM` in their + // name, display name, or description. + Q *string `json:"q,omitempty"` + + // The field on which to sort the output. By default by name. Available fields are **name**, **kind**, and + // **provider**. + SortBy *string `json:"sort-by,omitempty"` + + // The sort order. The default is false, which is ascending. + Descending *string `json:"descending,omitempty"` + + // Return the data strings in the specified langauge. By default the strings returned are of the language preferred by + // your browser through the Accept-Langauge header. This allows an override of the header. Languages are specified in + // standard form, such as `en-us`. To include all languages use the wildcard (*). + Languages *string `json:"languages,omitempty"` + + // Use the value `?complete=true` as shortcut for ?include=*&languages=*. + Complete *string `json:"complete,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetChildObjectsOptions : Instantiate GetChildObjectsOptions +func (*GlobalCatalogV1) NewGetChildObjectsOptions(id string, kind string) *GetChildObjectsOptions { + return &GetChildObjectsOptions{ + ID: core.StringPtr(id), + Kind: core.StringPtr(kind), + } +} + +// SetID : Allow user to set ID +func (options *GetChildObjectsOptions) SetID(id string) *GetChildObjectsOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetKind : Allow user to set Kind +func (options *GetChildObjectsOptions) SetKind(kind string) *GetChildObjectsOptions { + options.Kind = core.StringPtr(kind) + return options +} + +// SetAccount : Allow user to set Account +func (options *GetChildObjectsOptions) SetAccount(account string) *GetChildObjectsOptions { + options.Account = core.StringPtr(account) + return options +} + +// SetInclude : Allow user to set Include +func (options *GetChildObjectsOptions) SetInclude(include string) *GetChildObjectsOptions { + options.Include = core.StringPtr(include) + return options +} + +// SetQ : Allow user to set Q +func (options *GetChildObjectsOptions) SetQ(q string) *GetChildObjectsOptions { + options.Q = core.StringPtr(q) + return options +} + +// SetSortBy : Allow user to set SortBy +func (options *GetChildObjectsOptions) SetSortBy(sortBy string) *GetChildObjectsOptions { + options.SortBy = core.StringPtr(sortBy) + return options +} + +// SetDescending : Allow user to set Descending +func (options *GetChildObjectsOptions) SetDescending(descending string) *GetChildObjectsOptions { + options.Descending = core.StringPtr(descending) + return options +} + +// SetLanguages : Allow user to set Languages +func (options *GetChildObjectsOptions) SetLanguages(languages string) *GetChildObjectsOptions { + options.Languages = core.StringPtr(languages) + return options +} + +// SetComplete : Allow user to set Complete +func (options *GetChildObjectsOptions) SetComplete(complete string) *GetChildObjectsOptions { + options.Complete = core.StringPtr(complete) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetChildObjectsOptions) SetHeaders(param map[string]string) *GetChildObjectsOptions { + options.Headers = param + return options +} + +// GetPricingOptions : The GetPricing options. +type GetPricingOptions struct { + // The object's unique ID. + ID *string `json:"id" validate:"required"` + + // This changes the scope of the request regardless of the authorization header. Example scopes are `account` and + // `global`. `account=global` is reqired if operating with a service ID that has a global admin policy, for example + // `GET /?account=global`. + Account *string `json:"account,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetPricingOptions : Instantiate GetPricingOptions +func (*GlobalCatalogV1) NewGetPricingOptions(id string) *GetPricingOptions { + return &GetPricingOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *GetPricingOptions) SetID(id string) *GetPricingOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetAccount : Allow user to set Account +func (options *GetPricingOptions) SetAccount(account string) *GetPricingOptions { + options.Account = core.StringPtr(account) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetPricingOptions) SetHeaders(param map[string]string) *GetPricingOptions { + options.Headers = param + return options +} + +// GetVisibilityOptions : The GetVisibility options. +type GetVisibilityOptions struct { + // The object's unique ID. + ID *string `json:"id" validate:"required"` + + // This changes the scope of the request regardless of the authorization header. Example scopes are `account` and + // `global`. `account=global` is reqired if operating with a service ID that has a global admin policy, for example + // `GET /?account=global`. + Account *string `json:"account,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVisibilityOptions : Instantiate GetVisibilityOptions +func (*GlobalCatalogV1) NewGetVisibilityOptions(id string) *GetVisibilityOptions { + return &GetVisibilityOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *GetVisibilityOptions) SetID(id string) *GetVisibilityOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetAccount : Allow user to set Account +func (options *GetVisibilityOptions) SetAccount(account string) *GetVisibilityOptions { + options.Account = core.StringPtr(account) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVisibilityOptions) SetHeaders(param map[string]string) *GetVisibilityOptions { + options.Headers = param + return options +} + +// I18N : Language specific translation of translation properties, like label and description. +type I18N struct { + + // Allows users to set arbitrary properties + additionalProperties map[string]*Strings +} + + +// SetProperty allows the user to set an arbitrary property on an instance of I18N +func (o *I18N) SetProperty(key string, value *Strings) { + if o.additionalProperties == nil { + o.additionalProperties = make(map[string]*Strings) + } + o.additionalProperties[key] = value +} + +// GetProperty allows the user to retrieve an arbitrary property from an instance of I18N +func (o *I18N) GetProperty(key string) *Strings { + return o.additionalProperties[key] +} + +// GetProperties allows the user to retrieve the map of arbitrary properties from an instance of I18N +func (o *I18N) GetProperties() map[string]*Strings { + return o.additionalProperties +} + +// MarshalJSON performs custom serialization for instances of I18N +func (o *I18N) MarshalJSON() (buffer []byte, err error) { + m := make(map[string]interface{}) + if len(o.additionalProperties) > 0 { + for k, v := range o.additionalProperties { + m[k] = v + } + } + buffer, err = json.Marshal(m) + return +} + +// UnmarshalI18N unmarshals an instance of I18N from the specified map of raw messages. +func UnmarshalI18N(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(I18N) + for k := range m { + var v *Strings + e := core.UnmarshalModel(m, k, &v, UnmarshalStrings) + if e != nil { + err = e + return + } + obj.SetProperty(k, v) + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Image : Image annotation for this catalog entry. The image is a URL. +type Image struct { + // URL for the large, default image. + Image *string `json:"image" validate:"required"` + + // URL for a small image. + SmallImage *string `json:"small_image,omitempty"` + + // URL for a medium image. + MediumImage *string `json:"medium_image,omitempty"` + + // URL for a featured image. + FeatureImage *string `json:"feature_image,omitempty"` +} + + +// NewImage : Instantiate Image (Generic Model Constructor) +func (*GlobalCatalogV1) NewImage(image string) (model *Image, err error) { + model = &Image{ + Image: core.StringPtr(image), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +// 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 + } + err = core.UnmarshalPrimitive(m, "small_image", &obj.SmallImage) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "medium_image", &obj.MediumImage) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "feature_image", &obj.FeatureImage) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ListArtifactsOptions : The ListArtifacts options. +type ListArtifactsOptions struct { + // The object's unique ID. + ObjectID *string `json:"object_id" validate:"required"` + + // This changes the scope of the request regardless of the authorization header. Example scopes are `account` and + // `global`. `account=global` is reqired if operating with a service ID that has a global admin policy, for example + // `GET /?account=global`. + Account *string `json:"account,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListArtifactsOptions : Instantiate ListArtifactsOptions +func (*GlobalCatalogV1) NewListArtifactsOptions(objectID string) *ListArtifactsOptions { + return &ListArtifactsOptions{ + ObjectID: core.StringPtr(objectID), + } +} + +// SetObjectID : Allow user to set ObjectID +func (options *ListArtifactsOptions) SetObjectID(objectID string) *ListArtifactsOptions { + options.ObjectID = core.StringPtr(objectID) + return options +} + +// SetAccount : Allow user to set Account +func (options *ListArtifactsOptions) SetAccount(account string) *ListArtifactsOptions { + options.Account = core.StringPtr(account) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListArtifactsOptions) SetHeaders(param map[string]string) *ListArtifactsOptions { + options.Headers = param + return options +} + +// ListCatalogEntriesOptions : The ListCatalogEntries options. +type ListCatalogEntriesOptions struct { + // This changes the scope of the request regardless of the authorization header. Example scopes are `account` and + // `global`. `account=global` is reqired if operating with a service ID that has a global admin policy, for example + // `GET /?account=global`. + Account *string `json:"account,omitempty"` + + // A GET call by default returns a basic set of properties. To include other properties, you must add this parameter. A + // wildcard (`*`) includes all properties for an object, for example `GET /?include=*`. To include specific metadata + // fields, separate each field with a colon (:), for example `GET /?include=metadata.ui:metadata.pricing`. + Include *string `json:"include,omitempty"` + + // Searches the catalog entries for keywords. Add filters to refine your search. A query filter, for example, + // `q=kind:iaas service_name rc:true`, filters entries of kind iaas with metadata.service.rc_compatible set to true and + // have a service name is in their name, display name, or description. Valid tags are **kind**:, + // **tag**:, **rc**:[true|false], **iam**:[true|false], **active**:[true|false], **geo**:, and + // **price**:. + Q *string `json:"q,omitempty"` + + // The field on which the output is sorted. Sorts by default by **name** property. Available fields are **name**, + // **displayname** (overview_ui.display_name), **kind**, **provider** (provider.name), **sbsindex** + // (metadata.ui.side_by_side_index), and the time **created**, and **updated**. + SortBy *string `json:"sort-by,omitempty"` + + // Sets the sort order. The default is false, which is ascending. + Descending *string `json:"descending,omitempty"` + + // Return the data strings in a specified langauge. By default, the strings returned are of the language preferred by + // your browser through the Accept-Langauge header, which allows an override of the header. Languages are specified in + // standard form, such as `en-us`. To include all languages use a wildcard (*). + Languages *string `json:"languages,omitempty"` + + // Returns all available fields for all languages. Use the value `?complete=true` as shortcut for + // ?include=*&languages=*. + Complete *string `json:"complete,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListCatalogEntriesOptions : Instantiate ListCatalogEntriesOptions +func (*GlobalCatalogV1) NewListCatalogEntriesOptions() *ListCatalogEntriesOptions { + return &ListCatalogEntriesOptions{} +} + +// SetAccount : Allow user to set Account +func (options *ListCatalogEntriesOptions) SetAccount(account string) *ListCatalogEntriesOptions { + options.Account = core.StringPtr(account) + return options +} + +// SetInclude : Allow user to set Include +func (options *ListCatalogEntriesOptions) SetInclude(include string) *ListCatalogEntriesOptions { + options.Include = core.StringPtr(include) + return options +} + +// SetQ : Allow user to set Q +func (options *ListCatalogEntriesOptions) SetQ(q string) *ListCatalogEntriesOptions { + options.Q = core.StringPtr(q) + return options +} + +// SetSortBy : Allow user to set SortBy +func (options *ListCatalogEntriesOptions) SetSortBy(sortBy string) *ListCatalogEntriesOptions { + options.SortBy = core.StringPtr(sortBy) + return options +} + +// SetDescending : Allow user to set Descending +func (options *ListCatalogEntriesOptions) SetDescending(descending string) *ListCatalogEntriesOptions { + options.Descending = core.StringPtr(descending) + return options +} + +// SetLanguages : Allow user to set Languages +func (options *ListCatalogEntriesOptions) SetLanguages(languages string) *ListCatalogEntriesOptions { + options.Languages = core.StringPtr(languages) + return options +} + +// SetComplete : Allow user to set Complete +func (options *ListCatalogEntriesOptions) SetComplete(complete string) *ListCatalogEntriesOptions { + options.Complete = core.StringPtr(complete) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListCatalogEntriesOptions) SetHeaders(param map[string]string) *ListCatalogEntriesOptions { + options.Headers = param + return options +} + +// Message : log object describing who did what. +type Message struct { + // id of catalog entry. + ID *string `json:"id,omitempty"` + + // Information related to the visibility of a catalog entry. + Effective *Visibility `json:"effective,omitempty"` + + // time of action. + Time *strfmt.DateTime `json:"time,omitempty"` + + // user ID of person who did action. + WhoID *string `json:"who_id,omitempty"` + + // name of person who did action. + WhoName *string `json:"who_name,omitempty"` + + // user email of person who did action. + WhoEmail *string `json:"who_email,omitempty"` + + // Global catalog instance where this occured. + Instance *string `json:"instance,omitempty"` + + // transaction id associatd with action. + Gid *string `json:"gid,omitempty"` + + // type of action taken. + Type *string `json:"type,omitempty"` + + // message describing action. + Message *string `json:"message,omitempty"` + + // JSON object containing details on changes made to object data. + Data interface{} `json:"data,omitempty"` +} + + +// UnmarshalMessage unmarshals an instance of Message from the specified map of raw messages. +func UnmarshalMessage(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Message) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "effective", &obj.Effective, UnmarshalVisibility) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "time", &obj.Time) + 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_email", &obj.WhoEmail) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "instance", &obj.Instance) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "gid", &obj.Gid) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "data", &obj.Data) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Metrics : Plan-specific cost metrics information. +type Metrics struct { + // The part reference. + PartRef *string `json:"part_ref,omitempty"` + + // The metric ID or part number. + MetricID *string `json:"metric_id,omitempty"` + + // The tier model. + TierModel *string `json:"tier_model,omitempty"` + + // The unit to charge. + ChargeUnit *string `json:"charge_unit,omitempty"` + + // The charge unit name. + ChargeUnitName *string `json:"charge_unit_name,omitempty"` + + // The charge unit quantity. + ChargeUnitQuantity *string `json:"charge_unit_quantity,omitempty"` + + // Display name of the resource. + ResourceDisplayName *string `json:"resource_display_name,omitempty"` + + // Display name of the charge unit. + ChargeUnitDisplayName *string `json:"charge_unit_display_name,omitempty"` + + // Usage limit for the metric. + UsageCapQty *int64 `json:"usage_cap_qty,omitempty"` + + // Display capacity. + DisplayCap *int64 `json:"display_cap,omitempty"` + + // Effective from time. + EffectiveFrom *strfmt.DateTime `json:"effective_from,omitempty"` + + // Effective until time. + EffectiveUntil *strfmt.DateTime `json:"effective_until,omitempty"` + + // The pricing per metric by country and currency. + Amounts []Amount `json:"amounts,omitempty"` +} + + +// UnmarshalMetrics unmarshals an instance of Metrics from the specified map of raw messages. +func UnmarshalMetrics(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Metrics) + err = core.UnmarshalPrimitive(m, "part_ref", &obj.PartRef) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "metric_id", &obj.MetricID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "tier_model", &obj.TierModel) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "charge_unit", &obj.ChargeUnit) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "charge_unit_name", &obj.ChargeUnitName) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "charge_unit_quantity", &obj.ChargeUnitQuantity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_display_name", &obj.ResourceDisplayName) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "charge_unit_display_name", &obj.ChargeUnitDisplayName) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "usage_cap_qty", &obj.UsageCapQty) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "display_cap", &obj.DisplayCap) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "effective_from", &obj.EffectiveFrom) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "effective_until", &obj.EffectiveUntil) + if err != nil { + return + } + err = core.UnmarshalModel(m, "amounts", &obj.Amounts, UnmarshalAmount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ObjectMetadataSet : Model used to describe metadata object that can be set. +type ObjectMetadataSet struct { + // Boolean value that describes whether the service is compatible with the Resource Controller. + RcCompatible *bool `json:"rc_compatible,omitempty"` + + // Service-related metadata. + Service *CFMetaData `json:"service,omitempty"` + + // Plan-related metadata. + Plan *PlanMetaData `json:"plan,omitempty"` + + // Alias-related metadata. + Alias *AliasMetaData `json:"alias,omitempty"` + + // Template-related metadata. + Template *TemplateMetaData `json:"template,omitempty"` + + // Information related to the UI presentation associated with a catalog entry. + Ui *UIMetaData `json:"ui,omitempty"` + + // Compliance information for HIPAA and PCI. + Compliance []string `json:"compliance,omitempty"` + + // Service Level Agreement related metadata. + Sla *SLAMetaData `json:"sla,omitempty"` + + // Callback-related information associated with a catalog entry. + Callbacks *Callbacks `json:"callbacks,omitempty"` + + // The original name of the object. + OriginalName *string `json:"original_name,omitempty"` + + // Optional version of the object. + Version *string `json:"version,omitempty"` + + // Additional information. + Other map[string]interface{} `json:"other,omitempty"` + + // Pricing-related information. + Pricing *PricingSet `json:"pricing,omitempty"` + + // Deployment-related metadata. + Deployment *DeploymentBase `json:"deployment,omitempty"` +} + + +// UnmarshalObjectMetadataSet unmarshals an instance of ObjectMetadataSet from the specified map of raw messages. +func UnmarshalObjectMetadataSet(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ObjectMetadataSet) + err = core.UnmarshalPrimitive(m, "rc_compatible", &obj.RcCompatible) + if err != nil { + return + } + err = core.UnmarshalModel(m, "service", &obj.Service, UnmarshalCFMetaData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "plan", &obj.Plan, UnmarshalPlanMetaData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "alias", &obj.Alias, UnmarshalAliasMetaData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "template", &obj.Template, UnmarshalTemplateMetaData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ui", &obj.Ui, UnmarshalUIMetaData) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "compliance", &obj.Compliance) + if err != nil { + return + } + err = core.UnmarshalModel(m, "sla", &obj.Sla, UnmarshalSLAMetaData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "callbacks", &obj.Callbacks, UnmarshalCallbacks) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "original_name", &obj.OriginalName) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "version", &obj.Version) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "other", &obj.Other) + if err != nil { + return + } + err = core.UnmarshalModel(m, "pricing", &obj.Pricing, UnmarshalPricingSet) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deployment", &obj.Deployment, UnmarshalDeploymentBase) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Overview : Overview is nested in the top level. The key value pair is `[_language_]overview_ui`. +type Overview struct { + // The translated display name. + DisplayName *string `json:"display_name" validate:"required"` + + // The translated long description. + LongDescription *string `json:"long_description" validate:"required"` + + // The translated description. + Description *string `json:"description" validate:"required"` + + // The translated description that will be featured. + FeaturedDescription *string `json:"featured_description,omitempty"` +} + + +// NewOverview : Instantiate Overview (Generic Model Constructor) +func (*GlobalCatalogV1) NewOverview(displayName string, longDescription string, description string) (model *Overview, err error) { + model = &Overview{ + DisplayName: core.StringPtr(displayName), + LongDescription: core.StringPtr(longDescription), + Description: core.StringPtr(description), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +// UnmarshalOverview unmarshals an instance of Overview from the specified map of raw messages. +func UnmarshalOverview(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Overview) + err = core.UnmarshalPrimitive(m, "display_name", &obj.DisplayName) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "long_description", &obj.LongDescription) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "description", &obj.Description) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "featured_description", &obj.FeaturedDescription) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// OverviewUI : Overview is nested in the top level. The key value pair is `[_language_]overview_ui`. +type OverviewUI struct { + + // Allows users to set arbitrary properties + additionalProperties map[string]*Overview +} + + +// SetProperty allows the user to set an arbitrary property on an instance of OverviewUI +func (o *OverviewUI) SetProperty(key string, value *Overview) { + if o.additionalProperties == nil { + o.additionalProperties = make(map[string]*Overview) + } + o.additionalProperties[key] = value +} + +// GetProperty allows the user to retrieve an arbitrary property from an instance of OverviewUI +func (o *OverviewUI) GetProperty(key string) *Overview { + return o.additionalProperties[key] +} + +// GetProperties allows the user to retrieve the map of arbitrary properties from an instance of OverviewUI +func (o *OverviewUI) GetProperties() map[string]*Overview { + return o.additionalProperties +} + +// MarshalJSON performs custom serialization for instances of OverviewUI +func (o *OverviewUI) MarshalJSON() (buffer []byte, err error) { + m := make(map[string]interface{}) + if len(o.additionalProperties) > 0 { + for k, v := range o.additionalProperties { + m[k] = v + } + } + buffer, err = json.Marshal(m) + return +} + +// UnmarshalOverviewUI unmarshals an instance of OverviewUI from the specified map of raw messages. +func UnmarshalOverviewUI(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(OverviewUI) + for k := range m { + var v *Overview + e := core.UnmarshalModel(m, k, &v, UnmarshalOverview) + if e != nil { + err = e + return + } + obj.SetProperty(k, v) + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PlanMetaData : Plan-related metadata. +type PlanMetaData struct { + // Boolean value that describes whether the service can be bound to an application. + Bindable *bool `json:"bindable,omitempty"` + + // Boolean value that describes whether the service can be reserved. + Reservable *bool `json:"reservable,omitempty"` + + // Boolean value that describes whether the service can be used internally. + AllowInternalUsers *bool `json:"allow_internal_users,omitempty"` + + // Boolean value that describes whether the service can be provisioned asynchronously. + AsyncProvisioningSupported *bool `json:"async_provisioning_supported,omitempty"` + + // Boolean value that describes whether the service can be unprovisioned asynchronously. + AsyncUnprovisioningSupported *bool `json:"async_unprovisioning_supported,omitempty"` + + // Test check interval. + TestCheckInterval *int64 `json:"test_check_interval,omitempty"` + + // Single scope instance. + SingleScopeInstance *string `json:"single_scope_instance,omitempty"` + + // Boolean value that describes whether the service check is enabled. + ServiceCheckEnabled *bool `json:"service_check_enabled,omitempty"` + + // If the field is imported from Cloud Foundry, the Cloud Foundry region's GUID. This is a required field. For example, + // `us-south=123`. + CfGuid map[string]string `json:"cf_guid,omitempty"` +} + + +// UnmarshalPlanMetaData unmarshals an instance of PlanMetaData from the specified map of raw messages. +func UnmarshalPlanMetaData(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PlanMetaData) + err = core.UnmarshalPrimitive(m, "bindable", &obj.Bindable) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "reservable", &obj.Reservable) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "allow_internal_users", &obj.AllowInternalUsers) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "async_provisioning_supported", &obj.AsyncProvisioningSupported) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "async_unprovisioning_supported", &obj.AsyncUnprovisioningSupported) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "test_check_interval", &obj.TestCheckInterval) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "single_scope_instance", &obj.SingleScopeInstance) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "service_check_enabled", &obj.ServiceCheckEnabled) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cf_guid", &obj.CfGuid) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Price : Pricing-related information. +type Price struct { + // Pricing tier. + QuantityTier *int64 `json:"quantity_tier,omitempty"` + + // Price in the selected currency. + Price *float64 `json:"Price,omitempty"` +} + + +// UnmarshalPrice unmarshals an instance of Price from the specified map of raw messages. +func UnmarshalPrice(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Price) + err = core.UnmarshalPrimitive(m, "quantity_tier", &obj.QuantityTier) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "Price", &obj.Price) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PricingGet : Pricing-related information. +type PricingGet struct { + // Type of plan. Valid values are `free`, `trial`, `paygo`, `bluemix-subscription`, and `ibm-subscription`. + Type *string `json:"type,omitempty"` + + // Defines where the pricing originates. + Origin *string `json:"origin,omitempty"` + + // Plan-specific starting price information. + StartingPrice *StartingPrice `json:"starting_price,omitempty"` + + // Plan-specific cost metric structure. + Metrics []Metrics `json:"metrics,omitempty"` +} + + +// UnmarshalPricingGet unmarshals an instance of PricingGet from the specified map of raw messages. +func UnmarshalPricingGet(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PricingGet) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "origin", &obj.Origin) + if err != nil { + return + } + err = core.UnmarshalModel(m, "starting_price", &obj.StartingPrice, UnmarshalStartingPrice) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metrics", &obj.Metrics, UnmarshalMetrics) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PricingSet : Pricing-related information. +type PricingSet struct { + // Type of plan. Valid values are `free`, `trial`, `paygo`, `bluemix-subscription`, and `ibm-subscription`. + Type *string `json:"type,omitempty"` + + // Defines where the pricing originates. + Origin *string `json:"origin,omitempty"` + + // Plan-specific starting price information. + StartingPrice *StartingPrice `json:"starting_price,omitempty"` +} + + +// UnmarshalPricingSet unmarshals an instance of PricingSet from the specified map of raw messages. +func UnmarshalPricingSet(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PricingSet) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "origin", &obj.Origin) + if err != nil { + return + } + err = core.UnmarshalModel(m, "starting_price", &obj.StartingPrice, UnmarshalStartingPrice) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Provider : Information related to the provider associated with a catalog entry. +type Provider struct { + // Provider's email address for this catalog entry. + Email *string `json:"email" validate:"required"` + + // Provider's name, for example, IBM. + Name *string `json:"name" validate:"required"` + + // Provider's contact name. + Contact *string `json:"contact,omitempty"` + + // Provider's support email. + SupportEmail *string `json:"support_email,omitempty"` + + // Provider's contact phone. + Phone *string `json:"phone,omitempty"` +} + + +// NewProvider : Instantiate Provider (Generic Model Constructor) +func (*GlobalCatalogV1) NewProvider(email string, name string) (model *Provider, err error) { + model = &Provider{ + Email: core.StringPtr(email), + Name: core.StringPtr(name), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +// UnmarshalProvider unmarshals an instance of Provider from the specified map of raw messages. +func UnmarshalProvider(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Provider) + err = core.UnmarshalPrimitive(m, "email", &obj.Email) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "contact", &obj.Contact) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "support_email", &obj.SupportEmail) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "phone", &obj.Phone) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RestoreCatalogEntryOptions : The RestoreCatalogEntry options. +type RestoreCatalogEntryOptions struct { + // The catalog entry's unique ID. + ID *string `json:"id" validate:"required"` + + // This changes the scope of the request regardless of the authorization header. Example scopes are `account` and + // `global`. `account=global` is reqired if operating with a service ID that has a global admin policy, for example + // `GET /?account=global`. + Account *string `json:"account,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewRestoreCatalogEntryOptions : Instantiate RestoreCatalogEntryOptions +func (*GlobalCatalogV1) NewRestoreCatalogEntryOptions(id string) *RestoreCatalogEntryOptions { + return &RestoreCatalogEntryOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *RestoreCatalogEntryOptions) SetID(id string) *RestoreCatalogEntryOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetAccount : Allow user to set Account +func (options *RestoreCatalogEntryOptions) SetAccount(account string) *RestoreCatalogEntryOptions { + options.Account = core.StringPtr(account) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *RestoreCatalogEntryOptions) SetHeaders(param map[string]string) *RestoreCatalogEntryOptions { + options.Headers = param + return options +} + +// SLAMetaData : Service Level Agreement related metadata. +type SLAMetaData struct { + // Required Service License Agreement Terms of Use. + Terms *string `json:"terms,omitempty"` + + // Required deployment type. Valid values are dedicated, local, or public. It can be Single or Multi tennancy, more + // specifically on a Server, VM, Physical, or Pod. + Tenancy *string `json:"tenancy,omitempty"` + + // Provisioning reliability, for example, 99.95. + Provisioning *string `json:"provisioning,omitempty"` + + // Uptime reliability of the service, for example, 99.95. + Responsiveness *string `json:"responsiveness,omitempty"` + + // SLA Disaster Recovery-related metadata. + Dr *DRMetaData `json:"dr,omitempty"` +} + + +// UnmarshalSLAMetaData unmarshals an instance of SLAMetaData from the specified map of raw messages. +func UnmarshalSLAMetaData(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SLAMetaData) + err = core.UnmarshalPrimitive(m, "terms", &obj.Terms) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "tenancy", &obj.Tenancy) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "provisioning", &obj.Provisioning) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "responsiveness", &obj.Responsiveness) + if err != nil { + return + } + err = core.UnmarshalModel(m, "dr", &obj.Dr, UnmarshalDRMetaData) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SourceMetaData : Location of your applications source files. +type SourceMetaData struct { + // Path to your application. + Path *string `json:"path,omitempty"` + + // Type of source, for example, git. + Type *string `json:"type,omitempty"` + + // URL to source. + URL *string `json:"url,omitempty"` +} + + +// UnmarshalSourceMetaData unmarshals an instance of SourceMetaData from the specified map of raw messages. +func UnmarshalSourceMetaData(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SourceMetaData) + err = core.UnmarshalPrimitive(m, "path", &obj.Path) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "url", &obj.URL) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// StartingPrice : Plan-specific starting price information. +type StartingPrice struct { + // ID of the plan the starting price is calculated. + PlanID *string `json:"plan_id,omitempty"` + + // ID of the deployment the starting price is calculated. + DeploymentID *string `json:"deployment_id,omitempty"` + + // Pricing unit. + Unit *string `json:"unit,omitempty"` + + // The pricing per metric by country and currency. + Amount []Amount `json:"amount,omitempty"` +} + + +// UnmarshalStartingPrice unmarshals an instance of StartingPrice from the specified map of raw messages. +func UnmarshalStartingPrice(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(StartingPrice) + err = core.UnmarshalPrimitive(m, "plan_id", &obj.PlanID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "deployment_id", &obj.DeploymentID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "unit", &obj.Unit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "amount", &obj.Amount, UnmarshalAmount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Strings : Information related to a translated text message. +type Strings struct { + // Presentation information related to list delimiters. + Bullets []Bullets `json:"bullets,omitempty"` + + // Media-related metadata. + Media []UIMetaMedia `json:"media,omitempty"` + + // Warning that a message is not creatable. + NotCreatableMsg *string `json:"not_creatable_msg,omitempty"` + + // Warning that a robot message is not creatable. + NotCreatableRobotMsg *string `json:"not_creatable__robot_msg,omitempty"` + + // Warning for deprecation. + DeprecationWarning *string `json:"deprecation_warning,omitempty"` + + // Popup warning message. + PopupWarningMessage *string `json:"popup_warning_message,omitempty"` + + // Instructions for UI strings. + Instruction *string `json:"instruction,omitempty"` +} + + +// UnmarshalStrings unmarshals an instance of Strings from the specified map of raw messages. +func UnmarshalStrings(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Strings) + err = core.UnmarshalModel(m, "bullets", &obj.Bullets, UnmarshalBullets) + if err != nil { + return + } + err = core.UnmarshalModel(m, "media", &obj.Media, UnmarshalUIMetaMedia) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "not_creatable_msg", &obj.NotCreatableMsg) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "not_creatable__robot_msg", &obj.NotCreatableRobotMsg) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "deprecation_warning", &obj.DeprecationWarning) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "popup_warning_message", &obj.PopupWarningMessage) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "instruction", &obj.Instruction) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// TemplateMetaData : Template-related metadata. +type TemplateMetaData struct { + // List of required offering or plan IDs. + Services []string `json:"services,omitempty"` + + // Cloud Foundry instance memory value. + DefaultMemory *int64 `json:"default_memory,omitempty"` + + // Start Command. + StartCmd *string `json:"start_cmd,omitempty"` + + // Location of your applications source files. + Source *SourceMetaData `json:"source,omitempty"` + + // ID of the runtime. + RuntimeCatalogID *string `json:"runtime_catalog_id,omitempty"` + + // ID of the Cloud Foundry runtime. + CfRuntimeID *string `json:"cf_runtime_id,omitempty"` + + // ID of the boilerplate or template. + TemplateID *string `json:"template_id,omitempty"` + + // File path to the executable file for the template. + ExecutableFile *string `json:"executable_file,omitempty"` + + // ID of the buildpack used by the template. + Buildpack *string `json:"buildpack,omitempty"` + + // Environment variables (key/value pairs) for the template. + EnvironmentVariables map[string]string `json:"environment_variables,omitempty"` +} + + +// UnmarshalTemplateMetaData unmarshals an instance of TemplateMetaData from the specified map of raw messages. +func UnmarshalTemplateMetaData(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(TemplateMetaData) + err = core.UnmarshalPrimitive(m, "services", &obj.Services) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default_memory", &obj.DefaultMemory) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "start_cmd", &obj.StartCmd) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source", &obj.Source, UnmarshalSourceMetaData) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "runtime_catalog_id", &obj.RuntimeCatalogID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cf_runtime_id", &obj.CfRuntimeID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "template_id", &obj.TemplateID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "executable_file", &obj.ExecutableFile) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "buildpack", &obj.Buildpack) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "environment_variables", &obj.EnvironmentVariables) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// UIMetaData : Information related to the UI presentation associated with a catalog entry. +type UIMetaData struct { + // Language specific translation of translation properties, like label and description. + Strings *I18N `json:"strings,omitempty"` + + // UI based URLs. + Urls *URLS `json:"urls,omitempty"` + + // Describes how the embeddable dashboard is rendered. + EmbeddableDashboard *string `json:"embeddable_dashboard,omitempty"` + + // Describes whether the embeddable dashboard is rendered at the full width. + EmbeddableDashboardFullWidth *bool `json:"embeddable_dashboard_full_width,omitempty"` + + // Defines the order of information presented. + NavigationOrder []string `json:"navigation_order,omitempty"` + + // Describes whether this entry is able to be created from the UI element or CLI. + NotCreatable *bool `json:"not_creatable,omitempty"` + + // ID of the primary offering for a group. + PrimaryOfferingID *string `json:"primary_offering_id,omitempty"` + + // Alert to ACE to allow instance UI to be accessible while the provisioning state of instance is in progress. + AccessibleDuringProvision *bool `json:"accessible_during_provision,omitempty"` + + // Specifies a side by side ordering weight to the UI. + SideBySideIndex *int64 `json:"side_by_side_index,omitempty"` + + // Date and time the service will no longer be available. + EndOfServiceTime *strfmt.DateTime `json:"end_of_service_time,omitempty"` + + // Denotes visibility. + Hidden *bool `json:"hidden,omitempty"` + + // Denotes lite metering visibility. + HideLiteMetering *bool `json:"hide_lite_metering,omitempty"` + + // Denotes whether an upgrade should occurr. + NoUpgradeNextStep *bool `json:"no_upgrade_next_step,omitempty"` +} + + +// UnmarshalUIMetaData unmarshals an instance of UIMetaData from the specified map of raw messages. +func UnmarshalUIMetaData(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(UIMetaData) + err = core.UnmarshalModel(m, "strings", &obj.Strings, UnmarshalI18N) + if err != nil { + return + } + err = core.UnmarshalModel(m, "urls", &obj.Urls, UnmarshalURLS) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "embeddable_dashboard", &obj.EmbeddableDashboard) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "embeddable_dashboard_full_width", &obj.EmbeddableDashboardFullWidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "navigation_order", &obj.NavigationOrder) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "not_creatable", &obj.NotCreatable) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "primary_offering_id", &obj.PrimaryOfferingID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "accessible_during_provision", &obj.AccessibleDuringProvision) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "side_by_side_index", &obj.SideBySideIndex) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "end_of_service_time", &obj.EndOfServiceTime) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "hidden", &obj.Hidden) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "hide_lite_metering", &obj.HideLiteMetering) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "no_upgrade_next_step", &obj.NoUpgradeNextStep) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// UIMetaMedia : Media-related metadata. +type UIMetaMedia struct { + // Caption for an image. + Caption *string `json:"caption,omitempty"` + + // URL for thumbnail image. + ThumbnailURL *string `json:"thumbnail_url,omitempty"` + + // Type of media. + Type *string `json:"type,omitempty"` + + // URL for media. + URL *string `json:"URL,omitempty"` + + // Information related to list delimiters. + Source *Bullets `json:"source,omitempty"` +} + + +// UnmarshalUIMetaMedia unmarshals an instance of UIMetaMedia from the specified map of raw messages. +func UnmarshalUIMetaMedia(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(UIMetaMedia) + err = core.UnmarshalPrimitive(m, "caption", &obj.Caption) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "thumbnail_url", &obj.ThumbnailURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "URL", &obj.URL) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source", &obj.Source, UnmarshalBullets) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// URLS : UI based URLs. +type URLS struct { + // URL for documentation. + DocURL *string `json:"doc_url,omitempty"` + + // URL for usage instructions. + InstructionsURL *string `json:"instructions_url,omitempty"` + + // API URL. + ApiURL *string `json:"api_url,omitempty"` + + // URL Creation UI / API. + CreateURL *string `json:"create_url,omitempty"` + + // URL to downlaod an SDK. + SdkDownloadURL *string `json:"sdk_download_url,omitempty"` + + // URL to the terms of use for your service. + TermsURL *string `json:"terms_url,omitempty"` + + // URL to the custom create page for your serivce. + CustomCreatePageURL *string `json:"custom_create_page_url,omitempty"` + + // URL to the catalog details page for your serivce. + CatalogDetailsURL *string `json:"catalog_details_url,omitempty"` + + // URL for deprecation documentation. + DeprecationDocURL *string `json:"deprecation_doc_url,omitempty"` + + // URL for dashboard. + DashboardURL *string `json:"dashboard_url,omitempty"` + + // URL for registration. + RegistrationURL *string `json:"registration_url,omitempty"` + + // URL for API documentation. + Apidocsurl *string `json:"apidocsurl,omitempty"` +} + + +// UnmarshalURLS unmarshals an instance of URLS from the specified map of raw messages. +func UnmarshalURLS(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(URLS) + err = core.UnmarshalPrimitive(m, "doc_url", &obj.DocURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "instructions_url", &obj.InstructionsURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "api_url", &obj.ApiURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "create_url", &obj.CreateURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "sdk_download_url", &obj.SdkDownloadURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "terms_url", &obj.TermsURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "custom_create_page_url", &obj.CustomCreatePageURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "catalog_details_url", &obj.CatalogDetailsURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "deprecation_doc_url", &obj.DeprecationDocURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "dashboard_url", &obj.DashboardURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "registration_url", &obj.RegistrationURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "apidocsurl", &obj.Apidocsurl) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// UpdateCatalogEntryOptions : The UpdateCatalogEntry options. +type UpdateCatalogEntryOptions struct { + // The object's unique ID. + ID *string `json:"id" validate:"required"` + + // Programmatic name for this catalog entry, which must be formatted like a CRN segment. See the display name in + // OverviewUI for a user-readable name. + Name *string `json:"name" validate:"required"` + + // The type of catalog entry, **service**, **template**, **dashboard**, which determines the type and shape of the + // object. + Kind *string `json:"kind" validate:"required"` + + // Overview is nested in the top level. The key value pair is `[_language_]overview_ui`. + OverviewUi *OverviewUI `json:"overview_ui" validate:"required"` + + // Image annotation for this catalog entry. The image is a URL. + Images *Image `json:"images" validate:"required"` + + // Boolean value that determines the global visibility for the catalog entry, and its children. If it is not enabled, + // all plans are disabled. + Disabled *bool `json:"disabled" validate:"required"` + + // A list of tags. For example, IBM, 3rd Party, Beta, GA, and Single Tenant. + Tags []string `json:"tags" validate:"required"` + + // Information related to the provider associated with a catalog entry. + Provider *Provider `json:"provider" validate:"required"` + + // The ID of the parent catalog entry if it exists. + ParentID *string `json:"parent_id,omitempty"` + + // Boolean value that determines whether the catalog entry is a group. + Group *bool `json:"group,omitempty"` + + // Boolean value that describes whether the service is active. + Active *bool `json:"active,omitempty"` + + // Model used to describe metadata object that can be set. + Metadata *ObjectMetadataSet `json:"metadata,omitempty"` + + // This changes the scope of the request regardless of the authorization header. Example scopes are `account` and + // `global`. `account=global` is reqired if operating with a service ID that has a global admin policy, for example + // `GET /?account=global`. + Account *string `json:"account,omitempty"` + + // Reparenting object. In the body set the parent_id to a different parent. Or remove the parent_id field to reparent + // to the root of the catalog. If this is not set to 'true' then changing the parent_id in the body of the request will + // not be permitted. If this is 'true' and no change to parent_id then this is also error. This is to prevent + // accidental changing of parent. + Move *string `json:"move,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the UpdateCatalogEntryOptions.Kind property. +// The type of catalog entry, **service**, **template**, **dashboard**, which determines the type and shape of the +// object. +const ( + UpdateCatalogEntryOptions_Kind_Dashboard = "dashboard" + UpdateCatalogEntryOptions_Kind_Service = "service" + UpdateCatalogEntryOptions_Kind_Template = "template" +) + +// NewUpdateCatalogEntryOptions : Instantiate UpdateCatalogEntryOptions +func (*GlobalCatalogV1) NewUpdateCatalogEntryOptions(id string, name string, kind string, overviewUi *OverviewUI, images *Image, disabled bool, tags []string, provider *Provider) *UpdateCatalogEntryOptions { + return &UpdateCatalogEntryOptions{ + ID: core.StringPtr(id), + Name: core.StringPtr(name), + Kind: core.StringPtr(kind), + OverviewUi: overviewUi, + Images: images, + Disabled: core.BoolPtr(disabled), + Tags: tags, + Provider: provider, + } +} + +// SetID : Allow user to set ID +func (options *UpdateCatalogEntryOptions) SetID(id string) *UpdateCatalogEntryOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetName : Allow user to set Name +func (options *UpdateCatalogEntryOptions) SetName(name string) *UpdateCatalogEntryOptions { + options.Name = core.StringPtr(name) + return options +} + +// SetKind : Allow user to set Kind +func (options *UpdateCatalogEntryOptions) SetKind(kind string) *UpdateCatalogEntryOptions { + options.Kind = core.StringPtr(kind) + return options +} + +// SetOverviewUi : Allow user to set OverviewUi +func (options *UpdateCatalogEntryOptions) SetOverviewUi(overviewUi *OverviewUI) *UpdateCatalogEntryOptions { + options.OverviewUi = overviewUi + return options +} + +// SetImages : Allow user to set Images +func (options *UpdateCatalogEntryOptions) SetImages(images *Image) *UpdateCatalogEntryOptions { + options.Images = images + return options +} + +// SetDisabled : Allow user to set Disabled +func (options *UpdateCatalogEntryOptions) SetDisabled(disabled bool) *UpdateCatalogEntryOptions { + options.Disabled = core.BoolPtr(disabled) + return options +} + +// SetTags : Allow user to set Tags +func (options *UpdateCatalogEntryOptions) SetTags(tags []string) *UpdateCatalogEntryOptions { + options.Tags = tags + return options +} + +// SetProvider : Allow user to set Provider +func (options *UpdateCatalogEntryOptions) SetProvider(provider *Provider) *UpdateCatalogEntryOptions { + options.Provider = provider + return options +} + +// SetParentID : Allow user to set ParentID +func (options *UpdateCatalogEntryOptions) SetParentID(parentID string) *UpdateCatalogEntryOptions { + options.ParentID = core.StringPtr(parentID) + return options +} + +// SetGroup : Allow user to set Group +func (options *UpdateCatalogEntryOptions) SetGroup(group bool) *UpdateCatalogEntryOptions { + options.Group = core.BoolPtr(group) + return options +} + +// SetActive : Allow user to set Active +func (options *UpdateCatalogEntryOptions) SetActive(active bool) *UpdateCatalogEntryOptions { + options.Active = core.BoolPtr(active) + return options +} + +// SetMetadata : Allow user to set Metadata +func (options *UpdateCatalogEntryOptions) SetMetadata(metadata *ObjectMetadataSet) *UpdateCatalogEntryOptions { + options.Metadata = metadata + return options +} + +// SetAccount : Allow user to set Account +func (options *UpdateCatalogEntryOptions) SetAccount(account string) *UpdateCatalogEntryOptions { + options.Account = core.StringPtr(account) + return options +} + +// SetMove : Allow user to set Move +func (options *UpdateCatalogEntryOptions) SetMove(move string) *UpdateCatalogEntryOptions { + options.Move = core.StringPtr(move) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateCatalogEntryOptions) SetHeaders(param map[string]string) *UpdateCatalogEntryOptions { + options.Headers = param + return options +} + +// UpdateVisibilityOptions : The UpdateVisibility options. +type UpdateVisibilityOptions struct { + // The object's unique ID. + ID *string `json:"id" validate:"required"` + + // Allows the visibility to be extenable. + Extendable *bool `json:"extendable,omitempty"` + + // Visibility details related to a catalog entry. + Include *VisibilityDetail `json:"include,omitempty"` + + // Visibility details related to a catalog entry. + Exclude *VisibilityDetail `json:"exclude,omitempty"` + + // This changes the scope of the request regardless of the authorization header. Example scopes are `account` and + // `global`. `account=global` is reqired if operating with a service ID that has a global admin policy, for example + // `GET /?account=global`. + Account *string `json:"account,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateVisibilityOptions : Instantiate UpdateVisibilityOptions +func (*GlobalCatalogV1) NewUpdateVisibilityOptions(id string) *UpdateVisibilityOptions { + return &UpdateVisibilityOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *UpdateVisibilityOptions) SetID(id string) *UpdateVisibilityOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetExtendable : Allow user to set Extendable +func (options *UpdateVisibilityOptions) SetExtendable(extendable bool) *UpdateVisibilityOptions { + options.Extendable = core.BoolPtr(extendable) + return options +} + +// SetInclude : Allow user to set Include +func (options *UpdateVisibilityOptions) SetInclude(include *VisibilityDetail) *UpdateVisibilityOptions { + options.Include = include + return options +} + +// SetExclude : Allow user to set Exclude +func (options *UpdateVisibilityOptions) SetExclude(exclude *VisibilityDetail) *UpdateVisibilityOptions { + options.Exclude = exclude + return options +} + +// SetAccount : Allow user to set Account +func (options *UpdateVisibilityOptions) SetAccount(account string) *UpdateVisibilityOptions { + options.Account = core.StringPtr(account) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateVisibilityOptions) SetHeaders(param map[string]string) *UpdateVisibilityOptions { + options.Headers = param + return options +} + +// UploadArtifactOptions : The UploadArtifact options. +type UploadArtifactOptions struct { + // The object's unique ID. + ObjectID *string `json:"object_id" validate:"required"` + + // The artifact's ID. + ArtifactID *string `json:"artifact_id" validate:"required"` + + Artifact io.ReadCloser `json:"artifact,omitempty"` + + // The type of the input. + ContentType *string `json:"Content-Type,omitempty"` + + // This changes the scope of the request regardless of the authorization header. Example scopes are `account` and + // `global`. `account=global` is reqired if operating with a service ID that has a global admin policy, for example + // `GET /?account=global`. + Account *string `json:"account,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUploadArtifactOptions : Instantiate UploadArtifactOptions +func (*GlobalCatalogV1) NewUploadArtifactOptions(objectID string, artifactID string) *UploadArtifactOptions { + return &UploadArtifactOptions{ + ObjectID: core.StringPtr(objectID), + ArtifactID: core.StringPtr(artifactID), + } +} + +// SetObjectID : Allow user to set ObjectID +func (options *UploadArtifactOptions) SetObjectID(objectID string) *UploadArtifactOptions { + options.ObjectID = core.StringPtr(objectID) + return options +} + +// SetArtifactID : Allow user to set ArtifactID +func (options *UploadArtifactOptions) SetArtifactID(artifactID string) *UploadArtifactOptions { + options.ArtifactID = core.StringPtr(artifactID) + return options +} + +// SetArtifact : Allow user to set Artifact +func (options *UploadArtifactOptions) SetArtifact(artifact io.ReadCloser) *UploadArtifactOptions { + options.Artifact = artifact + return options +} + +// SetContentType : Allow user to set ContentType +func (options *UploadArtifactOptions) SetContentType(contentType string) *UploadArtifactOptions { + options.ContentType = core.StringPtr(contentType) + return options +} + +// SetAccount : Allow user to set Account +func (options *UploadArtifactOptions) SetAccount(account string) *UploadArtifactOptions { + options.Account = core.StringPtr(account) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *UploadArtifactOptions) SetHeaders(param map[string]string) *UploadArtifactOptions { + options.Headers = param + return options +} + +// Visibility : Information related to the visibility of a catalog entry. +type Visibility struct { + // This controls the overall visibility. It is an enum of *public*, *ibm_only*, and *private*. public means it is + // visible to all. ibm_only means it is visible to all IBM unless their account is explicitly excluded. private means + // it is visible only to the included accounts. + Restrictions *string `json:"restrictions,omitempty"` + + // IAM Scope-related information associated with a catalog entry. + Owner *string `json:"owner,omitempty"` + + // Allows the visibility to be extenable. + Extendable *bool `json:"extendable,omitempty"` + + // Visibility details related to a catalog entry. + Include *VisibilityDetail `json:"include,omitempty"` + + // Visibility details related to a catalog entry. + Exclude *VisibilityDetail `json:"exclude,omitempty"` + + // Determines whether the owning account has full control over the visibility of the entry such as adding non-IBM + // accounts to the whitelist and making entries `private`, `ibm_only` or `public`. + Approved *bool `json:"approved,omitempty"` +} + + +// UnmarshalVisibility unmarshals an instance of Visibility from the specified map of raw messages. +func UnmarshalVisibility(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Visibility) + err = core.UnmarshalPrimitive(m, "restrictions", &obj.Restrictions) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "owner", &obj.Owner) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "extendable", &obj.Extendable) + if err != nil { + return + } + err = core.UnmarshalModel(m, "include", &obj.Include, UnmarshalVisibilityDetail) + if err != nil { + return + } + err = core.UnmarshalModel(m, "exclude", &obj.Exclude, UnmarshalVisibilityDetail) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "approved", &obj.Approved) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VisibilityDetail : Visibility details related to a catalog entry. +type VisibilityDetail struct { + // Information related to the accounts for which a catalog entry is visible. + Accounts *VisibilityDetailAccounts `json:"accounts" validate:"required"` +} + + +// NewVisibilityDetail : Instantiate VisibilityDetail (Generic Model Constructor) +func (*GlobalCatalogV1) NewVisibilityDetail(accounts *VisibilityDetailAccounts) (model *VisibilityDetail, err error) { + model = &VisibilityDetail{ + Accounts: accounts, + } + err = core.ValidateStruct(model, "required parameters") + return +} + +// UnmarshalVisibilityDetail unmarshals an instance of VisibilityDetail from the specified map of raw messages. +func UnmarshalVisibilityDetail(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VisibilityDetail) + err = core.UnmarshalModel(m, "accounts", &obj.Accounts, UnmarshalVisibilityDetailAccounts) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VisibilityDetailAccounts : Information related to the accounts for which a catalog entry is visible. +type VisibilityDetailAccounts struct { + // (_accountid_) is the GUID of the account and the value is the scope of who set it. For setting visibility use "" as + // the value. It is replaced with the owner scope when saved. + Accountid *string `json:"_accountid_,omitempty"` +} + + +// UnmarshalVisibilityDetailAccounts unmarshals an instance of VisibilityDetailAccounts from the specified map of raw messages. +func UnmarshalVisibilityDetailAccounts(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VisibilityDetailAccounts) + err = core.UnmarshalPrimitive(m, "_accountid_", &obj.Accountid) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} diff --git a/globalcatalogv1/global_catalog_v1_integration_test.go b/globalcatalogv1/global_catalog_v1_integration_test.go new file mode 100644 index 00000000..880f0090 --- /dev/null +++ b/globalcatalogv1/global_catalog_v1_integration_test.go @@ -0,0 +1,536 @@ +// +build integration + +/** + * (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 globalcatalogv1_test + +import ( + "bytes" + "fmt" + "io/ioutil" + "strings" + "time" + + "github.com/IBM/platform-services-go-sdk/globalcatalogv1" + "github.com/joho/godotenv" + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" +) + +const ( + externalConfigFile = "../global_catalog.env" + visibilityRestriction = "private" + artifact = `{"someKey": "someValue"}` +) + +var ( + service *globalcatalogv1.GlobalCatalogV1 + defaultCreate *globalcatalogv1.CreateCatalogEntryOptions + defaultDelete *globalcatalogv1.DeleteCatalogEntryOptions + forceDelete *globalcatalogv1.DeleteCatalogEntryOptions + defaultGet *globalcatalogv1.GetCatalogEntryOptions + defaultUpdate *globalcatalogv1.UpdateCatalogEntryOptions + defaultList *globalcatalogv1.ListCatalogEntriesOptions + defaultChild *globalcatalogv1.CreateCatalogEntryOptions + getChild *globalcatalogv1.GetChildObjectsOptions + deleteChild *globalcatalogv1.DeleteCatalogEntryOptions + defaultRestore *globalcatalogv1.RestoreCatalogEntryOptions + bogusRestore *globalcatalogv1.RestoreCatalogEntryOptions + getVisibility *globalcatalogv1.GetVisibilityOptions + updateVisibility *globalcatalogv1.UpdateVisibilityOptions + getPricing *globalcatalogv1.GetPricingOptions + defaultArtifact *globalcatalogv1.UploadArtifactOptions + uploadArtifactList *globalcatalogv1.UploadArtifactOptions + uploadArtifactCreate *globalcatalogv1.UploadArtifactOptions + uploadArtifactCreateFailure *globalcatalogv1.UploadArtifactOptions + uploadArtifactDelete *globalcatalogv1.UploadArtifactOptions + listArtifacts *globalcatalogv1.ListArtifactsOptions + getArtifact *globalcatalogv1.GetArtifactOptions + deleteArtifact *globalcatalogv1.DeleteArtifactOptions + configLoaded bool = false +) + +func shouldSkipTest() { + if !configLoaded { + Skip("External configuration is not available, skipping...") + } +} + +var _ = Describe("Global Catalog - Integration Tests", func() { + It("Successfully load the configuration", func() { + + err := godotenv.Load(externalConfigFile) + if err == nil { + configLoaded = true + } else { + Skip("External configuration could not be loaded, skipping...") + } + }) + + It(`Successfully created GlobalCatalogV1 service instance`, func() { + const ( + kind = "service" + disabled = false + email = "bogus@us.ibm.com" + displayName = "display" + displayLongDesc = "long" + displayDesc = "desc" + displayNameUpdated = "displayUpdated" + displayLongDescUpdated = "longUpdated" + displayDescUpdated = "descUpdated" + en = "en" + providerName = "someName" + providerNameUpdated = "someNameUpdated" + artifactId = "someArtifactId.json" + ) + + var ( + id = fmt.Sprintf("someId%d", time.Now().Unix()) + idChild = fmt.Sprintf("someChildId%d", time.Now().Unix()) + name = fmt.Sprintf("someName%d", time.Now().Unix()) + nameChild = fmt.Sprintf("someChildName%d", time.Now().Unix()) + nameUpdated = fmt.Sprintf("someNameUpdated%d", time.Now().Unix()) + image = "image" + imageUpdated = "image" + smallImage = "small" + smallImageUpdated = "small" + mediumImage = "medium" + mediumImageUpdated = "medium" + featureImage = "feature" + featureImageUpdated = "feature" + tags = []string{"a", "b", "c"} + tagsUpdated = []string{"x", "y", "z"} + overviewUi = &globalcatalogv1.OverviewUI{} + overviewUiUpdated = &globalcatalogv1.OverviewUI{} + overview, _ = service.NewOverview(displayName, displayLongDesc, displayDesc) + overviewUpdated, _ = service.NewOverview(displayNameUpdated, displayLongDescUpdated, displayDescUpdated) + images = &globalcatalogv1.Image{Image: &image, + SmallImage: &smallImage, + MediumImage: &mediumImage, + FeatureImage: &featureImage, + } + imagesUpdated = &globalcatalogv1.Image{Image: &imageUpdated, + SmallImage: &smallImageUpdated, + MediumImage: &mediumImageUpdated, + FeatureImage: &featureImageUpdated, + } + provider, _ = service.NewProvider(email, providerName) + providerUpdated, _ = service.NewProvider(email, providerNameUpdated) + err error + ) + + shouldSkipTest() + + service, err = globalcatalogv1.NewGlobalCatalogV1UsingExternalConfig( + &globalcatalogv1.GlobalCatalogV1Options{}, + ) + + Expect(err).To(BeNil()) + Expect(service).ToNot(BeNil()) + + overviewUi.SetProperty(en, overview) + overviewUiUpdated.SetProperty(en, overviewUpdated) + + defaultCreate = service.NewCreateCatalogEntryOptions(name, + kind, + overviewUi, + images, + disabled, + tags, + provider, + id) + defaultDelete = service.NewDeleteCatalogEntryOptions(id) + forceDelete = service.NewDeleteCatalogEntryOptions(id) + defaultGet = service.NewGetCatalogEntryOptions(id) + defaultUpdate = service.NewUpdateCatalogEntryOptions(id, + nameUpdated, + kind, + overviewUiUpdated, + imagesUpdated, + disabled, + tagsUpdated, + providerUpdated) + defaultList = service.NewListCatalogEntriesOptions() + defaultChild = service.NewCreateCatalogEntryOptions(nameChild, + kind, + overviewUi, + images, + disabled, + tags, + provider, + idChild) + getChild = service.NewGetChildObjectsOptions(id, kind) + defaultRestore = service.NewRestoreCatalogEntryOptions(id) + bogusRestore = service.NewRestoreCatalogEntryOptions("bogus") + getVisibility = service.NewGetVisibilityOptions(id) + updateVisibility = service.NewUpdateVisibilityOptions(id) + getPricing = service.NewGetPricingOptions(id) + defaultArtifact = service.NewUploadArtifactOptions(id, artifactId) + uploadArtifactList = service.NewUploadArtifactOptions(id, artifactId) + uploadArtifactCreate = service.NewUploadArtifactOptions(id, artifactId) + uploadArtifactCreateFailure = service.NewUploadArtifactOptions(id, artifactId) + uploadArtifactDelete = service.NewUploadArtifactOptions(id, artifactId) + listArtifacts = service.NewListArtifactsOptions(id) + getArtifact = service.NewGetArtifactOptions(id, artifactId) + deleteArtifact = service.NewDeleteArtifactOptions(id, artifactId) + deleteChild = service.NewDeleteCatalogEntryOptions(idChild) + + defaultChild.SetParentID(id) + defaultArtifact.SetArtifact(ioutil.NopCloser(strings.NewReader(artifact))) + uploadArtifactList.SetArtifact(ioutil.NopCloser(strings.NewReader(artifact))) + uploadArtifactCreate.SetArtifact(ioutil.NopCloser(strings.NewReader(artifact))) + uploadArtifactCreateFailure.SetArtifact(ioutil.NopCloser(strings.NewReader(artifact))) + uploadArtifactDelete.SetArtifact(ioutil.NopCloser(strings.NewReader(artifact))) + forceDelete.SetForce(true) + }) + + Describe("Run integration tests", func() { + JustBeforeEach(func() { + shouldSkipTest() + + service.DeleteCatalogEntry(forceDelete) + }) + + JustAfterEach(func() { + shouldSkipTest() + + service.DeleteCatalogEntry(forceDelete) + }) + + It("Create a catalog entry", func() { + shouldSkipTest() + + result, detailedResponse, err := service.CreateCatalogEntry(defaultCreate) + Expect(err).To(BeNil()) + Expect(detailedResponse.StatusCode).To(Equal(201)) + Expect(result.ID).To(Equal(defaultCreate.ID)) + Expect(result.Name).To(Equal(defaultCreate.Name)) + Expect(result.Kind).To(Equal(defaultCreate.Kind)) + Expect(result.Images).To(Equal(defaultCreate.Images)) + Expect(result.Tags).To(Equal(defaultCreate.Tags)) + Expect(result.Provider).To(Equal(defaultCreate.Provider)) + }) + + It("Get a catalog entry", func() { + shouldSkipTest() + + service.CreateCatalogEntry(defaultCreate) + result, detailedResponse, err := service.GetCatalogEntry(defaultGet) + Expect(err).To(BeNil()) + Expect(detailedResponse.StatusCode).To(Equal(200)) + Expect(result.ID).To(Equal(defaultCreate.ID)) + Expect(result.Name).To(Equal(defaultCreate.Name)) + Expect(result.Kind).To(Equal(defaultCreate.Kind)) + Expect(result.Images).To(Equal(defaultCreate.Images)) + Expect(result.Tags).To(Equal(defaultCreate.Tags)) + Expect(result.Provider).To(Equal(defaultCreate.Provider)) + }) + + It("Update a catalog entry", func() { + shouldSkipTest() + + service.CreateCatalogEntry(defaultCreate) + result, detailedResponse, err := service.UpdateCatalogEntry(defaultUpdate) + Expect(err).To(BeNil()) + Expect(detailedResponse.StatusCode).To(Equal(200)) + Expect(result.ID).To(Equal(defaultUpdate.ID)) + Expect(result.Name).To(Equal(defaultUpdate.Name)) + Expect(result.Kind).To(Equal(defaultUpdate.Kind)) + Expect(result.Images).To(Equal(defaultUpdate.Images)) + Expect(result.Tags).To(Equal(defaultUpdate.Tags)) + Expect(result.Provider).To(Equal(defaultUpdate.Provider)) + }) + + It("Delete a catalog entry", func() { + shouldSkipTest() + + service.CreateCatalogEntry(defaultCreate) + detailedResponse, err := service.DeleteCatalogEntry(forceDelete) + Expect(err).To(BeNil()) + Expect(detailedResponse.StatusCode).To(Equal(200)) + }) + + It("Fail to get a catalog entry after deletion", func() { + shouldSkipTest() + + service.CreateCatalogEntry(defaultCreate) + service.DeleteCatalogEntry(forceDelete) + + _, detailedResponse, err := service.GetCatalogEntry(defaultGet) + Expect(err).NotTo(BeNil()) + Expect(detailedResponse.StatusCode).To(Equal(404)) + }) + + It("Fail to get a catalog entry that does not exist", func() { + shouldSkipTest() + + _, detailedResponse, err := service.GetCatalogEntry(defaultGet) + Expect(err).NotTo(BeNil()) + Expect(detailedResponse.StatusCode).To(Equal(404)) + }) + + It("Fail to delete a catalog entry that does not exist", func() { + shouldSkipTest() + + detailedResponse, err := service.DeleteCatalogEntry(forceDelete) + Expect(err).To(BeNil()) + Expect(detailedResponse.StatusCode).To(Equal(200)) + }) + + It("Fail to update a catalog entry that does not exist", func() { + shouldSkipTest() + + _, detailedResponse, err := service.UpdateCatalogEntry(defaultUpdate) + Expect(err).NotTo(BeNil()) + Expect(detailedResponse.StatusCode).To(Equal(404)) + }) + + It("Fail to create a catalog entry that already exists", func() { + shouldSkipTest() + + service.CreateCatalogEntry(defaultCreate) + + _, detailedResponse, err := service.CreateCatalogEntry(defaultCreate) + Expect(err).NotTo(BeNil()) + Expect(detailedResponse.StatusCode).To(Equal(409)) + }) + + It("List catalog entries", func() { + shouldSkipTest() + + result, detailedResponse, err := service.ListCatalogEntries(defaultList) + Expect(err).To(BeNil()) + Expect(detailedResponse.StatusCode).To(Equal(200)) + Expect(result.Resources).NotTo(BeNil()) + Expect(len(result.Resources)).NotTo(BeZero()) + }) + + It("Get child catalog entry", func() { + const expectedOffset int64 = 0 + const expectedCount int64 = 1 + const expectedResourceCount int64 = 1 + + shouldSkipTest() + + service.CreateCatalogEntry(defaultCreate) + service.CreateCatalogEntry(defaultChild) + + result, detailedResponse, err := service.GetChildObjects(getChild) + Expect(err).To(BeNil()) + Expect(detailedResponse.StatusCode).To(Equal(200)) + Expect(result).ToNot(BeNil()) + Expect(*result.Offset).To(Equal(expectedOffset)) + Expect(*result.Count).To(Equal(expectedCount)) + Expect(*result.ResourceCount).To(Equal(expectedResourceCount)) + Expect(result.Resources[0].Name).To(Equal(defaultChild.Name)) + Expect(result.Resources[0].Kind).To(Equal(defaultChild.Kind)) + Expect(result.Resources[0].Images).To(Equal(defaultChild.Images)) + Expect(result.Resources[0].Tags).To(Equal(defaultChild.Tags)) + Expect(result.Resources[0].Provider).To(Equal(defaultChild.Provider)) + }) + + It("Fail to get a child catalog entry that does not exist", func() { + shouldSkipTest() + + _, detailedResponse, err := service.GetChildObjects(getChild) + Expect(err).NotTo(BeNil()) + Expect(detailedResponse.StatusCode).To(Equal(404)) + }) + + It("Restore a catalog entry", func() { + shouldSkipTest() + + service.CreateCatalogEntry(defaultCreate) + service.DeleteCatalogEntry(defaultDelete) + + detailedResponseRestore, errRestore := service.RestoreCatalogEntry(defaultRestore) + Expect(errRestore).To(BeNil()) + Expect(detailedResponseRestore.StatusCode).To(Equal(200)) + + result, detailedResponseGet, errGet := service.GetCatalogEntry(defaultGet) + Expect(errGet).To(BeNil()) + Expect(detailedResponseGet.StatusCode).To(Equal(200)) + Expect(result.ID).To(Equal(defaultCreate.ID)) + Expect(result.Name).To(Equal(defaultCreate.Name)) + Expect(result.Kind).To(Equal(defaultCreate.Kind)) + Expect(result.Images).To(Equal(defaultCreate.Images)) + Expect(result.Tags).To(Equal(defaultCreate.Tags)) + Expect(result.Provider).To(Equal(defaultCreate.Provider)) + }) + + It("Fail to restore catalog entry that never existed", func() { + shouldSkipTest() + + detailedResponse, err := service.RestoreCatalogEntry(bogusRestore) + Expect(err).NotTo(BeNil()) + Expect(detailedResponse.StatusCode).To(Equal(404)) + }) + + It("Get visibility for catalog entry", func() { + shouldSkipTest() + + service.CreateCatalogEntry(defaultCreate) + + result, detailedResponse, err := service.GetVisibility(getVisibility) + Expect(err).To(BeNil()) + Expect(detailedResponse.StatusCode).To(Equal(200)) + Expect(*result.Restrictions).To(Equal(visibilityRestriction)) + }) + + It("Fail to get visibility of catalog entry that does not exist", func() { + shouldSkipTest() + + _, detailedResponse, err := service.GetVisibility(getVisibility) + Expect(err).NotTo(BeNil()) + Expect(detailedResponse.StatusCode).To(Equal(404)) + }) + + It("Update visibility for catalog entry", func() { + shouldSkipTest() + + service.CreateCatalogEntry(defaultCreate) + + detailedResponse, err := service.UpdateVisibility(updateVisibility) + Expect(err).NotTo(BeNil()) + Expect(detailedResponse.StatusCode).To(Equal(403)) + }) + + It("Fail to update visibility for catalog entry that does not exist", func() { + shouldSkipTest() + + detailedResponse, err := service.UpdateVisibility(updateVisibility) + Expect(err).NotTo(BeNil()) + Expect(detailedResponse.StatusCode).To(Equal(404)) + }) + + It("Fail to get pricing", func() { + shouldSkipTest() + + service.CreateCatalogEntry(defaultCreate) + + _, detailedResponseExists, errExists := service.GetPricing(getPricing) + Expect(errExists).NotTo(BeNil()) + Expect(detailedResponseExists.StatusCode).To(Equal(404)) + + service.DeleteCatalogEntry(forceDelete) + + _, detailedResponseNotExists, errNotExists := service.GetPricing(getPricing) + Expect(errNotExists).NotTo(BeNil()) + Expect(detailedResponseNotExists.StatusCode).To(Equal(404)) + }) + + It("List artifacts for a catalog entry", func() { + const expectedCount int64 = 1 + const expectedSize int64 = 24 + + shouldSkipTest() + + service.CreateCatalogEntry(defaultCreate) + service.UploadArtifact(uploadArtifactList) + + result, detailedResponse, err := service.ListArtifacts(listArtifacts) + Expect(err).To(BeNil()) + Expect(detailedResponse.StatusCode).To(Equal(200)) + Expect(*result.Count).To(Equal(expectedCount)) + Expect(len(result.Resources)).To(Equal(1)) + Expect(result.Resources[0].Name).To(Equal(uploadArtifactList.ArtifactID)) + Expect(*result.Resources[0].URL).To(Equal(fmt.Sprintf("%s/%s/artifacts/%s", "https://globalcatalog.test.cloud.ibm.com/api/v1", *defaultCreate.ID, *uploadArtifactList.ArtifactID))) + Expect(*result.Resources[0].Size).To(Equal(expectedSize)) + }) + + It("Fail to list artifacts for a catalog entry that does not exist", func() { + const expectedCount int64 = 0 + + shouldSkipTest() + + result, detailedResponse, err := service.ListArtifacts(listArtifacts) + Expect(err).To(BeNil()) + Expect(detailedResponse.StatusCode).To(Equal(200)) + Expect(*result.Count).To(Equal(expectedCount)) + }) + + It("Get artifact for a catalog entry", func() { + shouldSkipTest() + + service.CreateCatalogEntry(defaultCreate) + service.UploadArtifact(defaultArtifact) + + result, detailedResponse, err := service.GetArtifact(getArtifact) + Expect(result).NotTo(BeNil()) + Expect(err).To(BeNil()) + Expect(detailedResponse.StatusCode).To(Equal(200)) + buf := new(bytes.Buffer) + buf.ReadFrom(result) + Expect(buf.String()).To(Equal(artifact)) + }) + + It("Fail to get artifacts that do not exists", func() { + shouldSkipTest() + + service.CreateCatalogEntry(defaultCreate) + + _, detailedResponseExists, errExists := service.GetArtifact(getArtifact) + Expect(errExists).NotTo(BeNil()) + Expect(detailedResponseExists.StatusCode).To(Equal(404)) + + service.DeleteCatalogEntry(forceDelete) + + _, detailedResponseNotExists, errNotExists := service.GetArtifact(getArtifact) + Expect(errNotExists).NotTo(BeNil()) + Expect(detailedResponseNotExists.StatusCode).To(Equal(404)) + }) + + It("Create artifact for a catalog entry", func() { + shouldSkipTest() + + service.CreateCatalogEntry(defaultCreate) + + detailedResponse, err := service.UploadArtifact(uploadArtifactCreate) + Expect(err).To(BeNil()) + Expect(detailedResponse.StatusCode).To(Equal(200)) + }) + + It("Fail to artifact for a catalog entry that does not exist", func() { + shouldSkipTest() + + detailedResponse, err := service.UploadArtifact(uploadArtifactCreateFailure) + Expect(err).NotTo(BeNil()) + Expect(detailedResponse.StatusCode).To(Equal(404)) + }) + + It("Delete artifact for a catalog entry", func() { + shouldSkipTest() + + service.CreateCatalogEntry(defaultCreate) + service.UploadArtifact(uploadArtifactDelete) + + detailedResponse, err := service.DeleteArtifact(deleteArtifact) + Expect(err).To(BeNil()) + Expect(detailedResponse.StatusCode).To(Equal(200)) + }) + + It("Fail to delete artifact for a catalog entry that does not exist", func() { + shouldSkipTest() + + detailedResponse, err := service.DeleteArtifact(deleteArtifact) + Expect(err).NotTo(BeNil()) + Expect(detailedResponse.StatusCode).To(Equal(404)) + }) + + }) + +}) diff --git a/globalcatalogv1/global_catalog_v1_suite_test.go b/globalcatalogv1/global_catalog_v1_suite_test.go new file mode 100644 index 00000000..2294e413 --- /dev/null +++ b/globalcatalogv1/global_catalog_v1_suite_test.go @@ -0,0 +1,28 @@ +/** + * (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 globalcatalogv1_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + "testing" +) + +func TestGlobalCatalogV1(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "GlobalCatalogV1 Suite") +} diff --git a/globalcatalogv1/global_catalog_v1_test.go b/globalcatalogv1/global_catalog_v1_test.go new file mode 100644 index 00000000..dd54ee6d --- /dev/null +++ b/globalcatalogv1/global_catalog_v1_test.go @@ -0,0 +1,4841 @@ +/** + * (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 globalcatalogv1_test + +import ( + "bytes" + "fmt" + "github.com/IBM/go-sdk-core/v4/core" + "github.com/IBM/platform-services-go-sdk/globalcatalogv1" + "github.com/go-openapi/strfmt" + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + "io" + "io/ioutil" + "net/http" + "net/http/httptest" + "os" + "time" +) + +var _ = Describe(`GlobalCatalogV1`, func() { + var testServer *httptest.Server + Describe(`Service constructor tests`, func() { + It(`Instantiate service client`, func() { + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1(&globalcatalogv1.GlobalCatalogV1Options{ + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(testService).ToNot(BeNil()) + Expect(testServiceErr).To(BeNil()) + }) + It(`Instantiate service client with error: Invalid URL`, func() { + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1(&globalcatalogv1.GlobalCatalogV1Options{ + URL: "{BAD_URL_STRING", + }) + Expect(testService).To(BeNil()) + Expect(testServiceErr).ToNot(BeNil()) + }) + It(`Instantiate service client with error: Invalid Auth`, func() { + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1(&globalcatalogv1.GlobalCatalogV1Options{ + URL: "https://globalcatalogv1/api", + Authenticator: &core.BasicAuthenticator{ + Username: "", + Password: "", + }, + }) + Expect(testService).To(BeNil()) + Expect(testServiceErr).ToNot(BeNil()) + }) + }) + Describe(`Service constructor tests using external config`, func() { + Context(`Using external config, construct service client instances`, func() { + // Map containing environment variables used in testing. + var testEnvironment = map[string]string{ + "GLOBAL_CATALOG_URL": "https://globalcatalogv1/api", + "GLOBAL_CATALOG_AUTH_TYPE": "noauth", + } + + It(`Create service client using external config successfully`, func() { + SetTestEnvironment(testEnvironment) + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1UsingExternalConfig(&globalcatalogv1.GlobalCatalogV1Options{ + }) + Expect(testService).ToNot(BeNil()) + Expect(testServiceErr).To(BeNil()) + ClearTestEnvironment(testEnvironment) + }) + It(`Create service client using external config and set url from constructor successfully`, func() { + SetTestEnvironment(testEnvironment) + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1UsingExternalConfig(&globalcatalogv1.GlobalCatalogV1Options{ + URL: "https://testService/api", + }) + Expect(testService).ToNot(BeNil()) + Expect(testServiceErr).To(BeNil()) + Expect(testService.Service.GetServiceURL()).To(Equal("https://testService/api")) + ClearTestEnvironment(testEnvironment) + }) + It(`Create service client using external config and set url programatically successfully`, func() { + SetTestEnvironment(testEnvironment) + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1UsingExternalConfig(&globalcatalogv1.GlobalCatalogV1Options{ + }) + err := testService.SetServiceURL("https://testService/api") + Expect(err).To(BeNil()) + Expect(testService).ToNot(BeNil()) + Expect(testServiceErr).To(BeNil()) + Expect(testService.Service.GetServiceURL()).To(Equal("https://testService/api")) + ClearTestEnvironment(testEnvironment) + }) + }) + Context(`Using external config, construct service client instances with error: Invalid Auth`, func() { + // Map containing environment variables used in testing. + var testEnvironment = map[string]string{ + "GLOBAL_CATALOG_URL": "https://globalcatalogv1/api", + "GLOBAL_CATALOG_AUTH_TYPE": "someOtherAuth", + } + + SetTestEnvironment(testEnvironment) + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1UsingExternalConfig(&globalcatalogv1.GlobalCatalogV1Options{ + }) + + It(`Instantiate service client with error`, func() { + Expect(testService).To(BeNil()) + Expect(testServiceErr).ToNot(BeNil()) + ClearTestEnvironment(testEnvironment) + }) + }) + Context(`Using external config, construct service client instances with error: Invalid URL`, func() { + // Map containing environment variables used in testing. + var testEnvironment = map[string]string{ + "GLOBAL_CATALOG_AUTH_TYPE": "NOAuth", + } + + SetTestEnvironment(testEnvironment) + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1UsingExternalConfig(&globalcatalogv1.GlobalCatalogV1Options{ + URL: "{BAD_URL_STRING", + }) + + It(`Instantiate service client with error`, func() { + Expect(testService).To(BeNil()) + Expect(testServiceErr).ToNot(BeNil()) + ClearTestEnvironment(testEnvironment) + }) + }) + }) + Describe(`ListCatalogEntries(listCatalogEntriesOptions *ListCatalogEntriesOptions) - Operation response error`, func() { + listCatalogEntriesPath := "/" + 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.Path).To(Equal(listCatalogEntriesPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["account"]).To(Equal([]string{"testString"})) + + Expect(req.URL.Query()["include"]).To(Equal([]string{"testString"})) + + Expect(req.URL.Query()["q"]).To(Equal([]string{"testString"})) + + Expect(req.URL.Query()["sort-by"]).To(Equal([]string{"testString"})) + + Expect(req.URL.Query()["descending"]).To(Equal([]string{"testString"})) + + Expect(req.URL.Query()["languages"]).To(Equal([]string{"testString"})) + + Expect(req.URL.Query()["complete"]).To(Equal([]string{"testString"})) + + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, `} this is not valid json {`) + })) + }) + It(`Invoke ListCatalogEntries with error: Operation response processing error`, func() { + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1(&globalcatalogv1.GlobalCatalogV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(testServiceErr).To(BeNil()) + Expect(testService).ToNot(BeNil()) + + // Construct an instance of the ListCatalogEntriesOptions model + listCatalogEntriesOptionsModel := new(globalcatalogv1.ListCatalogEntriesOptions) + listCatalogEntriesOptionsModel.Account = core.StringPtr("testString") + listCatalogEntriesOptionsModel.Include = core.StringPtr("testString") + listCatalogEntriesOptionsModel.Q = core.StringPtr("testString") + listCatalogEntriesOptionsModel.SortBy = core.StringPtr("testString") + listCatalogEntriesOptionsModel.Descending = core.StringPtr("testString") + listCatalogEntriesOptionsModel.Languages = core.StringPtr("testString") + listCatalogEntriesOptionsModel.Complete = core.StringPtr("testString") + listCatalogEntriesOptionsModel.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 := testService.ListCatalogEntries(listCatalogEntriesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + + Describe(`ListCatalogEntries(listCatalogEntriesOptions *ListCatalogEntriesOptions)`, func() { + listCatalogEntriesPath := "/" + 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.Path).To(Equal(listCatalogEntriesPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["account"]).To(Equal([]string{"testString"})) + + Expect(req.URL.Query()["include"]).To(Equal([]string{"testString"})) + + Expect(req.URL.Query()["q"]).To(Equal([]string{"testString"})) + + Expect(req.URL.Query()["sort-by"]).To(Equal([]string{"testString"})) + + Expect(req.URL.Query()["descending"]).To(Equal([]string{"testString"})) + + Expect(req.URL.Query()["languages"]).To(Equal([]string{"testString"})) + + Expect(req.URL.Query()["complete"]).To(Equal([]string{"testString"})) + + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, `{"offset": 6, "limit": 5, "count": 5, "resource_count": 13, "first": "First", "last": "Last", "prev": "Prev", "next": "Next", "resources": [{"name": "Name", "kind": "service", "overview_ui": {}, "images": {"image": "Image", "small_image": "SmallImage", "medium_image": "MediumImage", "feature_image": "FeatureImage"}, "parent_id": "ParentID", "disabled": true, "tags": ["Tags"], "group": false, "provider": {"email": "Email", "name": "Name", "contact": "Contact", "support_email": "SupportEmail", "phone": "Phone"}, "active": true, "metadata": {"rc_compatible": true, "service": {"type": "Type", "iam_compatible": false, "unique_api_key": true, "provisionable": false, "bindable": true, "async_provisioning_supported": true, "async_unprovisioning_supported": true, "requires": ["Requires"], "plan_updateable": true, "state": "State", "service_check_enabled": false, "test_check_interval": 17, "service_key_supported": false, "cf_guid": {"mapKey": "Inner"}}, "plan": {"bindable": true, "reservable": true, "allow_internal_users": true, "async_provisioning_supported": true, "async_unprovisioning_supported": true, "test_check_interval": 17, "single_scope_instance": "SingleScopeInstance", "service_check_enabled": false, "cf_guid": {"mapKey": "Inner"}}, "alias": {"type": "Type", "plan_id": "PlanID"}, "template": {"services": ["Services"], "default_memory": 13, "start_cmd": "StartCmd", "source": {"path": "Path", "type": "Type", "url": "URL"}, "runtime_catalog_id": "RuntimeCatalogID", "cf_runtime_id": "CfRuntimeID", "template_id": "TemplateID", "executable_file": "ExecutableFile", "buildpack": "Buildpack", "environment_variables": {"mapKey": "Inner"}}, "ui": {"strings": {}, "urls": {"doc_url": "DocURL", "instructions_url": "InstructionsURL", "api_url": "ApiURL", "create_url": "CreateURL", "sdk_download_url": "SdkDownloadURL", "terms_url": "TermsURL", "custom_create_page_url": "CustomCreatePageURL", "catalog_details_url": "CatalogDetailsURL", "deprecation_doc_url": "DeprecationDocURL", "dashboard_url": "DashboardURL", "registration_url": "RegistrationURL", "apidocsurl": "Apidocsurl"}, "embeddable_dashboard": "EmbeddableDashboard", "embeddable_dashboard_full_width": true, "navigation_order": ["NavigationOrder"], "not_creatable": true, "primary_offering_id": "PrimaryOfferingID", "accessible_during_provision": false, "side_by_side_index": 15, "end_of_service_time": "2019-01-01T12:00:00", "hidden": true, "hide_lite_metering": true, "no_upgrade_next_step": false}, "compliance": ["Compliance"], "sla": {"terms": "Terms", "tenancy": "Tenancy", "provisioning": "Provisioning", "responsiveness": "Responsiveness", "dr": {"dr": true, "description": "Description"}}, "callbacks": {"controller_url": "ControllerURL", "broker_url": "BrokerURL", "broker_proxy_url": "BrokerProxyURL", "dashboard_url": "DashboardURL", "dashboard_data_url": "DashboardDataURL", "dashboard_detail_tab_url": "DashboardDetailTabURL", "dashboard_detail_tab_ext_url": "DashboardDetailTabExtURL", "service_monitor_api": "ServiceMonitorApi", "service_monitor_app": "ServiceMonitorApp", "api_endpoint": {"mapKey": "Inner"}}, "original_name": "OriginalName", "version": "Version", "other": {"mapKey": {"anyKey": "anyValue"}}, "pricing": {"type": "Type", "origin": "Origin", "starting_price": {"plan_id": "PlanID", "deployment_id": "DeploymentID", "unit": "Unit", "amount": [{"country": "Country", "currency": "Currency", "prices": [{"quantity_tier": 12, "Price": 5}]}]}, "metrics": [{"part_ref": "PartRef", "metric_id": "MetricID", "tier_model": "TierModel", "charge_unit": "ChargeUnit", "charge_unit_name": "ChargeUnitName", "charge_unit_quantity": "ChargeUnitQuantity", "resource_display_name": "ResourceDisplayName", "charge_unit_display_name": "ChargeUnitDisplayName", "usage_cap_qty": 11, "display_cap": 10, "effective_from": "2019-01-01T12:00:00", "effective_until": "2019-01-01T12:00:00", "amounts": [{"country": "Country", "currency": "Currency", "prices": [{"quantity_tier": 12, "Price": 5}]}]}]}, "deployment": {"location": "Location", "location_url": "LocationURL", "original_location": "OriginalLocation", "target_crn": "TargetCrn", "service_crn": "ServiceCrn", "mccp_id": "MccpID", "broker": {"name": "Name", "guid": "Guid"}, "supports_rc_migration": false, "target_network": "TargetNetwork"}}, "id": "ID", "catalog_crn": "anyValue", "url": "anyValue", "children_url": "anyValue", "geo_tags": "anyValue", "pricing_tags": "anyValue", "created": "anyValue", "updated": "anyValue"}]}`) + })) + }) + It(`Invoke ListCatalogEntries successfully`, func() { + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1(&globalcatalogv1.GlobalCatalogV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(testServiceErr).To(BeNil()) + Expect(testService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := testService.ListCatalogEntries(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListCatalogEntriesOptions model + listCatalogEntriesOptionsModel := new(globalcatalogv1.ListCatalogEntriesOptions) + listCatalogEntriesOptionsModel.Account = core.StringPtr("testString") + listCatalogEntriesOptionsModel.Include = core.StringPtr("testString") + listCatalogEntriesOptionsModel.Q = core.StringPtr("testString") + listCatalogEntriesOptionsModel.SortBy = core.StringPtr("testString") + listCatalogEntriesOptionsModel.Descending = core.StringPtr("testString") + listCatalogEntriesOptionsModel.Languages = core.StringPtr("testString") + listCatalogEntriesOptionsModel.Complete = core.StringPtr("testString") + listCatalogEntriesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = testService.ListCatalogEntries(listCatalogEntriesOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + }) + It(`Invoke ListCatalogEntries with error: Operation request error`, func() { + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1(&globalcatalogv1.GlobalCatalogV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(testServiceErr).To(BeNil()) + Expect(testService).ToNot(BeNil()) + + // Construct an instance of the ListCatalogEntriesOptions model + listCatalogEntriesOptionsModel := new(globalcatalogv1.ListCatalogEntriesOptions) + listCatalogEntriesOptionsModel.Account = core.StringPtr("testString") + listCatalogEntriesOptionsModel.Include = core.StringPtr("testString") + listCatalogEntriesOptionsModel.Q = core.StringPtr("testString") + listCatalogEntriesOptionsModel.SortBy = core.StringPtr("testString") + listCatalogEntriesOptionsModel.Descending = core.StringPtr("testString") + listCatalogEntriesOptionsModel.Languages = core.StringPtr("testString") + listCatalogEntriesOptionsModel.Complete = core.StringPtr("testString") + listCatalogEntriesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := testService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := testService.ListCatalogEntries(listCatalogEntriesOptionsModel) + 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() + }) + }) + }) + Describe(`CreateCatalogEntry(createCatalogEntryOptions *CreateCatalogEntryOptions) - Operation response error`, func() { + createCatalogEntryPath := "/" + 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.Path).To(Equal(createCatalogEntryPath)) + Expect(req.Method).To(Equal("POST")) + Expect(req.URL.Query()["account"]).To(Equal([]string{"testString"})) + + res.Header().Set("Content-type", "application/json") + res.WriteHeader(201) + fmt.Fprintf(res, `} this is not valid json {`) + })) + }) + It(`Invoke CreateCatalogEntry with error: Operation response processing error`, func() { + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1(&globalcatalogv1.GlobalCatalogV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(testServiceErr).To(BeNil()) + Expect(testService).ToNot(BeNil()) + + // Construct an instance of the Bullets model + bulletsModel := new(globalcatalogv1.Bullets) + bulletsModel.Title = core.StringPtr("testString") + bulletsModel.Description = core.StringPtr("testString") + bulletsModel.Icon = core.StringPtr("testString") + bulletsModel.Quantity = core.Int64Ptr(int64(38)) + + // Construct an instance of the Price model + priceModel := new(globalcatalogv1.Price) + priceModel.QuantityTier = core.Int64Ptr(int64(38)) + priceModel.Price = core.Float64Ptr(72.5) + + // Construct an instance of the UIMetaMedia model + uiMetaMediaModel := new(globalcatalogv1.UIMetaMedia) + uiMetaMediaModel.Caption = core.StringPtr("testString") + uiMetaMediaModel.ThumbnailURL = core.StringPtr("testString") + uiMetaMediaModel.Type = core.StringPtr("testString") + uiMetaMediaModel.URL = core.StringPtr("testString") + uiMetaMediaModel.Source = bulletsModel + + // Construct an instance of the Amount model + amountModel := new(globalcatalogv1.Amount) + amountModel.Country = core.StringPtr("testString") + amountModel.Currency = core.StringPtr("testString") + amountModel.Prices = []globalcatalogv1.Price{*priceModel} + + // Construct an instance of the Strings model + stringsModel := new(globalcatalogv1.Strings) + stringsModel.Bullets = []globalcatalogv1.Bullets{*bulletsModel} + stringsModel.Media = []globalcatalogv1.UIMetaMedia{*uiMetaMediaModel} + stringsModel.NotCreatableMsg = core.StringPtr("testString") + stringsModel.NotCreatableRobotMsg = core.StringPtr("testString") + stringsModel.DeprecationWarning = core.StringPtr("testString") + stringsModel.PopupWarningMessage = core.StringPtr("testString") + stringsModel.Instruction = core.StringPtr("testString") + + // Construct an instance of the Broker model + brokerModel := new(globalcatalogv1.Broker) + brokerModel.Name = core.StringPtr("testString") + brokerModel.Guid = core.StringPtr("testString") + + // Construct an instance of the DRMetaData model + drMetaDataModel := new(globalcatalogv1.DRMetaData) + drMetaDataModel.Dr = core.BoolPtr(true) + drMetaDataModel.Description = core.StringPtr("testString") + + // Construct an instance of the I18N model + i18NModel := new(globalcatalogv1.I18N) + i18NModel.SetProperty("foo", stringsModel) + + // Construct an instance of the SourceMetaData model + sourceMetaDataModel := new(globalcatalogv1.SourceMetaData) + sourceMetaDataModel.Path = core.StringPtr("testString") + sourceMetaDataModel.Type = core.StringPtr("testString") + sourceMetaDataModel.URL = core.StringPtr("testString") + + // Construct an instance of the StartingPrice model + startingPriceModel := new(globalcatalogv1.StartingPrice) + startingPriceModel.PlanID = core.StringPtr("testString") + startingPriceModel.DeploymentID = core.StringPtr("testString") + startingPriceModel.Unit = core.StringPtr("testString") + startingPriceModel.Amount = []globalcatalogv1.Amount{*amountModel} + + // Construct an instance of the URLS model + urlsModel := new(globalcatalogv1.URLS) + urlsModel.DocURL = core.StringPtr("testString") + urlsModel.InstructionsURL = core.StringPtr("testString") + urlsModel.ApiURL = core.StringPtr("testString") + urlsModel.CreateURL = core.StringPtr("testString") + urlsModel.SdkDownloadURL = core.StringPtr("testString") + urlsModel.TermsURL = core.StringPtr("testString") + urlsModel.CustomCreatePageURL = core.StringPtr("testString") + urlsModel.CatalogDetailsURL = core.StringPtr("testString") + urlsModel.DeprecationDocURL = core.StringPtr("testString") + urlsModel.DashboardURL = core.StringPtr("testString") + urlsModel.RegistrationURL = core.StringPtr("testString") + urlsModel.Apidocsurl = core.StringPtr("testString") + + // Construct an instance of the AliasMetaData model + aliasMetaDataModel := new(globalcatalogv1.AliasMetaData) + aliasMetaDataModel.Type = core.StringPtr("testString") + aliasMetaDataModel.PlanID = core.StringPtr("testString") + + // Construct an instance of the CFMetaData model + cfMetaDataModel := new(globalcatalogv1.CFMetaData) + cfMetaDataModel.Type = core.StringPtr("testString") + cfMetaDataModel.IamCompatible = core.BoolPtr(true) + cfMetaDataModel.UniqueApiKey = core.BoolPtr(true) + cfMetaDataModel.Provisionable = core.BoolPtr(true) + cfMetaDataModel.Bindable = core.BoolPtr(true) + cfMetaDataModel.AsyncProvisioningSupported = core.BoolPtr(true) + cfMetaDataModel.AsyncUnprovisioningSupported = core.BoolPtr(true) + cfMetaDataModel.Requires = []string{"testString"} + cfMetaDataModel.PlanUpdateable = core.BoolPtr(true) + cfMetaDataModel.State = core.StringPtr("testString") + cfMetaDataModel.ServiceCheckEnabled = core.BoolPtr(true) + cfMetaDataModel.TestCheckInterval = core.Int64Ptr(int64(38)) + cfMetaDataModel.ServiceKeySupported = core.BoolPtr(true) + cfMetaDataModel.CfGuid = make(map[string]string) + + // Construct an instance of the Callbacks model + callbacksModel := new(globalcatalogv1.Callbacks) + callbacksModel.ControllerURL = core.StringPtr("testString") + callbacksModel.BrokerURL = core.StringPtr("testString") + callbacksModel.BrokerProxyURL = core.StringPtr("testString") + callbacksModel.DashboardURL = core.StringPtr("testString") + callbacksModel.DashboardDataURL = core.StringPtr("testString") + callbacksModel.DashboardDetailTabURL = core.StringPtr("testString") + callbacksModel.DashboardDetailTabExtURL = core.StringPtr("testString") + callbacksModel.ServiceMonitorApi = core.StringPtr("testString") + callbacksModel.ServiceMonitorApp = core.StringPtr("testString") + callbacksModel.ApiEndpoint = make(map[string]string) + + // Construct an instance of the DeploymentBase model + deploymentBaseModel := new(globalcatalogv1.DeploymentBase) + deploymentBaseModel.Location = core.StringPtr("testString") + deploymentBaseModel.LocationURL = core.StringPtr("testString") + deploymentBaseModel.OriginalLocation = core.StringPtr("testString") + deploymentBaseModel.TargetCrn = core.StringPtr("testString") + deploymentBaseModel.ServiceCrn = core.StringPtr("testString") + deploymentBaseModel.MccpID = core.StringPtr("testString") + deploymentBaseModel.Broker = brokerModel + deploymentBaseModel.SupportsRcMigration = core.BoolPtr(true) + deploymentBaseModel.TargetNetwork = core.StringPtr("testString") + + // Construct an instance of the Overview model + overviewModel := new(globalcatalogv1.Overview) + overviewModel.DisplayName = core.StringPtr("testString") + overviewModel.LongDescription = core.StringPtr("testString") + overviewModel.Description = core.StringPtr("testString") + overviewModel.FeaturedDescription = core.StringPtr("testString") + + // Construct an instance of the PlanMetaData model + planMetaDataModel := new(globalcatalogv1.PlanMetaData) + planMetaDataModel.Bindable = core.BoolPtr(true) + planMetaDataModel.Reservable = core.BoolPtr(true) + planMetaDataModel.AllowInternalUsers = core.BoolPtr(true) + planMetaDataModel.AsyncProvisioningSupported = core.BoolPtr(true) + planMetaDataModel.AsyncUnprovisioningSupported = core.BoolPtr(true) + planMetaDataModel.TestCheckInterval = core.Int64Ptr(int64(38)) + planMetaDataModel.SingleScopeInstance = core.StringPtr("testString") + planMetaDataModel.ServiceCheckEnabled = core.BoolPtr(true) + planMetaDataModel.CfGuid = make(map[string]string) + + // Construct an instance of the PricingSet model + pricingSetModel := new(globalcatalogv1.PricingSet) + pricingSetModel.Type = core.StringPtr("testString") + pricingSetModel.Origin = core.StringPtr("testString") + pricingSetModel.StartingPrice = startingPriceModel + + // Construct an instance of the SLAMetaData model + slaMetaDataModel := new(globalcatalogv1.SLAMetaData) + slaMetaDataModel.Terms = core.StringPtr("testString") + slaMetaDataModel.Tenancy = core.StringPtr("testString") + slaMetaDataModel.Provisioning = core.StringPtr("testString") + slaMetaDataModel.Responsiveness = core.StringPtr("testString") + slaMetaDataModel.Dr = drMetaDataModel + + // Construct an instance of the TemplateMetaData model + templateMetaDataModel := new(globalcatalogv1.TemplateMetaData) + templateMetaDataModel.Services = []string{"testString"} + templateMetaDataModel.DefaultMemory = core.Int64Ptr(int64(38)) + templateMetaDataModel.StartCmd = core.StringPtr("testString") + templateMetaDataModel.Source = sourceMetaDataModel + templateMetaDataModel.RuntimeCatalogID = core.StringPtr("testString") + templateMetaDataModel.CfRuntimeID = core.StringPtr("testString") + templateMetaDataModel.TemplateID = core.StringPtr("testString") + templateMetaDataModel.ExecutableFile = core.StringPtr("testString") + templateMetaDataModel.Buildpack = core.StringPtr("testString") + templateMetaDataModel.EnvironmentVariables = make(map[string]string) + + // Construct an instance of the UIMetaData model + uiMetaDataModel := new(globalcatalogv1.UIMetaData) + uiMetaDataModel.Strings = i18NModel + uiMetaDataModel.Urls = urlsModel + uiMetaDataModel.EmbeddableDashboard = core.StringPtr("testString") + uiMetaDataModel.EmbeddableDashboardFullWidth = core.BoolPtr(true) + uiMetaDataModel.NavigationOrder = []string{"testString"} + uiMetaDataModel.NotCreatable = core.BoolPtr(true) + uiMetaDataModel.PrimaryOfferingID = core.StringPtr("testString") + uiMetaDataModel.AccessibleDuringProvision = core.BoolPtr(true) + uiMetaDataModel.SideBySideIndex = core.Int64Ptr(int64(38)) + uiMetaDataModel.EndOfServiceTime = CreateMockDateTime() + uiMetaDataModel.Hidden = core.BoolPtr(true) + uiMetaDataModel.HideLiteMetering = core.BoolPtr(true) + uiMetaDataModel.NoUpgradeNextStep = core.BoolPtr(true) + + // Construct an instance of the Image model + imageModel := new(globalcatalogv1.Image) + imageModel.Image = core.StringPtr("testString") + imageModel.SmallImage = core.StringPtr("testString") + imageModel.MediumImage = core.StringPtr("testString") + imageModel.FeatureImage = core.StringPtr("testString") + + // Construct an instance of the ObjectMetadataSet model + objectMetadataSetModel := new(globalcatalogv1.ObjectMetadataSet) + objectMetadataSetModel.RcCompatible = core.BoolPtr(true) + objectMetadataSetModel.Service = cfMetaDataModel + objectMetadataSetModel.Plan = planMetaDataModel + objectMetadataSetModel.Alias = aliasMetaDataModel + objectMetadataSetModel.Template = templateMetaDataModel + objectMetadataSetModel.Ui = uiMetaDataModel + objectMetadataSetModel.Compliance = []string{"testString"} + objectMetadataSetModel.Sla = slaMetaDataModel + objectMetadataSetModel.Callbacks = callbacksModel + objectMetadataSetModel.OriginalName = core.StringPtr("testString") + objectMetadataSetModel.Version = core.StringPtr("testString") + objectMetadataSetModel.Other = make(map[string]interface{}) + objectMetadataSetModel.Pricing = pricingSetModel + objectMetadataSetModel.Deployment = deploymentBaseModel + + // Construct an instance of the OverviewUI model + overviewUiModel := new(globalcatalogv1.OverviewUI) + overviewUiModel.SetProperty("foo", overviewModel) + + // Construct an instance of the Provider model + providerModel := new(globalcatalogv1.Provider) + providerModel.Email = core.StringPtr("testString") + providerModel.Name = core.StringPtr("testString") + providerModel.Contact = core.StringPtr("testString") + providerModel.SupportEmail = core.StringPtr("testString") + providerModel.Phone = core.StringPtr("testString") + + // Construct an instance of the CreateCatalogEntryOptions model + createCatalogEntryOptionsModel := new(globalcatalogv1.CreateCatalogEntryOptions) + createCatalogEntryOptionsModel.Name = core.StringPtr("testString") + createCatalogEntryOptionsModel.Kind = core.StringPtr("service") + createCatalogEntryOptionsModel.OverviewUi = overviewUiModel + createCatalogEntryOptionsModel.Images = imageModel + createCatalogEntryOptionsModel.Disabled = core.BoolPtr(true) + createCatalogEntryOptionsModel.Tags = []string{"testString"} + createCatalogEntryOptionsModel.Provider = providerModel + createCatalogEntryOptionsModel.ID = core.StringPtr("testString") + createCatalogEntryOptionsModel.ParentID = core.StringPtr("testString") + createCatalogEntryOptionsModel.Group = core.BoolPtr(true) + createCatalogEntryOptionsModel.Active = core.BoolPtr(true) + createCatalogEntryOptionsModel.Metadata = objectMetadataSetModel + createCatalogEntryOptionsModel.Account = core.StringPtr("testString") + createCatalogEntryOptionsModel.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 := testService.CreateCatalogEntry(createCatalogEntryOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + + Describe(`CreateCatalogEntry(createCatalogEntryOptions *CreateCatalogEntryOptions)`, func() { + createCatalogEntryPath := "/" + 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.Path).To(Equal(createCatalogEntryPath)) + Expect(req.Method).To(Equal("POST")) + Expect(req.URL.Query()["account"]).To(Equal([]string{"testString"})) + + res.Header().Set("Content-type", "application/json") + res.WriteHeader(201) + fmt.Fprintf(res, `{"name": "Name", "kind": "service", "overview_ui": {}, "images": {"image": "Image", "small_image": "SmallImage", "medium_image": "MediumImage", "feature_image": "FeatureImage"}, "parent_id": "ParentID", "disabled": true, "tags": ["Tags"], "group": false, "provider": {"email": "Email", "name": "Name", "contact": "Contact", "support_email": "SupportEmail", "phone": "Phone"}, "active": true, "metadata": {"rc_compatible": true, "service": {"type": "Type", "iam_compatible": false, "unique_api_key": true, "provisionable": false, "bindable": true, "async_provisioning_supported": true, "async_unprovisioning_supported": true, "requires": ["Requires"], "plan_updateable": true, "state": "State", "service_check_enabled": false, "test_check_interval": 17, "service_key_supported": false, "cf_guid": {"mapKey": "Inner"}}, "plan": {"bindable": true, "reservable": true, "allow_internal_users": true, "async_provisioning_supported": true, "async_unprovisioning_supported": true, "test_check_interval": 17, "single_scope_instance": "SingleScopeInstance", "service_check_enabled": false, "cf_guid": {"mapKey": "Inner"}}, "alias": {"type": "Type", "plan_id": "PlanID"}, "template": {"services": ["Services"], "default_memory": 13, "start_cmd": "StartCmd", "source": {"path": "Path", "type": "Type", "url": "URL"}, "runtime_catalog_id": "RuntimeCatalogID", "cf_runtime_id": "CfRuntimeID", "template_id": "TemplateID", "executable_file": "ExecutableFile", "buildpack": "Buildpack", "environment_variables": {"mapKey": "Inner"}}, "ui": {"strings": {}, "urls": {"doc_url": "DocURL", "instructions_url": "InstructionsURL", "api_url": "ApiURL", "create_url": "CreateURL", "sdk_download_url": "SdkDownloadURL", "terms_url": "TermsURL", "custom_create_page_url": "CustomCreatePageURL", "catalog_details_url": "CatalogDetailsURL", "deprecation_doc_url": "DeprecationDocURL", "dashboard_url": "DashboardURL", "registration_url": "RegistrationURL", "apidocsurl": "Apidocsurl"}, "embeddable_dashboard": "EmbeddableDashboard", "embeddable_dashboard_full_width": true, "navigation_order": ["NavigationOrder"], "not_creatable": true, "primary_offering_id": "PrimaryOfferingID", "accessible_during_provision": false, "side_by_side_index": 15, "end_of_service_time": "2019-01-01T12:00:00", "hidden": true, "hide_lite_metering": true, "no_upgrade_next_step": false}, "compliance": ["Compliance"], "sla": {"terms": "Terms", "tenancy": "Tenancy", "provisioning": "Provisioning", "responsiveness": "Responsiveness", "dr": {"dr": true, "description": "Description"}}, "callbacks": {"controller_url": "ControllerURL", "broker_url": "BrokerURL", "broker_proxy_url": "BrokerProxyURL", "dashboard_url": "DashboardURL", "dashboard_data_url": "DashboardDataURL", "dashboard_detail_tab_url": "DashboardDetailTabURL", "dashboard_detail_tab_ext_url": "DashboardDetailTabExtURL", "service_monitor_api": "ServiceMonitorApi", "service_monitor_app": "ServiceMonitorApp", "api_endpoint": {"mapKey": "Inner"}}, "original_name": "OriginalName", "version": "Version", "other": {"mapKey": {"anyKey": "anyValue"}}, "pricing": {"type": "Type", "origin": "Origin", "starting_price": {"plan_id": "PlanID", "deployment_id": "DeploymentID", "unit": "Unit", "amount": [{"country": "Country", "currency": "Currency", "prices": [{"quantity_tier": 12, "Price": 5}]}]}, "metrics": [{"part_ref": "PartRef", "metric_id": "MetricID", "tier_model": "TierModel", "charge_unit": "ChargeUnit", "charge_unit_name": "ChargeUnitName", "charge_unit_quantity": "ChargeUnitQuantity", "resource_display_name": "ResourceDisplayName", "charge_unit_display_name": "ChargeUnitDisplayName", "usage_cap_qty": 11, "display_cap": 10, "effective_from": "2019-01-01T12:00:00", "effective_until": "2019-01-01T12:00:00", "amounts": [{"country": "Country", "currency": "Currency", "prices": [{"quantity_tier": 12, "Price": 5}]}]}]}, "deployment": {"location": "Location", "location_url": "LocationURL", "original_location": "OriginalLocation", "target_crn": "TargetCrn", "service_crn": "ServiceCrn", "mccp_id": "MccpID", "broker": {"name": "Name", "guid": "Guid"}, "supports_rc_migration": false, "target_network": "TargetNetwork"}}, "id": "ID", "catalog_crn": "anyValue", "url": "anyValue", "children_url": "anyValue", "geo_tags": "anyValue", "pricing_tags": "anyValue", "created": "anyValue", "updated": "anyValue"}`) + })) + }) + It(`Invoke CreateCatalogEntry successfully`, func() { + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1(&globalcatalogv1.GlobalCatalogV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(testServiceErr).To(BeNil()) + Expect(testService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := testService.CreateCatalogEntry(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the Bullets model + bulletsModel := new(globalcatalogv1.Bullets) + bulletsModel.Title = core.StringPtr("testString") + bulletsModel.Description = core.StringPtr("testString") + bulletsModel.Icon = core.StringPtr("testString") + bulletsModel.Quantity = core.Int64Ptr(int64(38)) + + // Construct an instance of the Price model + priceModel := new(globalcatalogv1.Price) + priceModel.QuantityTier = core.Int64Ptr(int64(38)) + priceModel.Price = core.Float64Ptr(72.5) + + // Construct an instance of the UIMetaMedia model + uiMetaMediaModel := new(globalcatalogv1.UIMetaMedia) + uiMetaMediaModel.Caption = core.StringPtr("testString") + uiMetaMediaModel.ThumbnailURL = core.StringPtr("testString") + uiMetaMediaModel.Type = core.StringPtr("testString") + uiMetaMediaModel.URL = core.StringPtr("testString") + uiMetaMediaModel.Source = bulletsModel + + // Construct an instance of the Amount model + amountModel := new(globalcatalogv1.Amount) + amountModel.Country = core.StringPtr("testString") + amountModel.Currency = core.StringPtr("testString") + amountModel.Prices = []globalcatalogv1.Price{*priceModel} + + // Construct an instance of the Strings model + stringsModel := new(globalcatalogv1.Strings) + stringsModel.Bullets = []globalcatalogv1.Bullets{*bulletsModel} + stringsModel.Media = []globalcatalogv1.UIMetaMedia{*uiMetaMediaModel} + stringsModel.NotCreatableMsg = core.StringPtr("testString") + stringsModel.NotCreatableRobotMsg = core.StringPtr("testString") + stringsModel.DeprecationWarning = core.StringPtr("testString") + stringsModel.PopupWarningMessage = core.StringPtr("testString") + stringsModel.Instruction = core.StringPtr("testString") + + // Construct an instance of the Broker model + brokerModel := new(globalcatalogv1.Broker) + brokerModel.Name = core.StringPtr("testString") + brokerModel.Guid = core.StringPtr("testString") + + // Construct an instance of the DRMetaData model + drMetaDataModel := new(globalcatalogv1.DRMetaData) + drMetaDataModel.Dr = core.BoolPtr(true) + drMetaDataModel.Description = core.StringPtr("testString") + + // Construct an instance of the I18N model + i18NModel := new(globalcatalogv1.I18N) + i18NModel.SetProperty("foo", stringsModel) + + // Construct an instance of the SourceMetaData model + sourceMetaDataModel := new(globalcatalogv1.SourceMetaData) + sourceMetaDataModel.Path = core.StringPtr("testString") + sourceMetaDataModel.Type = core.StringPtr("testString") + sourceMetaDataModel.URL = core.StringPtr("testString") + + // Construct an instance of the StartingPrice model + startingPriceModel := new(globalcatalogv1.StartingPrice) + startingPriceModel.PlanID = core.StringPtr("testString") + startingPriceModel.DeploymentID = core.StringPtr("testString") + startingPriceModel.Unit = core.StringPtr("testString") + startingPriceModel.Amount = []globalcatalogv1.Amount{*amountModel} + + // Construct an instance of the URLS model + urlsModel := new(globalcatalogv1.URLS) + urlsModel.DocURL = core.StringPtr("testString") + urlsModel.InstructionsURL = core.StringPtr("testString") + urlsModel.ApiURL = core.StringPtr("testString") + urlsModel.CreateURL = core.StringPtr("testString") + urlsModel.SdkDownloadURL = core.StringPtr("testString") + urlsModel.TermsURL = core.StringPtr("testString") + urlsModel.CustomCreatePageURL = core.StringPtr("testString") + urlsModel.CatalogDetailsURL = core.StringPtr("testString") + urlsModel.DeprecationDocURL = core.StringPtr("testString") + urlsModel.DashboardURL = core.StringPtr("testString") + urlsModel.RegistrationURL = core.StringPtr("testString") + urlsModel.Apidocsurl = core.StringPtr("testString") + + // Construct an instance of the AliasMetaData model + aliasMetaDataModel := new(globalcatalogv1.AliasMetaData) + aliasMetaDataModel.Type = core.StringPtr("testString") + aliasMetaDataModel.PlanID = core.StringPtr("testString") + + // Construct an instance of the CFMetaData model + cfMetaDataModel := new(globalcatalogv1.CFMetaData) + cfMetaDataModel.Type = core.StringPtr("testString") + cfMetaDataModel.IamCompatible = core.BoolPtr(true) + cfMetaDataModel.UniqueApiKey = core.BoolPtr(true) + cfMetaDataModel.Provisionable = core.BoolPtr(true) + cfMetaDataModel.Bindable = core.BoolPtr(true) + cfMetaDataModel.AsyncProvisioningSupported = core.BoolPtr(true) + cfMetaDataModel.AsyncUnprovisioningSupported = core.BoolPtr(true) + cfMetaDataModel.Requires = []string{"testString"} + cfMetaDataModel.PlanUpdateable = core.BoolPtr(true) + cfMetaDataModel.State = core.StringPtr("testString") + cfMetaDataModel.ServiceCheckEnabled = core.BoolPtr(true) + cfMetaDataModel.TestCheckInterval = core.Int64Ptr(int64(38)) + cfMetaDataModel.ServiceKeySupported = core.BoolPtr(true) + cfMetaDataModel.CfGuid = make(map[string]string) + + // Construct an instance of the Callbacks model + callbacksModel := new(globalcatalogv1.Callbacks) + callbacksModel.ControllerURL = core.StringPtr("testString") + callbacksModel.BrokerURL = core.StringPtr("testString") + callbacksModel.BrokerProxyURL = core.StringPtr("testString") + callbacksModel.DashboardURL = core.StringPtr("testString") + callbacksModel.DashboardDataURL = core.StringPtr("testString") + callbacksModel.DashboardDetailTabURL = core.StringPtr("testString") + callbacksModel.DashboardDetailTabExtURL = core.StringPtr("testString") + callbacksModel.ServiceMonitorApi = core.StringPtr("testString") + callbacksModel.ServiceMonitorApp = core.StringPtr("testString") + callbacksModel.ApiEndpoint = make(map[string]string) + + // Construct an instance of the DeploymentBase model + deploymentBaseModel := new(globalcatalogv1.DeploymentBase) + deploymentBaseModel.Location = core.StringPtr("testString") + deploymentBaseModel.LocationURL = core.StringPtr("testString") + deploymentBaseModel.OriginalLocation = core.StringPtr("testString") + deploymentBaseModel.TargetCrn = core.StringPtr("testString") + deploymentBaseModel.ServiceCrn = core.StringPtr("testString") + deploymentBaseModel.MccpID = core.StringPtr("testString") + deploymentBaseModel.Broker = brokerModel + deploymentBaseModel.SupportsRcMigration = core.BoolPtr(true) + deploymentBaseModel.TargetNetwork = core.StringPtr("testString") + + // Construct an instance of the Overview model + overviewModel := new(globalcatalogv1.Overview) + overviewModel.DisplayName = core.StringPtr("testString") + overviewModel.LongDescription = core.StringPtr("testString") + overviewModel.Description = core.StringPtr("testString") + overviewModel.FeaturedDescription = core.StringPtr("testString") + + // Construct an instance of the PlanMetaData model + planMetaDataModel := new(globalcatalogv1.PlanMetaData) + planMetaDataModel.Bindable = core.BoolPtr(true) + planMetaDataModel.Reservable = core.BoolPtr(true) + planMetaDataModel.AllowInternalUsers = core.BoolPtr(true) + planMetaDataModel.AsyncProvisioningSupported = core.BoolPtr(true) + planMetaDataModel.AsyncUnprovisioningSupported = core.BoolPtr(true) + planMetaDataModel.TestCheckInterval = core.Int64Ptr(int64(38)) + planMetaDataModel.SingleScopeInstance = core.StringPtr("testString") + planMetaDataModel.ServiceCheckEnabled = core.BoolPtr(true) + planMetaDataModel.CfGuid = make(map[string]string) + + // Construct an instance of the PricingSet model + pricingSetModel := new(globalcatalogv1.PricingSet) + pricingSetModel.Type = core.StringPtr("testString") + pricingSetModel.Origin = core.StringPtr("testString") + pricingSetModel.StartingPrice = startingPriceModel + + // Construct an instance of the SLAMetaData model + slaMetaDataModel := new(globalcatalogv1.SLAMetaData) + slaMetaDataModel.Terms = core.StringPtr("testString") + slaMetaDataModel.Tenancy = core.StringPtr("testString") + slaMetaDataModel.Provisioning = core.StringPtr("testString") + slaMetaDataModel.Responsiveness = core.StringPtr("testString") + slaMetaDataModel.Dr = drMetaDataModel + + // Construct an instance of the TemplateMetaData model + templateMetaDataModel := new(globalcatalogv1.TemplateMetaData) + templateMetaDataModel.Services = []string{"testString"} + templateMetaDataModel.DefaultMemory = core.Int64Ptr(int64(38)) + templateMetaDataModel.StartCmd = core.StringPtr("testString") + templateMetaDataModel.Source = sourceMetaDataModel + templateMetaDataModel.RuntimeCatalogID = core.StringPtr("testString") + templateMetaDataModel.CfRuntimeID = core.StringPtr("testString") + templateMetaDataModel.TemplateID = core.StringPtr("testString") + templateMetaDataModel.ExecutableFile = core.StringPtr("testString") + templateMetaDataModel.Buildpack = core.StringPtr("testString") + templateMetaDataModel.EnvironmentVariables = make(map[string]string) + + // Construct an instance of the UIMetaData model + uiMetaDataModel := new(globalcatalogv1.UIMetaData) + uiMetaDataModel.Strings = i18NModel + uiMetaDataModel.Urls = urlsModel + uiMetaDataModel.EmbeddableDashboard = core.StringPtr("testString") + uiMetaDataModel.EmbeddableDashboardFullWidth = core.BoolPtr(true) + uiMetaDataModel.NavigationOrder = []string{"testString"} + uiMetaDataModel.NotCreatable = core.BoolPtr(true) + uiMetaDataModel.PrimaryOfferingID = core.StringPtr("testString") + uiMetaDataModel.AccessibleDuringProvision = core.BoolPtr(true) + uiMetaDataModel.SideBySideIndex = core.Int64Ptr(int64(38)) + uiMetaDataModel.EndOfServiceTime = CreateMockDateTime() + uiMetaDataModel.Hidden = core.BoolPtr(true) + uiMetaDataModel.HideLiteMetering = core.BoolPtr(true) + uiMetaDataModel.NoUpgradeNextStep = core.BoolPtr(true) + + // Construct an instance of the Image model + imageModel := new(globalcatalogv1.Image) + imageModel.Image = core.StringPtr("testString") + imageModel.SmallImage = core.StringPtr("testString") + imageModel.MediumImage = core.StringPtr("testString") + imageModel.FeatureImage = core.StringPtr("testString") + + // Construct an instance of the ObjectMetadataSet model + objectMetadataSetModel := new(globalcatalogv1.ObjectMetadataSet) + objectMetadataSetModel.RcCompatible = core.BoolPtr(true) + objectMetadataSetModel.Service = cfMetaDataModel + objectMetadataSetModel.Plan = planMetaDataModel + objectMetadataSetModel.Alias = aliasMetaDataModel + objectMetadataSetModel.Template = templateMetaDataModel + objectMetadataSetModel.Ui = uiMetaDataModel + objectMetadataSetModel.Compliance = []string{"testString"} + objectMetadataSetModel.Sla = slaMetaDataModel + objectMetadataSetModel.Callbacks = callbacksModel + objectMetadataSetModel.OriginalName = core.StringPtr("testString") + objectMetadataSetModel.Version = core.StringPtr("testString") + objectMetadataSetModel.Other = make(map[string]interface{}) + objectMetadataSetModel.Pricing = pricingSetModel + objectMetadataSetModel.Deployment = deploymentBaseModel + + // Construct an instance of the OverviewUI model + overviewUiModel := new(globalcatalogv1.OverviewUI) + overviewUiModel.SetProperty("foo", overviewModel) + + // Construct an instance of the Provider model + providerModel := new(globalcatalogv1.Provider) + providerModel.Email = core.StringPtr("testString") + providerModel.Name = core.StringPtr("testString") + providerModel.Contact = core.StringPtr("testString") + providerModel.SupportEmail = core.StringPtr("testString") + providerModel.Phone = core.StringPtr("testString") + + // Construct an instance of the CreateCatalogEntryOptions model + createCatalogEntryOptionsModel := new(globalcatalogv1.CreateCatalogEntryOptions) + createCatalogEntryOptionsModel.Name = core.StringPtr("testString") + createCatalogEntryOptionsModel.Kind = core.StringPtr("service") + createCatalogEntryOptionsModel.OverviewUi = overviewUiModel + createCatalogEntryOptionsModel.Images = imageModel + createCatalogEntryOptionsModel.Disabled = core.BoolPtr(true) + createCatalogEntryOptionsModel.Tags = []string{"testString"} + createCatalogEntryOptionsModel.Provider = providerModel + createCatalogEntryOptionsModel.ID = core.StringPtr("testString") + createCatalogEntryOptionsModel.ParentID = core.StringPtr("testString") + createCatalogEntryOptionsModel.Group = core.BoolPtr(true) + createCatalogEntryOptionsModel.Active = core.BoolPtr(true) + createCatalogEntryOptionsModel.Metadata = objectMetadataSetModel + createCatalogEntryOptionsModel.Account = core.StringPtr("testString") + createCatalogEntryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = testService.CreateCatalogEntry(createCatalogEntryOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + }) + It(`Invoke CreateCatalogEntry with error: Operation validation and request error`, func() { + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1(&globalcatalogv1.GlobalCatalogV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(testServiceErr).To(BeNil()) + Expect(testService).ToNot(BeNil()) + + // Construct an instance of the Bullets model + bulletsModel := new(globalcatalogv1.Bullets) + bulletsModel.Title = core.StringPtr("testString") + bulletsModel.Description = core.StringPtr("testString") + bulletsModel.Icon = core.StringPtr("testString") + bulletsModel.Quantity = core.Int64Ptr(int64(38)) + + // Construct an instance of the Price model + priceModel := new(globalcatalogv1.Price) + priceModel.QuantityTier = core.Int64Ptr(int64(38)) + priceModel.Price = core.Float64Ptr(72.5) + + // Construct an instance of the UIMetaMedia model + uiMetaMediaModel := new(globalcatalogv1.UIMetaMedia) + uiMetaMediaModel.Caption = core.StringPtr("testString") + uiMetaMediaModel.ThumbnailURL = core.StringPtr("testString") + uiMetaMediaModel.Type = core.StringPtr("testString") + uiMetaMediaModel.URL = core.StringPtr("testString") + uiMetaMediaModel.Source = bulletsModel + + // Construct an instance of the Amount model + amountModel := new(globalcatalogv1.Amount) + amountModel.Country = core.StringPtr("testString") + amountModel.Currency = core.StringPtr("testString") + amountModel.Prices = []globalcatalogv1.Price{*priceModel} + + // Construct an instance of the Strings model + stringsModel := new(globalcatalogv1.Strings) + stringsModel.Bullets = []globalcatalogv1.Bullets{*bulletsModel} + stringsModel.Media = []globalcatalogv1.UIMetaMedia{*uiMetaMediaModel} + stringsModel.NotCreatableMsg = core.StringPtr("testString") + stringsModel.NotCreatableRobotMsg = core.StringPtr("testString") + stringsModel.DeprecationWarning = core.StringPtr("testString") + stringsModel.PopupWarningMessage = core.StringPtr("testString") + stringsModel.Instruction = core.StringPtr("testString") + + // Construct an instance of the Broker model + brokerModel := new(globalcatalogv1.Broker) + brokerModel.Name = core.StringPtr("testString") + brokerModel.Guid = core.StringPtr("testString") + + // Construct an instance of the DRMetaData model + drMetaDataModel := new(globalcatalogv1.DRMetaData) + drMetaDataModel.Dr = core.BoolPtr(true) + drMetaDataModel.Description = core.StringPtr("testString") + + // Construct an instance of the I18N model + i18NModel := new(globalcatalogv1.I18N) + i18NModel.SetProperty("foo", stringsModel) + + // Construct an instance of the SourceMetaData model + sourceMetaDataModel := new(globalcatalogv1.SourceMetaData) + sourceMetaDataModel.Path = core.StringPtr("testString") + sourceMetaDataModel.Type = core.StringPtr("testString") + sourceMetaDataModel.URL = core.StringPtr("testString") + + // Construct an instance of the StartingPrice model + startingPriceModel := new(globalcatalogv1.StartingPrice) + startingPriceModel.PlanID = core.StringPtr("testString") + startingPriceModel.DeploymentID = core.StringPtr("testString") + startingPriceModel.Unit = core.StringPtr("testString") + startingPriceModel.Amount = []globalcatalogv1.Amount{*amountModel} + + // Construct an instance of the URLS model + urlsModel := new(globalcatalogv1.URLS) + urlsModel.DocURL = core.StringPtr("testString") + urlsModel.InstructionsURL = core.StringPtr("testString") + urlsModel.ApiURL = core.StringPtr("testString") + urlsModel.CreateURL = core.StringPtr("testString") + urlsModel.SdkDownloadURL = core.StringPtr("testString") + urlsModel.TermsURL = core.StringPtr("testString") + urlsModel.CustomCreatePageURL = core.StringPtr("testString") + urlsModel.CatalogDetailsURL = core.StringPtr("testString") + urlsModel.DeprecationDocURL = core.StringPtr("testString") + urlsModel.DashboardURL = core.StringPtr("testString") + urlsModel.RegistrationURL = core.StringPtr("testString") + urlsModel.Apidocsurl = core.StringPtr("testString") + + // Construct an instance of the AliasMetaData model + aliasMetaDataModel := new(globalcatalogv1.AliasMetaData) + aliasMetaDataModel.Type = core.StringPtr("testString") + aliasMetaDataModel.PlanID = core.StringPtr("testString") + + // Construct an instance of the CFMetaData model + cfMetaDataModel := new(globalcatalogv1.CFMetaData) + cfMetaDataModel.Type = core.StringPtr("testString") + cfMetaDataModel.IamCompatible = core.BoolPtr(true) + cfMetaDataModel.UniqueApiKey = core.BoolPtr(true) + cfMetaDataModel.Provisionable = core.BoolPtr(true) + cfMetaDataModel.Bindable = core.BoolPtr(true) + cfMetaDataModel.AsyncProvisioningSupported = core.BoolPtr(true) + cfMetaDataModel.AsyncUnprovisioningSupported = core.BoolPtr(true) + cfMetaDataModel.Requires = []string{"testString"} + cfMetaDataModel.PlanUpdateable = core.BoolPtr(true) + cfMetaDataModel.State = core.StringPtr("testString") + cfMetaDataModel.ServiceCheckEnabled = core.BoolPtr(true) + cfMetaDataModel.TestCheckInterval = core.Int64Ptr(int64(38)) + cfMetaDataModel.ServiceKeySupported = core.BoolPtr(true) + cfMetaDataModel.CfGuid = make(map[string]string) + + // Construct an instance of the Callbacks model + callbacksModel := new(globalcatalogv1.Callbacks) + callbacksModel.ControllerURL = core.StringPtr("testString") + callbacksModel.BrokerURL = core.StringPtr("testString") + callbacksModel.BrokerProxyURL = core.StringPtr("testString") + callbacksModel.DashboardURL = core.StringPtr("testString") + callbacksModel.DashboardDataURL = core.StringPtr("testString") + callbacksModel.DashboardDetailTabURL = core.StringPtr("testString") + callbacksModel.DashboardDetailTabExtURL = core.StringPtr("testString") + callbacksModel.ServiceMonitorApi = core.StringPtr("testString") + callbacksModel.ServiceMonitorApp = core.StringPtr("testString") + callbacksModel.ApiEndpoint = make(map[string]string) + + // Construct an instance of the DeploymentBase model + deploymentBaseModel := new(globalcatalogv1.DeploymentBase) + deploymentBaseModel.Location = core.StringPtr("testString") + deploymentBaseModel.LocationURL = core.StringPtr("testString") + deploymentBaseModel.OriginalLocation = core.StringPtr("testString") + deploymentBaseModel.TargetCrn = core.StringPtr("testString") + deploymentBaseModel.ServiceCrn = core.StringPtr("testString") + deploymentBaseModel.MccpID = core.StringPtr("testString") + deploymentBaseModel.Broker = brokerModel + deploymentBaseModel.SupportsRcMigration = core.BoolPtr(true) + deploymentBaseModel.TargetNetwork = core.StringPtr("testString") + + // Construct an instance of the Overview model + overviewModel := new(globalcatalogv1.Overview) + overviewModel.DisplayName = core.StringPtr("testString") + overviewModel.LongDescription = core.StringPtr("testString") + overviewModel.Description = core.StringPtr("testString") + overviewModel.FeaturedDescription = core.StringPtr("testString") + + // Construct an instance of the PlanMetaData model + planMetaDataModel := new(globalcatalogv1.PlanMetaData) + planMetaDataModel.Bindable = core.BoolPtr(true) + planMetaDataModel.Reservable = core.BoolPtr(true) + planMetaDataModel.AllowInternalUsers = core.BoolPtr(true) + planMetaDataModel.AsyncProvisioningSupported = core.BoolPtr(true) + planMetaDataModel.AsyncUnprovisioningSupported = core.BoolPtr(true) + planMetaDataModel.TestCheckInterval = core.Int64Ptr(int64(38)) + planMetaDataModel.SingleScopeInstance = core.StringPtr("testString") + planMetaDataModel.ServiceCheckEnabled = core.BoolPtr(true) + planMetaDataModel.CfGuid = make(map[string]string) + + // Construct an instance of the PricingSet model + pricingSetModel := new(globalcatalogv1.PricingSet) + pricingSetModel.Type = core.StringPtr("testString") + pricingSetModel.Origin = core.StringPtr("testString") + pricingSetModel.StartingPrice = startingPriceModel + + // Construct an instance of the SLAMetaData model + slaMetaDataModel := new(globalcatalogv1.SLAMetaData) + slaMetaDataModel.Terms = core.StringPtr("testString") + slaMetaDataModel.Tenancy = core.StringPtr("testString") + slaMetaDataModel.Provisioning = core.StringPtr("testString") + slaMetaDataModel.Responsiveness = core.StringPtr("testString") + slaMetaDataModel.Dr = drMetaDataModel + + // Construct an instance of the TemplateMetaData model + templateMetaDataModel := new(globalcatalogv1.TemplateMetaData) + templateMetaDataModel.Services = []string{"testString"} + templateMetaDataModel.DefaultMemory = core.Int64Ptr(int64(38)) + templateMetaDataModel.StartCmd = core.StringPtr("testString") + templateMetaDataModel.Source = sourceMetaDataModel + templateMetaDataModel.RuntimeCatalogID = core.StringPtr("testString") + templateMetaDataModel.CfRuntimeID = core.StringPtr("testString") + templateMetaDataModel.TemplateID = core.StringPtr("testString") + templateMetaDataModel.ExecutableFile = core.StringPtr("testString") + templateMetaDataModel.Buildpack = core.StringPtr("testString") + templateMetaDataModel.EnvironmentVariables = make(map[string]string) + + // Construct an instance of the UIMetaData model + uiMetaDataModel := new(globalcatalogv1.UIMetaData) + uiMetaDataModel.Strings = i18NModel + uiMetaDataModel.Urls = urlsModel + uiMetaDataModel.EmbeddableDashboard = core.StringPtr("testString") + uiMetaDataModel.EmbeddableDashboardFullWidth = core.BoolPtr(true) + uiMetaDataModel.NavigationOrder = []string{"testString"} + uiMetaDataModel.NotCreatable = core.BoolPtr(true) + uiMetaDataModel.PrimaryOfferingID = core.StringPtr("testString") + uiMetaDataModel.AccessibleDuringProvision = core.BoolPtr(true) + uiMetaDataModel.SideBySideIndex = core.Int64Ptr(int64(38)) + uiMetaDataModel.EndOfServiceTime = CreateMockDateTime() + uiMetaDataModel.Hidden = core.BoolPtr(true) + uiMetaDataModel.HideLiteMetering = core.BoolPtr(true) + uiMetaDataModel.NoUpgradeNextStep = core.BoolPtr(true) + + // Construct an instance of the Image model + imageModel := new(globalcatalogv1.Image) + imageModel.Image = core.StringPtr("testString") + imageModel.SmallImage = core.StringPtr("testString") + imageModel.MediumImage = core.StringPtr("testString") + imageModel.FeatureImage = core.StringPtr("testString") + + // Construct an instance of the ObjectMetadataSet model + objectMetadataSetModel := new(globalcatalogv1.ObjectMetadataSet) + objectMetadataSetModel.RcCompatible = core.BoolPtr(true) + objectMetadataSetModel.Service = cfMetaDataModel + objectMetadataSetModel.Plan = planMetaDataModel + objectMetadataSetModel.Alias = aliasMetaDataModel + objectMetadataSetModel.Template = templateMetaDataModel + objectMetadataSetModel.Ui = uiMetaDataModel + objectMetadataSetModel.Compliance = []string{"testString"} + objectMetadataSetModel.Sla = slaMetaDataModel + objectMetadataSetModel.Callbacks = callbacksModel + objectMetadataSetModel.OriginalName = core.StringPtr("testString") + objectMetadataSetModel.Version = core.StringPtr("testString") + objectMetadataSetModel.Other = make(map[string]interface{}) + objectMetadataSetModel.Pricing = pricingSetModel + objectMetadataSetModel.Deployment = deploymentBaseModel + + // Construct an instance of the OverviewUI model + overviewUiModel := new(globalcatalogv1.OverviewUI) + overviewUiModel.SetProperty("foo", overviewModel) + + // Construct an instance of the Provider model + providerModel := new(globalcatalogv1.Provider) + providerModel.Email = core.StringPtr("testString") + providerModel.Name = core.StringPtr("testString") + providerModel.Contact = core.StringPtr("testString") + providerModel.SupportEmail = core.StringPtr("testString") + providerModel.Phone = core.StringPtr("testString") + + // Construct an instance of the CreateCatalogEntryOptions model + createCatalogEntryOptionsModel := new(globalcatalogv1.CreateCatalogEntryOptions) + createCatalogEntryOptionsModel.Name = core.StringPtr("testString") + createCatalogEntryOptionsModel.Kind = core.StringPtr("service") + createCatalogEntryOptionsModel.OverviewUi = overviewUiModel + createCatalogEntryOptionsModel.Images = imageModel + createCatalogEntryOptionsModel.Disabled = core.BoolPtr(true) + createCatalogEntryOptionsModel.Tags = []string{"testString"} + createCatalogEntryOptionsModel.Provider = providerModel + createCatalogEntryOptionsModel.ID = core.StringPtr("testString") + createCatalogEntryOptionsModel.ParentID = core.StringPtr("testString") + createCatalogEntryOptionsModel.Group = core.BoolPtr(true) + createCatalogEntryOptionsModel.Active = core.BoolPtr(true) + createCatalogEntryOptionsModel.Metadata = objectMetadataSetModel + createCatalogEntryOptionsModel.Account = core.StringPtr("testString") + createCatalogEntryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := testService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := testService.CreateCatalogEntry(createCatalogEntryOptionsModel) + 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 CreateCatalogEntryOptions model with no property values + createCatalogEntryOptionsModelNew := new(globalcatalogv1.CreateCatalogEntryOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = testService.CreateCatalogEntry(createCatalogEntryOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetCatalogEntry(getCatalogEntryOptions *GetCatalogEntryOptions) - Operation response error`, func() { + getCatalogEntryPath := "/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.Path).To(Equal(getCatalogEntryPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["account"]).To(Equal([]string{"testString"})) + + Expect(req.URL.Query()["include"]).To(Equal([]string{"testString"})) + + Expect(req.URL.Query()["languages"]).To(Equal([]string{"testString"})) + + Expect(req.URL.Query()["complete"]).To(Equal([]string{"testString"})) + + Expect(req.URL.Query()["depth"]).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 {`) + })) + }) + It(`Invoke GetCatalogEntry with error: Operation response processing error`, func() { + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1(&globalcatalogv1.GlobalCatalogV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(testServiceErr).To(BeNil()) + Expect(testService).ToNot(BeNil()) + + // Construct an instance of the GetCatalogEntryOptions model + getCatalogEntryOptionsModel := new(globalcatalogv1.GetCatalogEntryOptions) + getCatalogEntryOptionsModel.ID = core.StringPtr("testString") + getCatalogEntryOptionsModel.Account = core.StringPtr("testString") + getCatalogEntryOptionsModel.Include = core.StringPtr("testString") + getCatalogEntryOptionsModel.Languages = core.StringPtr("testString") + getCatalogEntryOptionsModel.Complete = core.StringPtr("testString") + getCatalogEntryOptionsModel.Depth = core.Int64Ptr(int64(38)) + getCatalogEntryOptionsModel.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 := testService.GetCatalogEntry(getCatalogEntryOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + + Describe(`GetCatalogEntry(getCatalogEntryOptions *GetCatalogEntryOptions)`, func() { + getCatalogEntryPath := "/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.Path).To(Equal(getCatalogEntryPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["account"]).To(Equal([]string{"testString"})) + + Expect(req.URL.Query()["include"]).To(Equal([]string{"testString"})) + + Expect(req.URL.Query()["languages"]).To(Equal([]string{"testString"})) + + Expect(req.URL.Query()["complete"]).To(Equal([]string{"testString"})) + + Expect(req.URL.Query()["depth"]).To(Equal([]string{fmt.Sprint(int64(38))})) + + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, `{"name": "Name", "kind": "service", "overview_ui": {}, "images": {"image": "Image", "small_image": "SmallImage", "medium_image": "MediumImage", "feature_image": "FeatureImage"}, "parent_id": "ParentID", "disabled": true, "tags": ["Tags"], "group": false, "provider": {"email": "Email", "name": "Name", "contact": "Contact", "support_email": "SupportEmail", "phone": "Phone"}, "active": true, "metadata": {"rc_compatible": true, "service": {"type": "Type", "iam_compatible": false, "unique_api_key": true, "provisionable": false, "bindable": true, "async_provisioning_supported": true, "async_unprovisioning_supported": true, "requires": ["Requires"], "plan_updateable": true, "state": "State", "service_check_enabled": false, "test_check_interval": 17, "service_key_supported": false, "cf_guid": {"mapKey": "Inner"}}, "plan": {"bindable": true, "reservable": true, "allow_internal_users": true, "async_provisioning_supported": true, "async_unprovisioning_supported": true, "test_check_interval": 17, "single_scope_instance": "SingleScopeInstance", "service_check_enabled": false, "cf_guid": {"mapKey": "Inner"}}, "alias": {"type": "Type", "plan_id": "PlanID"}, "template": {"services": ["Services"], "default_memory": 13, "start_cmd": "StartCmd", "source": {"path": "Path", "type": "Type", "url": "URL"}, "runtime_catalog_id": "RuntimeCatalogID", "cf_runtime_id": "CfRuntimeID", "template_id": "TemplateID", "executable_file": "ExecutableFile", "buildpack": "Buildpack", "environment_variables": {"mapKey": "Inner"}}, "ui": {"strings": {}, "urls": {"doc_url": "DocURL", "instructions_url": "InstructionsURL", "api_url": "ApiURL", "create_url": "CreateURL", "sdk_download_url": "SdkDownloadURL", "terms_url": "TermsURL", "custom_create_page_url": "CustomCreatePageURL", "catalog_details_url": "CatalogDetailsURL", "deprecation_doc_url": "DeprecationDocURL", "dashboard_url": "DashboardURL", "registration_url": "RegistrationURL", "apidocsurl": "Apidocsurl"}, "embeddable_dashboard": "EmbeddableDashboard", "embeddable_dashboard_full_width": true, "navigation_order": ["NavigationOrder"], "not_creatable": true, "primary_offering_id": "PrimaryOfferingID", "accessible_during_provision": false, "side_by_side_index": 15, "end_of_service_time": "2019-01-01T12:00:00", "hidden": true, "hide_lite_metering": true, "no_upgrade_next_step": false}, "compliance": ["Compliance"], "sla": {"terms": "Terms", "tenancy": "Tenancy", "provisioning": "Provisioning", "responsiveness": "Responsiveness", "dr": {"dr": true, "description": "Description"}}, "callbacks": {"controller_url": "ControllerURL", "broker_url": "BrokerURL", "broker_proxy_url": "BrokerProxyURL", "dashboard_url": "DashboardURL", "dashboard_data_url": "DashboardDataURL", "dashboard_detail_tab_url": "DashboardDetailTabURL", "dashboard_detail_tab_ext_url": "DashboardDetailTabExtURL", "service_monitor_api": "ServiceMonitorApi", "service_monitor_app": "ServiceMonitorApp", "api_endpoint": {"mapKey": "Inner"}}, "original_name": "OriginalName", "version": "Version", "other": {"mapKey": {"anyKey": "anyValue"}}, "pricing": {"type": "Type", "origin": "Origin", "starting_price": {"plan_id": "PlanID", "deployment_id": "DeploymentID", "unit": "Unit", "amount": [{"country": "Country", "currency": "Currency", "prices": [{"quantity_tier": 12, "Price": 5}]}]}, "metrics": [{"part_ref": "PartRef", "metric_id": "MetricID", "tier_model": "TierModel", "charge_unit": "ChargeUnit", "charge_unit_name": "ChargeUnitName", "charge_unit_quantity": "ChargeUnitQuantity", "resource_display_name": "ResourceDisplayName", "charge_unit_display_name": "ChargeUnitDisplayName", "usage_cap_qty": 11, "display_cap": 10, "effective_from": "2019-01-01T12:00:00", "effective_until": "2019-01-01T12:00:00", "amounts": [{"country": "Country", "currency": "Currency", "prices": [{"quantity_tier": 12, "Price": 5}]}]}]}, "deployment": {"location": "Location", "location_url": "LocationURL", "original_location": "OriginalLocation", "target_crn": "TargetCrn", "service_crn": "ServiceCrn", "mccp_id": "MccpID", "broker": {"name": "Name", "guid": "Guid"}, "supports_rc_migration": false, "target_network": "TargetNetwork"}}, "id": "ID", "catalog_crn": "anyValue", "url": "anyValue", "children_url": "anyValue", "geo_tags": "anyValue", "pricing_tags": "anyValue", "created": "anyValue", "updated": "anyValue"}`) + })) + }) + It(`Invoke GetCatalogEntry successfully`, func() { + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1(&globalcatalogv1.GlobalCatalogV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(testServiceErr).To(BeNil()) + Expect(testService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := testService.GetCatalogEntry(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetCatalogEntryOptions model + getCatalogEntryOptionsModel := new(globalcatalogv1.GetCatalogEntryOptions) + getCatalogEntryOptionsModel.ID = core.StringPtr("testString") + getCatalogEntryOptionsModel.Account = core.StringPtr("testString") + getCatalogEntryOptionsModel.Include = core.StringPtr("testString") + getCatalogEntryOptionsModel.Languages = core.StringPtr("testString") + getCatalogEntryOptionsModel.Complete = core.StringPtr("testString") + getCatalogEntryOptionsModel.Depth = core.Int64Ptr(int64(38)) + getCatalogEntryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = testService.GetCatalogEntry(getCatalogEntryOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + }) + It(`Invoke GetCatalogEntry with error: Operation validation and request error`, func() { + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1(&globalcatalogv1.GlobalCatalogV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(testServiceErr).To(BeNil()) + Expect(testService).ToNot(BeNil()) + + // Construct an instance of the GetCatalogEntryOptions model + getCatalogEntryOptionsModel := new(globalcatalogv1.GetCatalogEntryOptions) + getCatalogEntryOptionsModel.ID = core.StringPtr("testString") + getCatalogEntryOptionsModel.Account = core.StringPtr("testString") + getCatalogEntryOptionsModel.Include = core.StringPtr("testString") + getCatalogEntryOptionsModel.Languages = core.StringPtr("testString") + getCatalogEntryOptionsModel.Complete = core.StringPtr("testString") + getCatalogEntryOptionsModel.Depth = core.Int64Ptr(int64(38)) + getCatalogEntryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := testService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := testService.GetCatalogEntry(getCatalogEntryOptionsModel) + 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 GetCatalogEntryOptions model with no property values + getCatalogEntryOptionsModelNew := new(globalcatalogv1.GetCatalogEntryOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = testService.GetCatalogEntry(getCatalogEntryOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateCatalogEntry(updateCatalogEntryOptions *UpdateCatalogEntryOptions) - Operation response error`, func() { + updateCatalogEntryPath := "/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.Path).To(Equal(updateCatalogEntryPath)) + Expect(req.Method).To(Equal("PUT")) + Expect(req.URL.Query()["account"]).To(Equal([]string{"testString"})) + + Expect(req.URL.Query()["move"]).To(Equal([]string{"testString"})) + + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, `} this is not valid json {`) + })) + }) + It(`Invoke UpdateCatalogEntry with error: Operation response processing error`, func() { + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1(&globalcatalogv1.GlobalCatalogV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(testServiceErr).To(BeNil()) + Expect(testService).ToNot(BeNil()) + + // Construct an instance of the Bullets model + bulletsModel := new(globalcatalogv1.Bullets) + bulletsModel.Title = core.StringPtr("testString") + bulletsModel.Description = core.StringPtr("testString") + bulletsModel.Icon = core.StringPtr("testString") + bulletsModel.Quantity = core.Int64Ptr(int64(38)) + + // Construct an instance of the Price model + priceModel := new(globalcatalogv1.Price) + priceModel.QuantityTier = core.Int64Ptr(int64(38)) + priceModel.Price = core.Float64Ptr(72.5) + + // Construct an instance of the UIMetaMedia model + uiMetaMediaModel := new(globalcatalogv1.UIMetaMedia) + uiMetaMediaModel.Caption = core.StringPtr("testString") + uiMetaMediaModel.ThumbnailURL = core.StringPtr("testString") + uiMetaMediaModel.Type = core.StringPtr("testString") + uiMetaMediaModel.URL = core.StringPtr("testString") + uiMetaMediaModel.Source = bulletsModel + + // Construct an instance of the Amount model + amountModel := new(globalcatalogv1.Amount) + amountModel.Country = core.StringPtr("testString") + amountModel.Currency = core.StringPtr("testString") + amountModel.Prices = []globalcatalogv1.Price{*priceModel} + + // Construct an instance of the Strings model + stringsModel := new(globalcatalogv1.Strings) + stringsModel.Bullets = []globalcatalogv1.Bullets{*bulletsModel} + stringsModel.Media = []globalcatalogv1.UIMetaMedia{*uiMetaMediaModel} + stringsModel.NotCreatableMsg = core.StringPtr("testString") + stringsModel.NotCreatableRobotMsg = core.StringPtr("testString") + stringsModel.DeprecationWarning = core.StringPtr("testString") + stringsModel.PopupWarningMessage = core.StringPtr("testString") + stringsModel.Instruction = core.StringPtr("testString") + + // Construct an instance of the Broker model + brokerModel := new(globalcatalogv1.Broker) + brokerModel.Name = core.StringPtr("testString") + brokerModel.Guid = core.StringPtr("testString") + + // Construct an instance of the DRMetaData model + drMetaDataModel := new(globalcatalogv1.DRMetaData) + drMetaDataModel.Dr = core.BoolPtr(true) + drMetaDataModel.Description = core.StringPtr("testString") + + // Construct an instance of the I18N model + i18NModel := new(globalcatalogv1.I18N) + i18NModel.SetProperty("foo", stringsModel) + + // Construct an instance of the SourceMetaData model + sourceMetaDataModel := new(globalcatalogv1.SourceMetaData) + sourceMetaDataModel.Path = core.StringPtr("testString") + sourceMetaDataModel.Type = core.StringPtr("testString") + sourceMetaDataModel.URL = core.StringPtr("testString") + + // Construct an instance of the StartingPrice model + startingPriceModel := new(globalcatalogv1.StartingPrice) + startingPriceModel.PlanID = core.StringPtr("testString") + startingPriceModel.DeploymentID = core.StringPtr("testString") + startingPriceModel.Unit = core.StringPtr("testString") + startingPriceModel.Amount = []globalcatalogv1.Amount{*amountModel} + + // Construct an instance of the URLS model + urlsModel := new(globalcatalogv1.URLS) + urlsModel.DocURL = core.StringPtr("testString") + urlsModel.InstructionsURL = core.StringPtr("testString") + urlsModel.ApiURL = core.StringPtr("testString") + urlsModel.CreateURL = core.StringPtr("testString") + urlsModel.SdkDownloadURL = core.StringPtr("testString") + urlsModel.TermsURL = core.StringPtr("testString") + urlsModel.CustomCreatePageURL = core.StringPtr("testString") + urlsModel.CatalogDetailsURL = core.StringPtr("testString") + urlsModel.DeprecationDocURL = core.StringPtr("testString") + urlsModel.DashboardURL = core.StringPtr("testString") + urlsModel.RegistrationURL = core.StringPtr("testString") + urlsModel.Apidocsurl = core.StringPtr("testString") + + // Construct an instance of the AliasMetaData model + aliasMetaDataModel := new(globalcatalogv1.AliasMetaData) + aliasMetaDataModel.Type = core.StringPtr("testString") + aliasMetaDataModel.PlanID = core.StringPtr("testString") + + // Construct an instance of the CFMetaData model + cfMetaDataModel := new(globalcatalogv1.CFMetaData) + cfMetaDataModel.Type = core.StringPtr("testString") + cfMetaDataModel.IamCompatible = core.BoolPtr(true) + cfMetaDataModel.UniqueApiKey = core.BoolPtr(true) + cfMetaDataModel.Provisionable = core.BoolPtr(true) + cfMetaDataModel.Bindable = core.BoolPtr(true) + cfMetaDataModel.AsyncProvisioningSupported = core.BoolPtr(true) + cfMetaDataModel.AsyncUnprovisioningSupported = core.BoolPtr(true) + cfMetaDataModel.Requires = []string{"testString"} + cfMetaDataModel.PlanUpdateable = core.BoolPtr(true) + cfMetaDataModel.State = core.StringPtr("testString") + cfMetaDataModel.ServiceCheckEnabled = core.BoolPtr(true) + cfMetaDataModel.TestCheckInterval = core.Int64Ptr(int64(38)) + cfMetaDataModel.ServiceKeySupported = core.BoolPtr(true) + cfMetaDataModel.CfGuid = make(map[string]string) + + // Construct an instance of the Callbacks model + callbacksModel := new(globalcatalogv1.Callbacks) + callbacksModel.ControllerURL = core.StringPtr("testString") + callbacksModel.BrokerURL = core.StringPtr("testString") + callbacksModel.BrokerProxyURL = core.StringPtr("testString") + callbacksModel.DashboardURL = core.StringPtr("testString") + callbacksModel.DashboardDataURL = core.StringPtr("testString") + callbacksModel.DashboardDetailTabURL = core.StringPtr("testString") + callbacksModel.DashboardDetailTabExtURL = core.StringPtr("testString") + callbacksModel.ServiceMonitorApi = core.StringPtr("testString") + callbacksModel.ServiceMonitorApp = core.StringPtr("testString") + callbacksModel.ApiEndpoint = make(map[string]string) + + // Construct an instance of the DeploymentBase model + deploymentBaseModel := new(globalcatalogv1.DeploymentBase) + deploymentBaseModel.Location = core.StringPtr("testString") + deploymentBaseModel.LocationURL = core.StringPtr("testString") + deploymentBaseModel.OriginalLocation = core.StringPtr("testString") + deploymentBaseModel.TargetCrn = core.StringPtr("testString") + deploymentBaseModel.ServiceCrn = core.StringPtr("testString") + deploymentBaseModel.MccpID = core.StringPtr("testString") + deploymentBaseModel.Broker = brokerModel + deploymentBaseModel.SupportsRcMigration = core.BoolPtr(true) + deploymentBaseModel.TargetNetwork = core.StringPtr("testString") + + // Construct an instance of the Overview model + overviewModel := new(globalcatalogv1.Overview) + overviewModel.DisplayName = core.StringPtr("testString") + overviewModel.LongDescription = core.StringPtr("testString") + overviewModel.Description = core.StringPtr("testString") + overviewModel.FeaturedDescription = core.StringPtr("testString") + + // Construct an instance of the PlanMetaData model + planMetaDataModel := new(globalcatalogv1.PlanMetaData) + planMetaDataModel.Bindable = core.BoolPtr(true) + planMetaDataModel.Reservable = core.BoolPtr(true) + planMetaDataModel.AllowInternalUsers = core.BoolPtr(true) + planMetaDataModel.AsyncProvisioningSupported = core.BoolPtr(true) + planMetaDataModel.AsyncUnprovisioningSupported = core.BoolPtr(true) + planMetaDataModel.TestCheckInterval = core.Int64Ptr(int64(38)) + planMetaDataModel.SingleScopeInstance = core.StringPtr("testString") + planMetaDataModel.ServiceCheckEnabled = core.BoolPtr(true) + planMetaDataModel.CfGuid = make(map[string]string) + + // Construct an instance of the PricingSet model + pricingSetModel := new(globalcatalogv1.PricingSet) + pricingSetModel.Type = core.StringPtr("testString") + pricingSetModel.Origin = core.StringPtr("testString") + pricingSetModel.StartingPrice = startingPriceModel + + // Construct an instance of the SLAMetaData model + slaMetaDataModel := new(globalcatalogv1.SLAMetaData) + slaMetaDataModel.Terms = core.StringPtr("testString") + slaMetaDataModel.Tenancy = core.StringPtr("testString") + slaMetaDataModel.Provisioning = core.StringPtr("testString") + slaMetaDataModel.Responsiveness = core.StringPtr("testString") + slaMetaDataModel.Dr = drMetaDataModel + + // Construct an instance of the TemplateMetaData model + templateMetaDataModel := new(globalcatalogv1.TemplateMetaData) + templateMetaDataModel.Services = []string{"testString"} + templateMetaDataModel.DefaultMemory = core.Int64Ptr(int64(38)) + templateMetaDataModel.StartCmd = core.StringPtr("testString") + templateMetaDataModel.Source = sourceMetaDataModel + templateMetaDataModel.RuntimeCatalogID = core.StringPtr("testString") + templateMetaDataModel.CfRuntimeID = core.StringPtr("testString") + templateMetaDataModel.TemplateID = core.StringPtr("testString") + templateMetaDataModel.ExecutableFile = core.StringPtr("testString") + templateMetaDataModel.Buildpack = core.StringPtr("testString") + templateMetaDataModel.EnvironmentVariables = make(map[string]string) + + // Construct an instance of the UIMetaData model + uiMetaDataModel := new(globalcatalogv1.UIMetaData) + uiMetaDataModel.Strings = i18NModel + uiMetaDataModel.Urls = urlsModel + uiMetaDataModel.EmbeddableDashboard = core.StringPtr("testString") + uiMetaDataModel.EmbeddableDashboardFullWidth = core.BoolPtr(true) + uiMetaDataModel.NavigationOrder = []string{"testString"} + uiMetaDataModel.NotCreatable = core.BoolPtr(true) + uiMetaDataModel.PrimaryOfferingID = core.StringPtr("testString") + uiMetaDataModel.AccessibleDuringProvision = core.BoolPtr(true) + uiMetaDataModel.SideBySideIndex = core.Int64Ptr(int64(38)) + uiMetaDataModel.EndOfServiceTime = CreateMockDateTime() + uiMetaDataModel.Hidden = core.BoolPtr(true) + uiMetaDataModel.HideLiteMetering = core.BoolPtr(true) + uiMetaDataModel.NoUpgradeNextStep = core.BoolPtr(true) + + // Construct an instance of the Image model + imageModel := new(globalcatalogv1.Image) + imageModel.Image = core.StringPtr("testString") + imageModel.SmallImage = core.StringPtr("testString") + imageModel.MediumImage = core.StringPtr("testString") + imageModel.FeatureImage = core.StringPtr("testString") + + // Construct an instance of the ObjectMetadataSet model + objectMetadataSetModel := new(globalcatalogv1.ObjectMetadataSet) + objectMetadataSetModel.RcCompatible = core.BoolPtr(true) + objectMetadataSetModel.Service = cfMetaDataModel + objectMetadataSetModel.Plan = planMetaDataModel + objectMetadataSetModel.Alias = aliasMetaDataModel + objectMetadataSetModel.Template = templateMetaDataModel + objectMetadataSetModel.Ui = uiMetaDataModel + objectMetadataSetModel.Compliance = []string{"testString"} + objectMetadataSetModel.Sla = slaMetaDataModel + objectMetadataSetModel.Callbacks = callbacksModel + objectMetadataSetModel.OriginalName = core.StringPtr("testString") + objectMetadataSetModel.Version = core.StringPtr("testString") + objectMetadataSetModel.Other = make(map[string]interface{}) + objectMetadataSetModel.Pricing = pricingSetModel + objectMetadataSetModel.Deployment = deploymentBaseModel + + // Construct an instance of the OverviewUI model + overviewUiModel := new(globalcatalogv1.OverviewUI) + overviewUiModel.SetProperty("foo", overviewModel) + + // Construct an instance of the Provider model + providerModel := new(globalcatalogv1.Provider) + providerModel.Email = core.StringPtr("testString") + providerModel.Name = core.StringPtr("testString") + providerModel.Contact = core.StringPtr("testString") + providerModel.SupportEmail = core.StringPtr("testString") + providerModel.Phone = core.StringPtr("testString") + + // Construct an instance of the UpdateCatalogEntryOptions model + updateCatalogEntryOptionsModel := new(globalcatalogv1.UpdateCatalogEntryOptions) + updateCatalogEntryOptionsModel.ID = core.StringPtr("testString") + updateCatalogEntryOptionsModel.Name = core.StringPtr("testString") + updateCatalogEntryOptionsModel.Kind = core.StringPtr("service") + updateCatalogEntryOptionsModel.OverviewUi = overviewUiModel + updateCatalogEntryOptionsModel.Images = imageModel + updateCatalogEntryOptionsModel.Disabled = core.BoolPtr(true) + updateCatalogEntryOptionsModel.Tags = []string{"testString"} + updateCatalogEntryOptionsModel.Provider = providerModel + updateCatalogEntryOptionsModel.ParentID = core.StringPtr("testString") + updateCatalogEntryOptionsModel.Group = core.BoolPtr(true) + updateCatalogEntryOptionsModel.Active = core.BoolPtr(true) + updateCatalogEntryOptionsModel.Metadata = objectMetadataSetModel + updateCatalogEntryOptionsModel.Account = core.StringPtr("testString") + updateCatalogEntryOptionsModel.Move = core.StringPtr("testString") + updateCatalogEntryOptionsModel.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 := testService.UpdateCatalogEntry(updateCatalogEntryOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + + Describe(`UpdateCatalogEntry(updateCatalogEntryOptions *UpdateCatalogEntryOptions)`, func() { + updateCatalogEntryPath := "/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.Path).To(Equal(updateCatalogEntryPath)) + Expect(req.Method).To(Equal("PUT")) + Expect(req.URL.Query()["account"]).To(Equal([]string{"testString"})) + + Expect(req.URL.Query()["move"]).To(Equal([]string{"testString"})) + + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, `{"name": "Name", "kind": "service", "overview_ui": {}, "images": {"image": "Image", "small_image": "SmallImage", "medium_image": "MediumImage", "feature_image": "FeatureImage"}, "parent_id": "ParentID", "disabled": true, "tags": ["Tags"], "group": false, "provider": {"email": "Email", "name": "Name", "contact": "Contact", "support_email": "SupportEmail", "phone": "Phone"}, "active": true, "metadata": {"rc_compatible": true, "service": {"type": "Type", "iam_compatible": false, "unique_api_key": true, "provisionable": false, "bindable": true, "async_provisioning_supported": true, "async_unprovisioning_supported": true, "requires": ["Requires"], "plan_updateable": true, "state": "State", "service_check_enabled": false, "test_check_interval": 17, "service_key_supported": false, "cf_guid": {"mapKey": "Inner"}}, "plan": {"bindable": true, "reservable": true, "allow_internal_users": true, "async_provisioning_supported": true, "async_unprovisioning_supported": true, "test_check_interval": 17, "single_scope_instance": "SingleScopeInstance", "service_check_enabled": false, "cf_guid": {"mapKey": "Inner"}}, "alias": {"type": "Type", "plan_id": "PlanID"}, "template": {"services": ["Services"], "default_memory": 13, "start_cmd": "StartCmd", "source": {"path": "Path", "type": "Type", "url": "URL"}, "runtime_catalog_id": "RuntimeCatalogID", "cf_runtime_id": "CfRuntimeID", "template_id": "TemplateID", "executable_file": "ExecutableFile", "buildpack": "Buildpack", "environment_variables": {"mapKey": "Inner"}}, "ui": {"strings": {}, "urls": {"doc_url": "DocURL", "instructions_url": "InstructionsURL", "api_url": "ApiURL", "create_url": "CreateURL", "sdk_download_url": "SdkDownloadURL", "terms_url": "TermsURL", "custom_create_page_url": "CustomCreatePageURL", "catalog_details_url": "CatalogDetailsURL", "deprecation_doc_url": "DeprecationDocURL", "dashboard_url": "DashboardURL", "registration_url": "RegistrationURL", "apidocsurl": "Apidocsurl"}, "embeddable_dashboard": "EmbeddableDashboard", "embeddable_dashboard_full_width": true, "navigation_order": ["NavigationOrder"], "not_creatable": true, "primary_offering_id": "PrimaryOfferingID", "accessible_during_provision": false, "side_by_side_index": 15, "end_of_service_time": "2019-01-01T12:00:00", "hidden": true, "hide_lite_metering": true, "no_upgrade_next_step": false}, "compliance": ["Compliance"], "sla": {"terms": "Terms", "tenancy": "Tenancy", "provisioning": "Provisioning", "responsiveness": "Responsiveness", "dr": {"dr": true, "description": "Description"}}, "callbacks": {"controller_url": "ControllerURL", "broker_url": "BrokerURL", "broker_proxy_url": "BrokerProxyURL", "dashboard_url": "DashboardURL", "dashboard_data_url": "DashboardDataURL", "dashboard_detail_tab_url": "DashboardDetailTabURL", "dashboard_detail_tab_ext_url": "DashboardDetailTabExtURL", "service_monitor_api": "ServiceMonitorApi", "service_monitor_app": "ServiceMonitorApp", "api_endpoint": {"mapKey": "Inner"}}, "original_name": "OriginalName", "version": "Version", "other": {"mapKey": {"anyKey": "anyValue"}}, "pricing": {"type": "Type", "origin": "Origin", "starting_price": {"plan_id": "PlanID", "deployment_id": "DeploymentID", "unit": "Unit", "amount": [{"country": "Country", "currency": "Currency", "prices": [{"quantity_tier": 12, "Price": 5}]}]}, "metrics": [{"part_ref": "PartRef", "metric_id": "MetricID", "tier_model": "TierModel", "charge_unit": "ChargeUnit", "charge_unit_name": "ChargeUnitName", "charge_unit_quantity": "ChargeUnitQuantity", "resource_display_name": "ResourceDisplayName", "charge_unit_display_name": "ChargeUnitDisplayName", "usage_cap_qty": 11, "display_cap": 10, "effective_from": "2019-01-01T12:00:00", "effective_until": "2019-01-01T12:00:00", "amounts": [{"country": "Country", "currency": "Currency", "prices": [{"quantity_tier": 12, "Price": 5}]}]}]}, "deployment": {"location": "Location", "location_url": "LocationURL", "original_location": "OriginalLocation", "target_crn": "TargetCrn", "service_crn": "ServiceCrn", "mccp_id": "MccpID", "broker": {"name": "Name", "guid": "Guid"}, "supports_rc_migration": false, "target_network": "TargetNetwork"}}, "id": "ID", "catalog_crn": "anyValue", "url": "anyValue", "children_url": "anyValue", "geo_tags": "anyValue", "pricing_tags": "anyValue", "created": "anyValue", "updated": "anyValue"}`) + })) + }) + It(`Invoke UpdateCatalogEntry successfully`, func() { + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1(&globalcatalogv1.GlobalCatalogV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(testServiceErr).To(BeNil()) + Expect(testService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := testService.UpdateCatalogEntry(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the Bullets model + bulletsModel := new(globalcatalogv1.Bullets) + bulletsModel.Title = core.StringPtr("testString") + bulletsModel.Description = core.StringPtr("testString") + bulletsModel.Icon = core.StringPtr("testString") + bulletsModel.Quantity = core.Int64Ptr(int64(38)) + + // Construct an instance of the Price model + priceModel := new(globalcatalogv1.Price) + priceModel.QuantityTier = core.Int64Ptr(int64(38)) + priceModel.Price = core.Float64Ptr(72.5) + + // Construct an instance of the UIMetaMedia model + uiMetaMediaModel := new(globalcatalogv1.UIMetaMedia) + uiMetaMediaModel.Caption = core.StringPtr("testString") + uiMetaMediaModel.ThumbnailURL = core.StringPtr("testString") + uiMetaMediaModel.Type = core.StringPtr("testString") + uiMetaMediaModel.URL = core.StringPtr("testString") + uiMetaMediaModel.Source = bulletsModel + + // Construct an instance of the Amount model + amountModel := new(globalcatalogv1.Amount) + amountModel.Country = core.StringPtr("testString") + amountModel.Currency = core.StringPtr("testString") + amountModel.Prices = []globalcatalogv1.Price{*priceModel} + + // Construct an instance of the Strings model + stringsModel := new(globalcatalogv1.Strings) + stringsModel.Bullets = []globalcatalogv1.Bullets{*bulletsModel} + stringsModel.Media = []globalcatalogv1.UIMetaMedia{*uiMetaMediaModel} + stringsModel.NotCreatableMsg = core.StringPtr("testString") + stringsModel.NotCreatableRobotMsg = core.StringPtr("testString") + stringsModel.DeprecationWarning = core.StringPtr("testString") + stringsModel.PopupWarningMessage = core.StringPtr("testString") + stringsModel.Instruction = core.StringPtr("testString") + + // Construct an instance of the Broker model + brokerModel := new(globalcatalogv1.Broker) + brokerModel.Name = core.StringPtr("testString") + brokerModel.Guid = core.StringPtr("testString") + + // Construct an instance of the DRMetaData model + drMetaDataModel := new(globalcatalogv1.DRMetaData) + drMetaDataModel.Dr = core.BoolPtr(true) + drMetaDataModel.Description = core.StringPtr("testString") + + // Construct an instance of the I18N model + i18NModel := new(globalcatalogv1.I18N) + i18NModel.SetProperty("foo", stringsModel) + + // Construct an instance of the SourceMetaData model + sourceMetaDataModel := new(globalcatalogv1.SourceMetaData) + sourceMetaDataModel.Path = core.StringPtr("testString") + sourceMetaDataModel.Type = core.StringPtr("testString") + sourceMetaDataModel.URL = core.StringPtr("testString") + + // Construct an instance of the StartingPrice model + startingPriceModel := new(globalcatalogv1.StartingPrice) + startingPriceModel.PlanID = core.StringPtr("testString") + startingPriceModel.DeploymentID = core.StringPtr("testString") + startingPriceModel.Unit = core.StringPtr("testString") + startingPriceModel.Amount = []globalcatalogv1.Amount{*amountModel} + + // Construct an instance of the URLS model + urlsModel := new(globalcatalogv1.URLS) + urlsModel.DocURL = core.StringPtr("testString") + urlsModel.InstructionsURL = core.StringPtr("testString") + urlsModel.ApiURL = core.StringPtr("testString") + urlsModel.CreateURL = core.StringPtr("testString") + urlsModel.SdkDownloadURL = core.StringPtr("testString") + urlsModel.TermsURL = core.StringPtr("testString") + urlsModel.CustomCreatePageURL = core.StringPtr("testString") + urlsModel.CatalogDetailsURL = core.StringPtr("testString") + urlsModel.DeprecationDocURL = core.StringPtr("testString") + urlsModel.DashboardURL = core.StringPtr("testString") + urlsModel.RegistrationURL = core.StringPtr("testString") + urlsModel.Apidocsurl = core.StringPtr("testString") + + // Construct an instance of the AliasMetaData model + aliasMetaDataModel := new(globalcatalogv1.AliasMetaData) + aliasMetaDataModel.Type = core.StringPtr("testString") + aliasMetaDataModel.PlanID = core.StringPtr("testString") + + // Construct an instance of the CFMetaData model + cfMetaDataModel := new(globalcatalogv1.CFMetaData) + cfMetaDataModel.Type = core.StringPtr("testString") + cfMetaDataModel.IamCompatible = core.BoolPtr(true) + cfMetaDataModel.UniqueApiKey = core.BoolPtr(true) + cfMetaDataModel.Provisionable = core.BoolPtr(true) + cfMetaDataModel.Bindable = core.BoolPtr(true) + cfMetaDataModel.AsyncProvisioningSupported = core.BoolPtr(true) + cfMetaDataModel.AsyncUnprovisioningSupported = core.BoolPtr(true) + cfMetaDataModel.Requires = []string{"testString"} + cfMetaDataModel.PlanUpdateable = core.BoolPtr(true) + cfMetaDataModel.State = core.StringPtr("testString") + cfMetaDataModel.ServiceCheckEnabled = core.BoolPtr(true) + cfMetaDataModel.TestCheckInterval = core.Int64Ptr(int64(38)) + cfMetaDataModel.ServiceKeySupported = core.BoolPtr(true) + cfMetaDataModel.CfGuid = make(map[string]string) + + // Construct an instance of the Callbacks model + callbacksModel := new(globalcatalogv1.Callbacks) + callbacksModel.ControllerURL = core.StringPtr("testString") + callbacksModel.BrokerURL = core.StringPtr("testString") + callbacksModel.BrokerProxyURL = core.StringPtr("testString") + callbacksModel.DashboardURL = core.StringPtr("testString") + callbacksModel.DashboardDataURL = core.StringPtr("testString") + callbacksModel.DashboardDetailTabURL = core.StringPtr("testString") + callbacksModel.DashboardDetailTabExtURL = core.StringPtr("testString") + callbacksModel.ServiceMonitorApi = core.StringPtr("testString") + callbacksModel.ServiceMonitorApp = core.StringPtr("testString") + callbacksModel.ApiEndpoint = make(map[string]string) + + // Construct an instance of the DeploymentBase model + deploymentBaseModel := new(globalcatalogv1.DeploymentBase) + deploymentBaseModel.Location = core.StringPtr("testString") + deploymentBaseModel.LocationURL = core.StringPtr("testString") + deploymentBaseModel.OriginalLocation = core.StringPtr("testString") + deploymentBaseModel.TargetCrn = core.StringPtr("testString") + deploymentBaseModel.ServiceCrn = core.StringPtr("testString") + deploymentBaseModel.MccpID = core.StringPtr("testString") + deploymentBaseModel.Broker = brokerModel + deploymentBaseModel.SupportsRcMigration = core.BoolPtr(true) + deploymentBaseModel.TargetNetwork = core.StringPtr("testString") + + // Construct an instance of the Overview model + overviewModel := new(globalcatalogv1.Overview) + overviewModel.DisplayName = core.StringPtr("testString") + overviewModel.LongDescription = core.StringPtr("testString") + overviewModel.Description = core.StringPtr("testString") + overviewModel.FeaturedDescription = core.StringPtr("testString") + + // Construct an instance of the PlanMetaData model + planMetaDataModel := new(globalcatalogv1.PlanMetaData) + planMetaDataModel.Bindable = core.BoolPtr(true) + planMetaDataModel.Reservable = core.BoolPtr(true) + planMetaDataModel.AllowInternalUsers = core.BoolPtr(true) + planMetaDataModel.AsyncProvisioningSupported = core.BoolPtr(true) + planMetaDataModel.AsyncUnprovisioningSupported = core.BoolPtr(true) + planMetaDataModel.TestCheckInterval = core.Int64Ptr(int64(38)) + planMetaDataModel.SingleScopeInstance = core.StringPtr("testString") + planMetaDataModel.ServiceCheckEnabled = core.BoolPtr(true) + planMetaDataModel.CfGuid = make(map[string]string) + + // Construct an instance of the PricingSet model + pricingSetModel := new(globalcatalogv1.PricingSet) + pricingSetModel.Type = core.StringPtr("testString") + pricingSetModel.Origin = core.StringPtr("testString") + pricingSetModel.StartingPrice = startingPriceModel + + // Construct an instance of the SLAMetaData model + slaMetaDataModel := new(globalcatalogv1.SLAMetaData) + slaMetaDataModel.Terms = core.StringPtr("testString") + slaMetaDataModel.Tenancy = core.StringPtr("testString") + slaMetaDataModel.Provisioning = core.StringPtr("testString") + slaMetaDataModel.Responsiveness = core.StringPtr("testString") + slaMetaDataModel.Dr = drMetaDataModel + + // Construct an instance of the TemplateMetaData model + templateMetaDataModel := new(globalcatalogv1.TemplateMetaData) + templateMetaDataModel.Services = []string{"testString"} + templateMetaDataModel.DefaultMemory = core.Int64Ptr(int64(38)) + templateMetaDataModel.StartCmd = core.StringPtr("testString") + templateMetaDataModel.Source = sourceMetaDataModel + templateMetaDataModel.RuntimeCatalogID = core.StringPtr("testString") + templateMetaDataModel.CfRuntimeID = core.StringPtr("testString") + templateMetaDataModel.TemplateID = core.StringPtr("testString") + templateMetaDataModel.ExecutableFile = core.StringPtr("testString") + templateMetaDataModel.Buildpack = core.StringPtr("testString") + templateMetaDataModel.EnvironmentVariables = make(map[string]string) + + // Construct an instance of the UIMetaData model + uiMetaDataModel := new(globalcatalogv1.UIMetaData) + uiMetaDataModel.Strings = i18NModel + uiMetaDataModel.Urls = urlsModel + uiMetaDataModel.EmbeddableDashboard = core.StringPtr("testString") + uiMetaDataModel.EmbeddableDashboardFullWidth = core.BoolPtr(true) + uiMetaDataModel.NavigationOrder = []string{"testString"} + uiMetaDataModel.NotCreatable = core.BoolPtr(true) + uiMetaDataModel.PrimaryOfferingID = core.StringPtr("testString") + uiMetaDataModel.AccessibleDuringProvision = core.BoolPtr(true) + uiMetaDataModel.SideBySideIndex = core.Int64Ptr(int64(38)) + uiMetaDataModel.EndOfServiceTime = CreateMockDateTime() + uiMetaDataModel.Hidden = core.BoolPtr(true) + uiMetaDataModel.HideLiteMetering = core.BoolPtr(true) + uiMetaDataModel.NoUpgradeNextStep = core.BoolPtr(true) + + // Construct an instance of the Image model + imageModel := new(globalcatalogv1.Image) + imageModel.Image = core.StringPtr("testString") + imageModel.SmallImage = core.StringPtr("testString") + imageModel.MediumImage = core.StringPtr("testString") + imageModel.FeatureImage = core.StringPtr("testString") + + // Construct an instance of the ObjectMetadataSet model + objectMetadataSetModel := new(globalcatalogv1.ObjectMetadataSet) + objectMetadataSetModel.RcCompatible = core.BoolPtr(true) + objectMetadataSetModel.Service = cfMetaDataModel + objectMetadataSetModel.Plan = planMetaDataModel + objectMetadataSetModel.Alias = aliasMetaDataModel + objectMetadataSetModel.Template = templateMetaDataModel + objectMetadataSetModel.Ui = uiMetaDataModel + objectMetadataSetModel.Compliance = []string{"testString"} + objectMetadataSetModel.Sla = slaMetaDataModel + objectMetadataSetModel.Callbacks = callbacksModel + objectMetadataSetModel.OriginalName = core.StringPtr("testString") + objectMetadataSetModel.Version = core.StringPtr("testString") + objectMetadataSetModel.Other = make(map[string]interface{}) + objectMetadataSetModel.Pricing = pricingSetModel + objectMetadataSetModel.Deployment = deploymentBaseModel + + // Construct an instance of the OverviewUI model + overviewUiModel := new(globalcatalogv1.OverviewUI) + overviewUiModel.SetProperty("foo", overviewModel) + + // Construct an instance of the Provider model + providerModel := new(globalcatalogv1.Provider) + providerModel.Email = core.StringPtr("testString") + providerModel.Name = core.StringPtr("testString") + providerModel.Contact = core.StringPtr("testString") + providerModel.SupportEmail = core.StringPtr("testString") + providerModel.Phone = core.StringPtr("testString") + + // Construct an instance of the UpdateCatalogEntryOptions model + updateCatalogEntryOptionsModel := new(globalcatalogv1.UpdateCatalogEntryOptions) + updateCatalogEntryOptionsModel.ID = core.StringPtr("testString") + updateCatalogEntryOptionsModel.Name = core.StringPtr("testString") + updateCatalogEntryOptionsModel.Kind = core.StringPtr("service") + updateCatalogEntryOptionsModel.OverviewUi = overviewUiModel + updateCatalogEntryOptionsModel.Images = imageModel + updateCatalogEntryOptionsModel.Disabled = core.BoolPtr(true) + updateCatalogEntryOptionsModel.Tags = []string{"testString"} + updateCatalogEntryOptionsModel.Provider = providerModel + updateCatalogEntryOptionsModel.ParentID = core.StringPtr("testString") + updateCatalogEntryOptionsModel.Group = core.BoolPtr(true) + updateCatalogEntryOptionsModel.Active = core.BoolPtr(true) + updateCatalogEntryOptionsModel.Metadata = objectMetadataSetModel + updateCatalogEntryOptionsModel.Account = core.StringPtr("testString") + updateCatalogEntryOptionsModel.Move = core.StringPtr("testString") + updateCatalogEntryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = testService.UpdateCatalogEntry(updateCatalogEntryOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + }) + It(`Invoke UpdateCatalogEntry with error: Operation validation and request error`, func() { + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1(&globalcatalogv1.GlobalCatalogV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(testServiceErr).To(BeNil()) + Expect(testService).ToNot(BeNil()) + + // Construct an instance of the Bullets model + bulletsModel := new(globalcatalogv1.Bullets) + bulletsModel.Title = core.StringPtr("testString") + bulletsModel.Description = core.StringPtr("testString") + bulletsModel.Icon = core.StringPtr("testString") + bulletsModel.Quantity = core.Int64Ptr(int64(38)) + + // Construct an instance of the Price model + priceModel := new(globalcatalogv1.Price) + priceModel.QuantityTier = core.Int64Ptr(int64(38)) + priceModel.Price = core.Float64Ptr(72.5) + + // Construct an instance of the UIMetaMedia model + uiMetaMediaModel := new(globalcatalogv1.UIMetaMedia) + uiMetaMediaModel.Caption = core.StringPtr("testString") + uiMetaMediaModel.ThumbnailURL = core.StringPtr("testString") + uiMetaMediaModel.Type = core.StringPtr("testString") + uiMetaMediaModel.URL = core.StringPtr("testString") + uiMetaMediaModel.Source = bulletsModel + + // Construct an instance of the Amount model + amountModel := new(globalcatalogv1.Amount) + amountModel.Country = core.StringPtr("testString") + amountModel.Currency = core.StringPtr("testString") + amountModel.Prices = []globalcatalogv1.Price{*priceModel} + + // Construct an instance of the Strings model + stringsModel := new(globalcatalogv1.Strings) + stringsModel.Bullets = []globalcatalogv1.Bullets{*bulletsModel} + stringsModel.Media = []globalcatalogv1.UIMetaMedia{*uiMetaMediaModel} + stringsModel.NotCreatableMsg = core.StringPtr("testString") + stringsModel.NotCreatableRobotMsg = core.StringPtr("testString") + stringsModel.DeprecationWarning = core.StringPtr("testString") + stringsModel.PopupWarningMessage = core.StringPtr("testString") + stringsModel.Instruction = core.StringPtr("testString") + + // Construct an instance of the Broker model + brokerModel := new(globalcatalogv1.Broker) + brokerModel.Name = core.StringPtr("testString") + brokerModel.Guid = core.StringPtr("testString") + + // Construct an instance of the DRMetaData model + drMetaDataModel := new(globalcatalogv1.DRMetaData) + drMetaDataModel.Dr = core.BoolPtr(true) + drMetaDataModel.Description = core.StringPtr("testString") + + // Construct an instance of the I18N model + i18NModel := new(globalcatalogv1.I18N) + i18NModel.SetProperty("foo", stringsModel) + + // Construct an instance of the SourceMetaData model + sourceMetaDataModel := new(globalcatalogv1.SourceMetaData) + sourceMetaDataModel.Path = core.StringPtr("testString") + sourceMetaDataModel.Type = core.StringPtr("testString") + sourceMetaDataModel.URL = core.StringPtr("testString") + + // Construct an instance of the StartingPrice model + startingPriceModel := new(globalcatalogv1.StartingPrice) + startingPriceModel.PlanID = core.StringPtr("testString") + startingPriceModel.DeploymentID = core.StringPtr("testString") + startingPriceModel.Unit = core.StringPtr("testString") + startingPriceModel.Amount = []globalcatalogv1.Amount{*amountModel} + + // Construct an instance of the URLS model + urlsModel := new(globalcatalogv1.URLS) + urlsModel.DocURL = core.StringPtr("testString") + urlsModel.InstructionsURL = core.StringPtr("testString") + urlsModel.ApiURL = core.StringPtr("testString") + urlsModel.CreateURL = core.StringPtr("testString") + urlsModel.SdkDownloadURL = core.StringPtr("testString") + urlsModel.TermsURL = core.StringPtr("testString") + urlsModel.CustomCreatePageURL = core.StringPtr("testString") + urlsModel.CatalogDetailsURL = core.StringPtr("testString") + urlsModel.DeprecationDocURL = core.StringPtr("testString") + urlsModel.DashboardURL = core.StringPtr("testString") + urlsModel.RegistrationURL = core.StringPtr("testString") + urlsModel.Apidocsurl = core.StringPtr("testString") + + // Construct an instance of the AliasMetaData model + aliasMetaDataModel := new(globalcatalogv1.AliasMetaData) + aliasMetaDataModel.Type = core.StringPtr("testString") + aliasMetaDataModel.PlanID = core.StringPtr("testString") + + // Construct an instance of the CFMetaData model + cfMetaDataModel := new(globalcatalogv1.CFMetaData) + cfMetaDataModel.Type = core.StringPtr("testString") + cfMetaDataModel.IamCompatible = core.BoolPtr(true) + cfMetaDataModel.UniqueApiKey = core.BoolPtr(true) + cfMetaDataModel.Provisionable = core.BoolPtr(true) + cfMetaDataModel.Bindable = core.BoolPtr(true) + cfMetaDataModel.AsyncProvisioningSupported = core.BoolPtr(true) + cfMetaDataModel.AsyncUnprovisioningSupported = core.BoolPtr(true) + cfMetaDataModel.Requires = []string{"testString"} + cfMetaDataModel.PlanUpdateable = core.BoolPtr(true) + cfMetaDataModel.State = core.StringPtr("testString") + cfMetaDataModel.ServiceCheckEnabled = core.BoolPtr(true) + cfMetaDataModel.TestCheckInterval = core.Int64Ptr(int64(38)) + cfMetaDataModel.ServiceKeySupported = core.BoolPtr(true) + cfMetaDataModel.CfGuid = make(map[string]string) + + // Construct an instance of the Callbacks model + callbacksModel := new(globalcatalogv1.Callbacks) + callbacksModel.ControllerURL = core.StringPtr("testString") + callbacksModel.BrokerURL = core.StringPtr("testString") + callbacksModel.BrokerProxyURL = core.StringPtr("testString") + callbacksModel.DashboardURL = core.StringPtr("testString") + callbacksModel.DashboardDataURL = core.StringPtr("testString") + callbacksModel.DashboardDetailTabURL = core.StringPtr("testString") + callbacksModel.DashboardDetailTabExtURL = core.StringPtr("testString") + callbacksModel.ServiceMonitorApi = core.StringPtr("testString") + callbacksModel.ServiceMonitorApp = core.StringPtr("testString") + callbacksModel.ApiEndpoint = make(map[string]string) + + // Construct an instance of the DeploymentBase model + deploymentBaseModel := new(globalcatalogv1.DeploymentBase) + deploymentBaseModel.Location = core.StringPtr("testString") + deploymentBaseModel.LocationURL = core.StringPtr("testString") + deploymentBaseModel.OriginalLocation = core.StringPtr("testString") + deploymentBaseModel.TargetCrn = core.StringPtr("testString") + deploymentBaseModel.ServiceCrn = core.StringPtr("testString") + deploymentBaseModel.MccpID = core.StringPtr("testString") + deploymentBaseModel.Broker = brokerModel + deploymentBaseModel.SupportsRcMigration = core.BoolPtr(true) + deploymentBaseModel.TargetNetwork = core.StringPtr("testString") + + // Construct an instance of the Overview model + overviewModel := new(globalcatalogv1.Overview) + overviewModel.DisplayName = core.StringPtr("testString") + overviewModel.LongDescription = core.StringPtr("testString") + overviewModel.Description = core.StringPtr("testString") + overviewModel.FeaturedDescription = core.StringPtr("testString") + + // Construct an instance of the PlanMetaData model + planMetaDataModel := new(globalcatalogv1.PlanMetaData) + planMetaDataModel.Bindable = core.BoolPtr(true) + planMetaDataModel.Reservable = core.BoolPtr(true) + planMetaDataModel.AllowInternalUsers = core.BoolPtr(true) + planMetaDataModel.AsyncProvisioningSupported = core.BoolPtr(true) + planMetaDataModel.AsyncUnprovisioningSupported = core.BoolPtr(true) + planMetaDataModel.TestCheckInterval = core.Int64Ptr(int64(38)) + planMetaDataModel.SingleScopeInstance = core.StringPtr("testString") + planMetaDataModel.ServiceCheckEnabled = core.BoolPtr(true) + planMetaDataModel.CfGuid = make(map[string]string) + + // Construct an instance of the PricingSet model + pricingSetModel := new(globalcatalogv1.PricingSet) + pricingSetModel.Type = core.StringPtr("testString") + pricingSetModel.Origin = core.StringPtr("testString") + pricingSetModel.StartingPrice = startingPriceModel + + // Construct an instance of the SLAMetaData model + slaMetaDataModel := new(globalcatalogv1.SLAMetaData) + slaMetaDataModel.Terms = core.StringPtr("testString") + slaMetaDataModel.Tenancy = core.StringPtr("testString") + slaMetaDataModel.Provisioning = core.StringPtr("testString") + slaMetaDataModel.Responsiveness = core.StringPtr("testString") + slaMetaDataModel.Dr = drMetaDataModel + + // Construct an instance of the TemplateMetaData model + templateMetaDataModel := new(globalcatalogv1.TemplateMetaData) + templateMetaDataModel.Services = []string{"testString"} + templateMetaDataModel.DefaultMemory = core.Int64Ptr(int64(38)) + templateMetaDataModel.StartCmd = core.StringPtr("testString") + templateMetaDataModel.Source = sourceMetaDataModel + templateMetaDataModel.RuntimeCatalogID = core.StringPtr("testString") + templateMetaDataModel.CfRuntimeID = core.StringPtr("testString") + templateMetaDataModel.TemplateID = core.StringPtr("testString") + templateMetaDataModel.ExecutableFile = core.StringPtr("testString") + templateMetaDataModel.Buildpack = core.StringPtr("testString") + templateMetaDataModel.EnvironmentVariables = make(map[string]string) + + // Construct an instance of the UIMetaData model + uiMetaDataModel := new(globalcatalogv1.UIMetaData) + uiMetaDataModel.Strings = i18NModel + uiMetaDataModel.Urls = urlsModel + uiMetaDataModel.EmbeddableDashboard = core.StringPtr("testString") + uiMetaDataModel.EmbeddableDashboardFullWidth = core.BoolPtr(true) + uiMetaDataModel.NavigationOrder = []string{"testString"} + uiMetaDataModel.NotCreatable = core.BoolPtr(true) + uiMetaDataModel.PrimaryOfferingID = core.StringPtr("testString") + uiMetaDataModel.AccessibleDuringProvision = core.BoolPtr(true) + uiMetaDataModel.SideBySideIndex = core.Int64Ptr(int64(38)) + uiMetaDataModel.EndOfServiceTime = CreateMockDateTime() + uiMetaDataModel.Hidden = core.BoolPtr(true) + uiMetaDataModel.HideLiteMetering = core.BoolPtr(true) + uiMetaDataModel.NoUpgradeNextStep = core.BoolPtr(true) + + // Construct an instance of the Image model + imageModel := new(globalcatalogv1.Image) + imageModel.Image = core.StringPtr("testString") + imageModel.SmallImage = core.StringPtr("testString") + imageModel.MediumImage = core.StringPtr("testString") + imageModel.FeatureImage = core.StringPtr("testString") + + // Construct an instance of the ObjectMetadataSet model + objectMetadataSetModel := new(globalcatalogv1.ObjectMetadataSet) + objectMetadataSetModel.RcCompatible = core.BoolPtr(true) + objectMetadataSetModel.Service = cfMetaDataModel + objectMetadataSetModel.Plan = planMetaDataModel + objectMetadataSetModel.Alias = aliasMetaDataModel + objectMetadataSetModel.Template = templateMetaDataModel + objectMetadataSetModel.Ui = uiMetaDataModel + objectMetadataSetModel.Compliance = []string{"testString"} + objectMetadataSetModel.Sla = slaMetaDataModel + objectMetadataSetModel.Callbacks = callbacksModel + objectMetadataSetModel.OriginalName = core.StringPtr("testString") + objectMetadataSetModel.Version = core.StringPtr("testString") + objectMetadataSetModel.Other = make(map[string]interface{}) + objectMetadataSetModel.Pricing = pricingSetModel + objectMetadataSetModel.Deployment = deploymentBaseModel + + // Construct an instance of the OverviewUI model + overviewUiModel := new(globalcatalogv1.OverviewUI) + overviewUiModel.SetProperty("foo", overviewModel) + + // Construct an instance of the Provider model + providerModel := new(globalcatalogv1.Provider) + providerModel.Email = core.StringPtr("testString") + providerModel.Name = core.StringPtr("testString") + providerModel.Contact = core.StringPtr("testString") + providerModel.SupportEmail = core.StringPtr("testString") + providerModel.Phone = core.StringPtr("testString") + + // Construct an instance of the UpdateCatalogEntryOptions model + updateCatalogEntryOptionsModel := new(globalcatalogv1.UpdateCatalogEntryOptions) + updateCatalogEntryOptionsModel.ID = core.StringPtr("testString") + updateCatalogEntryOptionsModel.Name = core.StringPtr("testString") + updateCatalogEntryOptionsModel.Kind = core.StringPtr("service") + updateCatalogEntryOptionsModel.OverviewUi = overviewUiModel + updateCatalogEntryOptionsModel.Images = imageModel + updateCatalogEntryOptionsModel.Disabled = core.BoolPtr(true) + updateCatalogEntryOptionsModel.Tags = []string{"testString"} + updateCatalogEntryOptionsModel.Provider = providerModel + updateCatalogEntryOptionsModel.ParentID = core.StringPtr("testString") + updateCatalogEntryOptionsModel.Group = core.BoolPtr(true) + updateCatalogEntryOptionsModel.Active = core.BoolPtr(true) + updateCatalogEntryOptionsModel.Metadata = objectMetadataSetModel + updateCatalogEntryOptionsModel.Account = core.StringPtr("testString") + updateCatalogEntryOptionsModel.Move = core.StringPtr("testString") + updateCatalogEntryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := testService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := testService.UpdateCatalogEntry(updateCatalogEntryOptionsModel) + 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 UpdateCatalogEntryOptions model with no property values + updateCatalogEntryOptionsModelNew := new(globalcatalogv1.UpdateCatalogEntryOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = testService.UpdateCatalogEntry(updateCatalogEntryOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + + Describe(`DeleteCatalogEntry(deleteCatalogEntryOptions *DeleteCatalogEntryOptions)`, func() { + deleteCatalogEntryPath := "/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.Path).To(Equal(deleteCatalogEntryPath)) + Expect(req.Method).To(Equal("DELETE")) + Expect(req.URL.Query()["account"]).To(Equal([]string{"testString"})) + + + // TODO: Add check for force query parameter + + res.WriteHeader(204) + })) + }) + It(`Invoke DeleteCatalogEntry successfully`, func() { + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1(&globalcatalogv1.GlobalCatalogV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(testServiceErr).To(BeNil()) + Expect(testService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + response, operationErr := testService.DeleteCatalogEntry(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteCatalogEntryOptions model + deleteCatalogEntryOptionsModel := new(globalcatalogv1.DeleteCatalogEntryOptions) + deleteCatalogEntryOptionsModel.ID = core.StringPtr("testString") + deleteCatalogEntryOptionsModel.Account = core.StringPtr("testString") + deleteCatalogEntryOptionsModel.Force = core.BoolPtr(true) + deleteCatalogEntryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = testService.DeleteCatalogEntry(deleteCatalogEntryOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteCatalogEntry with error: Operation validation and request error`, func() { + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1(&globalcatalogv1.GlobalCatalogV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(testServiceErr).To(BeNil()) + Expect(testService).ToNot(BeNil()) + + // Construct an instance of the DeleteCatalogEntryOptions model + deleteCatalogEntryOptionsModel := new(globalcatalogv1.DeleteCatalogEntryOptions) + deleteCatalogEntryOptionsModel.ID = core.StringPtr("testString") + deleteCatalogEntryOptionsModel.Account = core.StringPtr("testString") + deleteCatalogEntryOptionsModel.Force = core.BoolPtr(true) + deleteCatalogEntryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := testService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := testService.DeleteCatalogEntry(deleteCatalogEntryOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteCatalogEntryOptions model with no property values + deleteCatalogEntryOptionsModelNew := new(globalcatalogv1.DeleteCatalogEntryOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = testService.DeleteCatalogEntry(deleteCatalogEntryOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetChildObjects(getChildObjectsOptions *GetChildObjectsOptions) - Operation response error`, func() { + getChildObjectsPath := "/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.Path).To(Equal(getChildObjectsPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["account"]).To(Equal([]string{"testString"})) + + Expect(req.URL.Query()["include"]).To(Equal([]string{"testString"})) + + Expect(req.URL.Query()["q"]).To(Equal([]string{"testString"})) + + Expect(req.URL.Query()["sort-by"]).To(Equal([]string{"testString"})) + + Expect(req.URL.Query()["descending"]).To(Equal([]string{"testString"})) + + Expect(req.URL.Query()["languages"]).To(Equal([]string{"testString"})) + + Expect(req.URL.Query()["complete"]).To(Equal([]string{"testString"})) + + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, `} this is not valid json {`) + })) + }) + It(`Invoke GetChildObjects with error: Operation response processing error`, func() { + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1(&globalcatalogv1.GlobalCatalogV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(testServiceErr).To(BeNil()) + Expect(testService).ToNot(BeNil()) + + // Construct an instance of the GetChildObjectsOptions model + getChildObjectsOptionsModel := new(globalcatalogv1.GetChildObjectsOptions) + getChildObjectsOptionsModel.ID = core.StringPtr("testString") + getChildObjectsOptionsModel.Kind = core.StringPtr("testString") + getChildObjectsOptionsModel.Account = core.StringPtr("testString") + getChildObjectsOptionsModel.Include = core.StringPtr("testString") + getChildObjectsOptionsModel.Q = core.StringPtr("testString") + getChildObjectsOptionsModel.SortBy = core.StringPtr("testString") + getChildObjectsOptionsModel.Descending = core.StringPtr("testString") + getChildObjectsOptionsModel.Languages = core.StringPtr("testString") + getChildObjectsOptionsModel.Complete = core.StringPtr("testString") + getChildObjectsOptionsModel.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 := testService.GetChildObjects(getChildObjectsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + + Describe(`GetChildObjects(getChildObjectsOptions *GetChildObjectsOptions)`, func() { + getChildObjectsPath := "/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.Path).To(Equal(getChildObjectsPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["account"]).To(Equal([]string{"testString"})) + + Expect(req.URL.Query()["include"]).To(Equal([]string{"testString"})) + + Expect(req.URL.Query()["q"]).To(Equal([]string{"testString"})) + + Expect(req.URL.Query()["sort-by"]).To(Equal([]string{"testString"})) + + Expect(req.URL.Query()["descending"]).To(Equal([]string{"testString"})) + + Expect(req.URL.Query()["languages"]).To(Equal([]string{"testString"})) + + Expect(req.URL.Query()["complete"]).To(Equal([]string{"testString"})) + + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, `{"offset": 6, "limit": 5, "count": 5, "resource_count": 13, "first": "First", "last": "Last", "prev": "Prev", "next": "Next", "resources": [{"name": "Name", "kind": "service", "overview_ui": {}, "images": {"image": "Image", "small_image": "SmallImage", "medium_image": "MediumImage", "feature_image": "FeatureImage"}, "parent_id": "ParentID", "disabled": true, "tags": ["Tags"], "group": false, "provider": {"email": "Email", "name": "Name", "contact": "Contact", "support_email": "SupportEmail", "phone": "Phone"}, "active": true, "metadata": {"rc_compatible": true, "service": {"type": "Type", "iam_compatible": false, "unique_api_key": true, "provisionable": false, "bindable": true, "async_provisioning_supported": true, "async_unprovisioning_supported": true, "requires": ["Requires"], "plan_updateable": true, "state": "State", "service_check_enabled": false, "test_check_interval": 17, "service_key_supported": false, "cf_guid": {"mapKey": "Inner"}}, "plan": {"bindable": true, "reservable": true, "allow_internal_users": true, "async_provisioning_supported": true, "async_unprovisioning_supported": true, "test_check_interval": 17, "single_scope_instance": "SingleScopeInstance", "service_check_enabled": false, "cf_guid": {"mapKey": "Inner"}}, "alias": {"type": "Type", "plan_id": "PlanID"}, "template": {"services": ["Services"], "default_memory": 13, "start_cmd": "StartCmd", "source": {"path": "Path", "type": "Type", "url": "URL"}, "runtime_catalog_id": "RuntimeCatalogID", "cf_runtime_id": "CfRuntimeID", "template_id": "TemplateID", "executable_file": "ExecutableFile", "buildpack": "Buildpack", "environment_variables": {"mapKey": "Inner"}}, "ui": {"strings": {}, "urls": {"doc_url": "DocURL", "instructions_url": "InstructionsURL", "api_url": "ApiURL", "create_url": "CreateURL", "sdk_download_url": "SdkDownloadURL", "terms_url": "TermsURL", "custom_create_page_url": "CustomCreatePageURL", "catalog_details_url": "CatalogDetailsURL", "deprecation_doc_url": "DeprecationDocURL", "dashboard_url": "DashboardURL", "registration_url": "RegistrationURL", "apidocsurl": "Apidocsurl"}, "embeddable_dashboard": "EmbeddableDashboard", "embeddable_dashboard_full_width": true, "navigation_order": ["NavigationOrder"], "not_creatable": true, "primary_offering_id": "PrimaryOfferingID", "accessible_during_provision": false, "side_by_side_index": 15, "end_of_service_time": "2019-01-01T12:00:00", "hidden": true, "hide_lite_metering": true, "no_upgrade_next_step": false}, "compliance": ["Compliance"], "sla": {"terms": "Terms", "tenancy": "Tenancy", "provisioning": "Provisioning", "responsiveness": "Responsiveness", "dr": {"dr": true, "description": "Description"}}, "callbacks": {"controller_url": "ControllerURL", "broker_url": "BrokerURL", "broker_proxy_url": "BrokerProxyURL", "dashboard_url": "DashboardURL", "dashboard_data_url": "DashboardDataURL", "dashboard_detail_tab_url": "DashboardDetailTabURL", "dashboard_detail_tab_ext_url": "DashboardDetailTabExtURL", "service_monitor_api": "ServiceMonitorApi", "service_monitor_app": "ServiceMonitorApp", "api_endpoint": {"mapKey": "Inner"}}, "original_name": "OriginalName", "version": "Version", "other": {"mapKey": {"anyKey": "anyValue"}}, "pricing": {"type": "Type", "origin": "Origin", "starting_price": {"plan_id": "PlanID", "deployment_id": "DeploymentID", "unit": "Unit", "amount": [{"country": "Country", "currency": "Currency", "prices": [{"quantity_tier": 12, "Price": 5}]}]}, "metrics": [{"part_ref": "PartRef", "metric_id": "MetricID", "tier_model": "TierModel", "charge_unit": "ChargeUnit", "charge_unit_name": "ChargeUnitName", "charge_unit_quantity": "ChargeUnitQuantity", "resource_display_name": "ResourceDisplayName", "charge_unit_display_name": "ChargeUnitDisplayName", "usage_cap_qty": 11, "display_cap": 10, "effective_from": "2019-01-01T12:00:00", "effective_until": "2019-01-01T12:00:00", "amounts": [{"country": "Country", "currency": "Currency", "prices": [{"quantity_tier": 12, "Price": 5}]}]}]}, "deployment": {"location": "Location", "location_url": "LocationURL", "original_location": "OriginalLocation", "target_crn": "TargetCrn", "service_crn": "ServiceCrn", "mccp_id": "MccpID", "broker": {"name": "Name", "guid": "Guid"}, "supports_rc_migration": false, "target_network": "TargetNetwork"}}, "id": "ID", "catalog_crn": "anyValue", "url": "anyValue", "children_url": "anyValue", "geo_tags": "anyValue", "pricing_tags": "anyValue", "created": "anyValue", "updated": "anyValue"}]}`) + })) + }) + It(`Invoke GetChildObjects successfully`, func() { + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1(&globalcatalogv1.GlobalCatalogV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(testServiceErr).To(BeNil()) + Expect(testService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := testService.GetChildObjects(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetChildObjectsOptions model + getChildObjectsOptionsModel := new(globalcatalogv1.GetChildObjectsOptions) + getChildObjectsOptionsModel.ID = core.StringPtr("testString") + getChildObjectsOptionsModel.Kind = core.StringPtr("testString") + getChildObjectsOptionsModel.Account = core.StringPtr("testString") + getChildObjectsOptionsModel.Include = core.StringPtr("testString") + getChildObjectsOptionsModel.Q = core.StringPtr("testString") + getChildObjectsOptionsModel.SortBy = core.StringPtr("testString") + getChildObjectsOptionsModel.Descending = core.StringPtr("testString") + getChildObjectsOptionsModel.Languages = core.StringPtr("testString") + getChildObjectsOptionsModel.Complete = core.StringPtr("testString") + getChildObjectsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = testService.GetChildObjects(getChildObjectsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + }) + It(`Invoke GetChildObjects with error: Operation validation and request error`, func() { + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1(&globalcatalogv1.GlobalCatalogV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(testServiceErr).To(BeNil()) + Expect(testService).ToNot(BeNil()) + + // Construct an instance of the GetChildObjectsOptions model + getChildObjectsOptionsModel := new(globalcatalogv1.GetChildObjectsOptions) + getChildObjectsOptionsModel.ID = core.StringPtr("testString") + getChildObjectsOptionsModel.Kind = core.StringPtr("testString") + getChildObjectsOptionsModel.Account = core.StringPtr("testString") + getChildObjectsOptionsModel.Include = core.StringPtr("testString") + getChildObjectsOptionsModel.Q = core.StringPtr("testString") + getChildObjectsOptionsModel.SortBy = core.StringPtr("testString") + getChildObjectsOptionsModel.Descending = core.StringPtr("testString") + getChildObjectsOptionsModel.Languages = core.StringPtr("testString") + getChildObjectsOptionsModel.Complete = core.StringPtr("testString") + getChildObjectsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := testService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := testService.GetChildObjects(getChildObjectsOptionsModel) + 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 GetChildObjectsOptions model with no property values + getChildObjectsOptionsModelNew := new(globalcatalogv1.GetChildObjectsOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = testService.GetChildObjects(getChildObjectsOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + + Describe(`RestoreCatalogEntry(restoreCatalogEntryOptions *RestoreCatalogEntryOptions)`, func() { + restoreCatalogEntryPath := "/testString/restore" + 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.Path).To(Equal(restoreCatalogEntryPath)) + Expect(req.Method).To(Equal("PUT")) + Expect(req.URL.Query()["account"]).To(Equal([]string{"testString"})) + + res.WriteHeader(204) + })) + }) + It(`Invoke RestoreCatalogEntry successfully`, func() { + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1(&globalcatalogv1.GlobalCatalogV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(testServiceErr).To(BeNil()) + Expect(testService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + response, operationErr := testService.RestoreCatalogEntry(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the RestoreCatalogEntryOptions model + restoreCatalogEntryOptionsModel := new(globalcatalogv1.RestoreCatalogEntryOptions) + restoreCatalogEntryOptionsModel.ID = core.StringPtr("testString") + restoreCatalogEntryOptionsModel.Account = core.StringPtr("testString") + restoreCatalogEntryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = testService.RestoreCatalogEntry(restoreCatalogEntryOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke RestoreCatalogEntry with error: Operation validation and request error`, func() { + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1(&globalcatalogv1.GlobalCatalogV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(testServiceErr).To(BeNil()) + Expect(testService).ToNot(BeNil()) + + // Construct an instance of the RestoreCatalogEntryOptions model + restoreCatalogEntryOptionsModel := new(globalcatalogv1.RestoreCatalogEntryOptions) + restoreCatalogEntryOptionsModel.ID = core.StringPtr("testString") + restoreCatalogEntryOptionsModel.Account = core.StringPtr("testString") + restoreCatalogEntryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := testService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := testService.RestoreCatalogEntry(restoreCatalogEntryOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the RestoreCatalogEntryOptions model with no property values + restoreCatalogEntryOptionsModelNew := new(globalcatalogv1.RestoreCatalogEntryOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = testService.RestoreCatalogEntry(restoreCatalogEntryOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`Service constructor tests`, func() { + It(`Instantiate service client`, func() { + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1(&globalcatalogv1.GlobalCatalogV1Options{ + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(testService).ToNot(BeNil()) + Expect(testServiceErr).To(BeNil()) + }) + It(`Instantiate service client with error: Invalid URL`, func() { + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1(&globalcatalogv1.GlobalCatalogV1Options{ + URL: "{BAD_URL_STRING", + }) + Expect(testService).To(BeNil()) + Expect(testServiceErr).ToNot(BeNil()) + }) + It(`Instantiate service client with error: Invalid Auth`, func() { + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1(&globalcatalogv1.GlobalCatalogV1Options{ + URL: "https://globalcatalogv1/api", + Authenticator: &core.BasicAuthenticator{ + Username: "", + Password: "", + }, + }) + Expect(testService).To(BeNil()) + Expect(testServiceErr).ToNot(BeNil()) + }) + }) + Describe(`Service constructor tests using external config`, func() { + Context(`Using external config, construct service client instances`, func() { + // Map containing environment variables used in testing. + var testEnvironment = map[string]string{ + "GLOBAL_CATALOG_URL": "https://globalcatalogv1/api", + "GLOBAL_CATALOG_AUTH_TYPE": "noauth", + } + + It(`Create service client using external config successfully`, func() { + SetTestEnvironment(testEnvironment) + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1UsingExternalConfig(&globalcatalogv1.GlobalCatalogV1Options{ + }) + Expect(testService).ToNot(BeNil()) + Expect(testServiceErr).To(BeNil()) + ClearTestEnvironment(testEnvironment) + }) + It(`Create service client using external config and set url from constructor successfully`, func() { + SetTestEnvironment(testEnvironment) + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1UsingExternalConfig(&globalcatalogv1.GlobalCatalogV1Options{ + URL: "https://testService/api", + }) + Expect(testService).ToNot(BeNil()) + Expect(testServiceErr).To(BeNil()) + Expect(testService.Service.GetServiceURL()).To(Equal("https://testService/api")) + ClearTestEnvironment(testEnvironment) + }) + It(`Create service client using external config and set url programatically successfully`, func() { + SetTestEnvironment(testEnvironment) + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1UsingExternalConfig(&globalcatalogv1.GlobalCatalogV1Options{ + }) + err := testService.SetServiceURL("https://testService/api") + Expect(err).To(BeNil()) + Expect(testService).ToNot(BeNil()) + Expect(testServiceErr).To(BeNil()) + Expect(testService.Service.GetServiceURL()).To(Equal("https://testService/api")) + ClearTestEnvironment(testEnvironment) + }) + }) + Context(`Using external config, construct service client instances with error: Invalid Auth`, func() { + // Map containing environment variables used in testing. + var testEnvironment = map[string]string{ + "GLOBAL_CATALOG_URL": "https://globalcatalogv1/api", + "GLOBAL_CATALOG_AUTH_TYPE": "someOtherAuth", + } + + SetTestEnvironment(testEnvironment) + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1UsingExternalConfig(&globalcatalogv1.GlobalCatalogV1Options{ + }) + + It(`Instantiate service client with error`, func() { + Expect(testService).To(BeNil()) + Expect(testServiceErr).ToNot(BeNil()) + ClearTestEnvironment(testEnvironment) + }) + }) + Context(`Using external config, construct service client instances with error: Invalid URL`, func() { + // Map containing environment variables used in testing. + var testEnvironment = map[string]string{ + "GLOBAL_CATALOG_AUTH_TYPE": "NOAuth", + } + + SetTestEnvironment(testEnvironment) + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1UsingExternalConfig(&globalcatalogv1.GlobalCatalogV1Options{ + URL: "{BAD_URL_STRING", + }) + + It(`Instantiate service client with error`, func() { + Expect(testService).To(BeNil()) + Expect(testServiceErr).ToNot(BeNil()) + ClearTestEnvironment(testEnvironment) + }) + }) + }) + Describe(`GetVisibility(getVisibilityOptions *GetVisibilityOptions) - Operation response error`, func() { + getVisibilityPath := "/testString/visibility" + 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.Path).To(Equal(getVisibilityPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["account"]).To(Equal([]string{"testString"})) + + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, `} this is not valid json {`) + })) + }) + It(`Invoke GetVisibility with error: Operation response processing error`, func() { + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1(&globalcatalogv1.GlobalCatalogV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(testServiceErr).To(BeNil()) + Expect(testService).ToNot(BeNil()) + + // Construct an instance of the GetVisibilityOptions model + getVisibilityOptionsModel := new(globalcatalogv1.GetVisibilityOptions) + getVisibilityOptionsModel.ID = core.StringPtr("testString") + getVisibilityOptionsModel.Account = core.StringPtr("testString") + getVisibilityOptionsModel.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 := testService.GetVisibility(getVisibilityOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + + Describe(`GetVisibility(getVisibilityOptions *GetVisibilityOptions)`, func() { + getVisibilityPath := "/testString/visibility" + 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.Path).To(Equal(getVisibilityPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["account"]).To(Equal([]string{"testString"})) + + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, `{"restrictions": "Restrictions", "owner": "Owner", "extendable": true, "include": {"accounts": {"_accountid_": "Accountid"}}, "exclude": {"accounts": {"_accountid_": "Accountid"}}, "approved": true}`) + })) + }) + It(`Invoke GetVisibility successfully`, func() { + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1(&globalcatalogv1.GlobalCatalogV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(testServiceErr).To(BeNil()) + Expect(testService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := testService.GetVisibility(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetVisibilityOptions model + getVisibilityOptionsModel := new(globalcatalogv1.GetVisibilityOptions) + getVisibilityOptionsModel.ID = core.StringPtr("testString") + getVisibilityOptionsModel.Account = core.StringPtr("testString") + getVisibilityOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = testService.GetVisibility(getVisibilityOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + }) + It(`Invoke GetVisibility with error: Operation validation and request error`, func() { + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1(&globalcatalogv1.GlobalCatalogV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(testServiceErr).To(BeNil()) + Expect(testService).ToNot(BeNil()) + + // Construct an instance of the GetVisibilityOptions model + getVisibilityOptionsModel := new(globalcatalogv1.GetVisibilityOptions) + getVisibilityOptionsModel.ID = core.StringPtr("testString") + getVisibilityOptionsModel.Account = core.StringPtr("testString") + getVisibilityOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := testService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := testService.GetVisibility(getVisibilityOptionsModel) + 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 GetVisibilityOptions model with no property values + getVisibilityOptionsModelNew := new(globalcatalogv1.GetVisibilityOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = testService.GetVisibility(getVisibilityOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + + Describe(`UpdateVisibility(updateVisibilityOptions *UpdateVisibilityOptions)`, func() { + updateVisibilityPath := "/testString/visibility" + 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.Path).To(Equal(updateVisibilityPath)) + Expect(req.Method).To(Equal("PUT")) + Expect(req.URL.Query()["account"]).To(Equal([]string{"testString"})) + + res.WriteHeader(200) + })) + }) + It(`Invoke UpdateVisibility successfully`, func() { + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1(&globalcatalogv1.GlobalCatalogV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(testServiceErr).To(BeNil()) + Expect(testService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + response, operationErr := testService.UpdateVisibility(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the VisibilityDetailAccounts model + visibilityDetailAccountsModel := new(globalcatalogv1.VisibilityDetailAccounts) + visibilityDetailAccountsModel.Accountid = core.StringPtr("testString") + + // Construct an instance of the VisibilityDetail model + visibilityDetailModel := new(globalcatalogv1.VisibilityDetail) + visibilityDetailModel.Accounts = visibilityDetailAccountsModel + + // Construct an instance of the UpdateVisibilityOptions model + updateVisibilityOptionsModel := new(globalcatalogv1.UpdateVisibilityOptions) + updateVisibilityOptionsModel.ID = core.StringPtr("testString") + updateVisibilityOptionsModel.Extendable = core.BoolPtr(true) + updateVisibilityOptionsModel.Include = visibilityDetailModel + updateVisibilityOptionsModel.Exclude = visibilityDetailModel + updateVisibilityOptionsModel.Account = core.StringPtr("testString") + updateVisibilityOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = testService.UpdateVisibility(updateVisibilityOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke UpdateVisibility with error: Operation validation and request error`, func() { + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1(&globalcatalogv1.GlobalCatalogV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(testServiceErr).To(BeNil()) + Expect(testService).ToNot(BeNil()) + + // Construct an instance of the VisibilityDetailAccounts model + visibilityDetailAccountsModel := new(globalcatalogv1.VisibilityDetailAccounts) + visibilityDetailAccountsModel.Accountid = core.StringPtr("testString") + + // Construct an instance of the VisibilityDetail model + visibilityDetailModel := new(globalcatalogv1.VisibilityDetail) + visibilityDetailModel.Accounts = visibilityDetailAccountsModel + + // Construct an instance of the UpdateVisibilityOptions model + updateVisibilityOptionsModel := new(globalcatalogv1.UpdateVisibilityOptions) + updateVisibilityOptionsModel.ID = core.StringPtr("testString") + updateVisibilityOptionsModel.Extendable = core.BoolPtr(true) + updateVisibilityOptionsModel.Include = visibilityDetailModel + updateVisibilityOptionsModel.Exclude = visibilityDetailModel + updateVisibilityOptionsModel.Account = core.StringPtr("testString") + updateVisibilityOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := testService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := testService.UpdateVisibility(updateVisibilityOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the UpdateVisibilityOptions model with no property values + updateVisibilityOptionsModelNew := new(globalcatalogv1.UpdateVisibilityOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = testService.UpdateVisibility(updateVisibilityOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`Service constructor tests`, func() { + It(`Instantiate service client`, func() { + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1(&globalcatalogv1.GlobalCatalogV1Options{ + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(testService).ToNot(BeNil()) + Expect(testServiceErr).To(BeNil()) + }) + It(`Instantiate service client with error: Invalid URL`, func() { + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1(&globalcatalogv1.GlobalCatalogV1Options{ + URL: "{BAD_URL_STRING", + }) + Expect(testService).To(BeNil()) + Expect(testServiceErr).ToNot(BeNil()) + }) + It(`Instantiate service client with error: Invalid Auth`, func() { + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1(&globalcatalogv1.GlobalCatalogV1Options{ + URL: "https://globalcatalogv1/api", + Authenticator: &core.BasicAuthenticator{ + Username: "", + Password: "", + }, + }) + Expect(testService).To(BeNil()) + Expect(testServiceErr).ToNot(BeNil()) + }) + }) + Describe(`Service constructor tests using external config`, func() { + Context(`Using external config, construct service client instances`, func() { + // Map containing environment variables used in testing. + var testEnvironment = map[string]string{ + "GLOBAL_CATALOG_URL": "https://globalcatalogv1/api", + "GLOBAL_CATALOG_AUTH_TYPE": "noauth", + } + + It(`Create service client using external config successfully`, func() { + SetTestEnvironment(testEnvironment) + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1UsingExternalConfig(&globalcatalogv1.GlobalCatalogV1Options{ + }) + Expect(testService).ToNot(BeNil()) + Expect(testServiceErr).To(BeNil()) + ClearTestEnvironment(testEnvironment) + }) + It(`Create service client using external config and set url from constructor successfully`, func() { + SetTestEnvironment(testEnvironment) + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1UsingExternalConfig(&globalcatalogv1.GlobalCatalogV1Options{ + URL: "https://testService/api", + }) + Expect(testService).ToNot(BeNil()) + Expect(testServiceErr).To(BeNil()) + Expect(testService.Service.GetServiceURL()).To(Equal("https://testService/api")) + ClearTestEnvironment(testEnvironment) + }) + It(`Create service client using external config and set url programatically successfully`, func() { + SetTestEnvironment(testEnvironment) + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1UsingExternalConfig(&globalcatalogv1.GlobalCatalogV1Options{ + }) + err := testService.SetServiceURL("https://testService/api") + Expect(err).To(BeNil()) + Expect(testService).ToNot(BeNil()) + Expect(testServiceErr).To(BeNil()) + Expect(testService.Service.GetServiceURL()).To(Equal("https://testService/api")) + ClearTestEnvironment(testEnvironment) + }) + }) + Context(`Using external config, construct service client instances with error: Invalid Auth`, func() { + // Map containing environment variables used in testing. + var testEnvironment = map[string]string{ + "GLOBAL_CATALOG_URL": "https://globalcatalogv1/api", + "GLOBAL_CATALOG_AUTH_TYPE": "someOtherAuth", + } + + SetTestEnvironment(testEnvironment) + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1UsingExternalConfig(&globalcatalogv1.GlobalCatalogV1Options{ + }) + + It(`Instantiate service client with error`, func() { + Expect(testService).To(BeNil()) + Expect(testServiceErr).ToNot(BeNil()) + ClearTestEnvironment(testEnvironment) + }) + }) + Context(`Using external config, construct service client instances with error: Invalid URL`, func() { + // Map containing environment variables used in testing. + var testEnvironment = map[string]string{ + "GLOBAL_CATALOG_AUTH_TYPE": "NOAuth", + } + + SetTestEnvironment(testEnvironment) + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1UsingExternalConfig(&globalcatalogv1.GlobalCatalogV1Options{ + URL: "{BAD_URL_STRING", + }) + + It(`Instantiate service client with error`, func() { + Expect(testService).To(BeNil()) + Expect(testServiceErr).ToNot(BeNil()) + ClearTestEnvironment(testEnvironment) + }) + }) + }) + Describe(`GetPricing(getPricingOptions *GetPricingOptions) - Operation response error`, func() { + getPricingPath := "/testString/pricing" + 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.Path).To(Equal(getPricingPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["account"]).To(Equal([]string{"testString"})) + + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, `} this is not valid json {`) + })) + }) + It(`Invoke GetPricing with error: Operation response processing error`, func() { + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1(&globalcatalogv1.GlobalCatalogV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(testServiceErr).To(BeNil()) + Expect(testService).ToNot(BeNil()) + + // Construct an instance of the GetPricingOptions model + getPricingOptionsModel := new(globalcatalogv1.GetPricingOptions) + getPricingOptionsModel.ID = core.StringPtr("testString") + getPricingOptionsModel.Account = core.StringPtr("testString") + getPricingOptionsModel.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 := testService.GetPricing(getPricingOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + + Describe(`GetPricing(getPricingOptions *GetPricingOptions)`, func() { + getPricingPath := "/testString/pricing" + 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.Path).To(Equal(getPricingPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["account"]).To(Equal([]string{"testString"})) + + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, `{"type": "Type", "origin": "Origin", "starting_price": {"plan_id": "PlanID", "deployment_id": "DeploymentID", "unit": "Unit", "amount": [{"country": "Country", "currency": "Currency", "prices": [{"quantity_tier": 12, "Price": 5}]}]}, "metrics": [{"part_ref": "PartRef", "metric_id": "MetricID", "tier_model": "TierModel", "charge_unit": "ChargeUnit", "charge_unit_name": "ChargeUnitName", "charge_unit_quantity": "ChargeUnitQuantity", "resource_display_name": "ResourceDisplayName", "charge_unit_display_name": "ChargeUnitDisplayName", "usage_cap_qty": 11, "display_cap": 10, "effective_from": "2019-01-01T12:00:00", "effective_until": "2019-01-01T12:00:00", "amounts": [{"country": "Country", "currency": "Currency", "prices": [{"quantity_tier": 12, "Price": 5}]}]}]}`) + })) + }) + It(`Invoke GetPricing successfully`, func() { + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1(&globalcatalogv1.GlobalCatalogV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(testServiceErr).To(BeNil()) + Expect(testService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := testService.GetPricing(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetPricingOptions model + getPricingOptionsModel := new(globalcatalogv1.GetPricingOptions) + getPricingOptionsModel.ID = core.StringPtr("testString") + getPricingOptionsModel.Account = core.StringPtr("testString") + getPricingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = testService.GetPricing(getPricingOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + }) + It(`Invoke GetPricing with error: Operation validation and request error`, func() { + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1(&globalcatalogv1.GlobalCatalogV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(testServiceErr).To(BeNil()) + Expect(testService).ToNot(BeNil()) + + // Construct an instance of the GetPricingOptions model + getPricingOptionsModel := new(globalcatalogv1.GetPricingOptions) + getPricingOptionsModel.ID = core.StringPtr("testString") + getPricingOptionsModel.Account = core.StringPtr("testString") + getPricingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := testService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := testService.GetPricing(getPricingOptionsModel) + 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 GetPricingOptions model with no property values + getPricingOptionsModelNew := new(globalcatalogv1.GetPricingOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = testService.GetPricing(getPricingOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`Service constructor tests`, func() { + It(`Instantiate service client`, func() { + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1(&globalcatalogv1.GlobalCatalogV1Options{ + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(testService).ToNot(BeNil()) + Expect(testServiceErr).To(BeNil()) + }) + It(`Instantiate service client with error: Invalid URL`, func() { + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1(&globalcatalogv1.GlobalCatalogV1Options{ + URL: "{BAD_URL_STRING", + }) + Expect(testService).To(BeNil()) + Expect(testServiceErr).ToNot(BeNil()) + }) + It(`Instantiate service client with error: Invalid Auth`, func() { + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1(&globalcatalogv1.GlobalCatalogV1Options{ + URL: "https://globalcatalogv1/api", + Authenticator: &core.BasicAuthenticator{ + Username: "", + Password: "", + }, + }) + Expect(testService).To(BeNil()) + Expect(testServiceErr).ToNot(BeNil()) + }) + }) + Describe(`Service constructor tests using external config`, func() { + Context(`Using external config, construct service client instances`, func() { + // Map containing environment variables used in testing. + var testEnvironment = map[string]string{ + "GLOBAL_CATALOG_URL": "https://globalcatalogv1/api", + "GLOBAL_CATALOG_AUTH_TYPE": "noauth", + } + + It(`Create service client using external config successfully`, func() { + SetTestEnvironment(testEnvironment) + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1UsingExternalConfig(&globalcatalogv1.GlobalCatalogV1Options{ + }) + Expect(testService).ToNot(BeNil()) + Expect(testServiceErr).To(BeNil()) + ClearTestEnvironment(testEnvironment) + }) + It(`Create service client using external config and set url from constructor successfully`, func() { + SetTestEnvironment(testEnvironment) + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1UsingExternalConfig(&globalcatalogv1.GlobalCatalogV1Options{ + URL: "https://testService/api", + }) + Expect(testService).ToNot(BeNil()) + Expect(testServiceErr).To(BeNil()) + Expect(testService.Service.GetServiceURL()).To(Equal("https://testService/api")) + ClearTestEnvironment(testEnvironment) + }) + It(`Create service client using external config and set url programatically successfully`, func() { + SetTestEnvironment(testEnvironment) + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1UsingExternalConfig(&globalcatalogv1.GlobalCatalogV1Options{ + }) + err := testService.SetServiceURL("https://testService/api") + Expect(err).To(BeNil()) + Expect(testService).ToNot(BeNil()) + Expect(testServiceErr).To(BeNil()) + Expect(testService.Service.GetServiceURL()).To(Equal("https://testService/api")) + ClearTestEnvironment(testEnvironment) + }) + }) + Context(`Using external config, construct service client instances with error: Invalid Auth`, func() { + // Map containing environment variables used in testing. + var testEnvironment = map[string]string{ + "GLOBAL_CATALOG_URL": "https://globalcatalogv1/api", + "GLOBAL_CATALOG_AUTH_TYPE": "someOtherAuth", + } + + SetTestEnvironment(testEnvironment) + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1UsingExternalConfig(&globalcatalogv1.GlobalCatalogV1Options{ + }) + + It(`Instantiate service client with error`, func() { + Expect(testService).To(BeNil()) + Expect(testServiceErr).ToNot(BeNil()) + ClearTestEnvironment(testEnvironment) + }) + }) + Context(`Using external config, construct service client instances with error: Invalid URL`, func() { + // Map containing environment variables used in testing. + var testEnvironment = map[string]string{ + "GLOBAL_CATALOG_AUTH_TYPE": "NOAuth", + } + + SetTestEnvironment(testEnvironment) + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1UsingExternalConfig(&globalcatalogv1.GlobalCatalogV1Options{ + URL: "{BAD_URL_STRING", + }) + + It(`Instantiate service client with error`, func() { + Expect(testService).To(BeNil()) + Expect(testServiceErr).ToNot(BeNil()) + ClearTestEnvironment(testEnvironment) + }) + }) + }) + Describe(`GetAuditLogs(getAuditLogsOptions *GetAuditLogsOptions) - Operation response error`, func() { + getAuditLogsPath := "/testString/logs" + 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.Path).To(Equal(getAuditLogsPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["account"]).To(Equal([]string{"testString"})) + + Expect(req.URL.Query()["ascending"]).To(Equal([]string{"testString"})) + + Expect(req.URL.Query()["startat"]).To(Equal([]string{"testString"})) + + Expect(req.URL.Query()["_offset"]).To(Equal([]string{fmt.Sprint(int64(38))})) + + Expect(req.URL.Query()["_limit"]).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 {`) + })) + }) + It(`Invoke GetAuditLogs with error: Operation response processing error`, func() { + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1(&globalcatalogv1.GlobalCatalogV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(testServiceErr).To(BeNil()) + Expect(testService).ToNot(BeNil()) + + // Construct an instance of the GetAuditLogsOptions model + getAuditLogsOptionsModel := new(globalcatalogv1.GetAuditLogsOptions) + getAuditLogsOptionsModel.ID = core.StringPtr("testString") + getAuditLogsOptionsModel.Account = core.StringPtr("testString") + getAuditLogsOptionsModel.Ascending = core.StringPtr("testString") + getAuditLogsOptionsModel.Startat = core.StringPtr("testString") + getAuditLogsOptionsModel.Offset = core.Int64Ptr(int64(38)) + getAuditLogsOptionsModel.Limit = core.Int64Ptr(int64(38)) + getAuditLogsOptionsModel.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 := testService.GetAuditLogs(getAuditLogsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + + Describe(`GetAuditLogs(getAuditLogsOptions *GetAuditLogsOptions)`, func() { + getAuditLogsPath := "/testString/logs" + 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.Path).To(Equal(getAuditLogsPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["account"]).To(Equal([]string{"testString"})) + + Expect(req.URL.Query()["ascending"]).To(Equal([]string{"testString"})) + + Expect(req.URL.Query()["startat"]).To(Equal([]string{"testString"})) + + Expect(req.URL.Query()["_offset"]).To(Equal([]string{fmt.Sprint(int64(38))})) + + Expect(req.URL.Query()["_limit"]).To(Equal([]string{fmt.Sprint(int64(38))})) + + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, `{"offset": 6, "limit": 5, "count": 5, "resource_count": 13, "first": "First", "last": "Last", "prev": "Prev", "next": "Next", "resources": [{"id": "ID", "effective": {"restrictions": "Restrictions", "owner": "Owner", "extendable": true, "include": {"accounts": {"_accountid_": "Accountid"}}, "exclude": {"accounts": {"_accountid_": "Accountid"}}, "approved": true}, "time": "2019-01-01T12:00:00", "who_id": "WhoID", "who_name": "WhoName", "who_email": "WhoEmail", "instance": "Instance", "gid": "Gid", "type": "Type", "message": "Message", "data": {"anyKey": "anyValue"}}]}`) + })) + }) + It(`Invoke GetAuditLogs successfully`, func() { + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1(&globalcatalogv1.GlobalCatalogV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(testServiceErr).To(BeNil()) + Expect(testService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := testService.GetAuditLogs(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetAuditLogsOptions model + getAuditLogsOptionsModel := new(globalcatalogv1.GetAuditLogsOptions) + getAuditLogsOptionsModel.ID = core.StringPtr("testString") + getAuditLogsOptionsModel.Account = core.StringPtr("testString") + getAuditLogsOptionsModel.Ascending = core.StringPtr("testString") + getAuditLogsOptionsModel.Startat = core.StringPtr("testString") + getAuditLogsOptionsModel.Offset = core.Int64Ptr(int64(38)) + getAuditLogsOptionsModel.Limit = core.Int64Ptr(int64(38)) + getAuditLogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = testService.GetAuditLogs(getAuditLogsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + }) + It(`Invoke GetAuditLogs with error: Operation validation and request error`, func() { + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1(&globalcatalogv1.GlobalCatalogV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(testServiceErr).To(BeNil()) + Expect(testService).ToNot(BeNil()) + + // Construct an instance of the GetAuditLogsOptions model + getAuditLogsOptionsModel := new(globalcatalogv1.GetAuditLogsOptions) + getAuditLogsOptionsModel.ID = core.StringPtr("testString") + getAuditLogsOptionsModel.Account = core.StringPtr("testString") + getAuditLogsOptionsModel.Ascending = core.StringPtr("testString") + getAuditLogsOptionsModel.Startat = core.StringPtr("testString") + getAuditLogsOptionsModel.Offset = core.Int64Ptr(int64(38)) + getAuditLogsOptionsModel.Limit = core.Int64Ptr(int64(38)) + getAuditLogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := testService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := testService.GetAuditLogs(getAuditLogsOptionsModel) + 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 GetAuditLogsOptions model with no property values + getAuditLogsOptionsModelNew := new(globalcatalogv1.GetAuditLogsOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = testService.GetAuditLogs(getAuditLogsOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`Service constructor tests`, func() { + It(`Instantiate service client`, func() { + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1(&globalcatalogv1.GlobalCatalogV1Options{ + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(testService).ToNot(BeNil()) + Expect(testServiceErr).To(BeNil()) + }) + It(`Instantiate service client with error: Invalid URL`, func() { + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1(&globalcatalogv1.GlobalCatalogV1Options{ + URL: "{BAD_URL_STRING", + }) + Expect(testService).To(BeNil()) + Expect(testServiceErr).ToNot(BeNil()) + }) + It(`Instantiate service client with error: Invalid Auth`, func() { + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1(&globalcatalogv1.GlobalCatalogV1Options{ + URL: "https://globalcatalogv1/api", + Authenticator: &core.BasicAuthenticator{ + Username: "", + Password: "", + }, + }) + Expect(testService).To(BeNil()) + Expect(testServiceErr).ToNot(BeNil()) + }) + }) + Describe(`Service constructor tests using external config`, func() { + Context(`Using external config, construct service client instances`, func() { + // Map containing environment variables used in testing. + var testEnvironment = map[string]string{ + "GLOBAL_CATALOG_URL": "https://globalcatalogv1/api", + "GLOBAL_CATALOG_AUTH_TYPE": "noauth", + } + + It(`Create service client using external config successfully`, func() { + SetTestEnvironment(testEnvironment) + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1UsingExternalConfig(&globalcatalogv1.GlobalCatalogV1Options{ + }) + Expect(testService).ToNot(BeNil()) + Expect(testServiceErr).To(BeNil()) + ClearTestEnvironment(testEnvironment) + }) + It(`Create service client using external config and set url from constructor successfully`, func() { + SetTestEnvironment(testEnvironment) + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1UsingExternalConfig(&globalcatalogv1.GlobalCatalogV1Options{ + URL: "https://testService/api", + }) + Expect(testService).ToNot(BeNil()) + Expect(testServiceErr).To(BeNil()) + Expect(testService.Service.GetServiceURL()).To(Equal("https://testService/api")) + ClearTestEnvironment(testEnvironment) + }) + It(`Create service client using external config and set url programatically successfully`, func() { + SetTestEnvironment(testEnvironment) + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1UsingExternalConfig(&globalcatalogv1.GlobalCatalogV1Options{ + }) + err := testService.SetServiceURL("https://testService/api") + Expect(err).To(BeNil()) + Expect(testService).ToNot(BeNil()) + Expect(testServiceErr).To(BeNil()) + Expect(testService.Service.GetServiceURL()).To(Equal("https://testService/api")) + ClearTestEnvironment(testEnvironment) + }) + }) + Context(`Using external config, construct service client instances with error: Invalid Auth`, func() { + // Map containing environment variables used in testing. + var testEnvironment = map[string]string{ + "GLOBAL_CATALOG_URL": "https://globalcatalogv1/api", + "GLOBAL_CATALOG_AUTH_TYPE": "someOtherAuth", + } + + SetTestEnvironment(testEnvironment) + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1UsingExternalConfig(&globalcatalogv1.GlobalCatalogV1Options{ + }) + + It(`Instantiate service client with error`, func() { + Expect(testService).To(BeNil()) + Expect(testServiceErr).ToNot(BeNil()) + ClearTestEnvironment(testEnvironment) + }) + }) + Context(`Using external config, construct service client instances with error: Invalid URL`, func() { + // Map containing environment variables used in testing. + var testEnvironment = map[string]string{ + "GLOBAL_CATALOG_AUTH_TYPE": "NOAuth", + } + + SetTestEnvironment(testEnvironment) + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1UsingExternalConfig(&globalcatalogv1.GlobalCatalogV1Options{ + URL: "{BAD_URL_STRING", + }) + + It(`Instantiate service client with error`, func() { + Expect(testService).To(BeNil()) + Expect(testServiceErr).ToNot(BeNil()) + ClearTestEnvironment(testEnvironment) + }) + }) + }) + Describe(`ListArtifacts(listArtifactsOptions *ListArtifactsOptions) - Operation response error`, func() { + listArtifactsPath := "/testString/artifacts" + 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.Path).To(Equal(listArtifactsPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["account"]).To(Equal([]string{"testString"})) + + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, `} this is not valid json {`) + })) + }) + It(`Invoke ListArtifacts with error: Operation response processing error`, func() { + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1(&globalcatalogv1.GlobalCatalogV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(testServiceErr).To(BeNil()) + Expect(testService).ToNot(BeNil()) + + // Construct an instance of the ListArtifactsOptions model + listArtifactsOptionsModel := new(globalcatalogv1.ListArtifactsOptions) + listArtifactsOptionsModel.ObjectID = core.StringPtr("testString") + listArtifactsOptionsModel.Account = core.StringPtr("testString") + listArtifactsOptionsModel.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 := testService.ListArtifacts(listArtifactsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + + Describe(`ListArtifacts(listArtifactsOptions *ListArtifactsOptions)`, func() { + listArtifactsPath := "/testString/artifacts" + 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.Path).To(Equal(listArtifactsPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["account"]).To(Equal([]string{"testString"})) + + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, `{"count": 5, "resources": [{"name": "Name", "updated": "2019-01-01T12:00:00", "url": "URL", "etag": "Etag", "size": 4}]}`) + })) + }) + It(`Invoke ListArtifacts successfully`, func() { + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1(&globalcatalogv1.GlobalCatalogV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(testServiceErr).To(BeNil()) + Expect(testService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := testService.ListArtifacts(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListArtifactsOptions model + listArtifactsOptionsModel := new(globalcatalogv1.ListArtifactsOptions) + listArtifactsOptionsModel.ObjectID = core.StringPtr("testString") + listArtifactsOptionsModel.Account = core.StringPtr("testString") + listArtifactsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = testService.ListArtifacts(listArtifactsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + }) + It(`Invoke ListArtifacts with error: Operation validation and request error`, func() { + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1(&globalcatalogv1.GlobalCatalogV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(testServiceErr).To(BeNil()) + Expect(testService).ToNot(BeNil()) + + // Construct an instance of the ListArtifactsOptions model + listArtifactsOptionsModel := new(globalcatalogv1.ListArtifactsOptions) + listArtifactsOptionsModel.ObjectID = core.StringPtr("testString") + listArtifactsOptionsModel.Account = core.StringPtr("testString") + listArtifactsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := testService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := testService.ListArtifacts(listArtifactsOptionsModel) + 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 ListArtifactsOptions model with no property values + listArtifactsOptionsModelNew := new(globalcatalogv1.ListArtifactsOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = testService.ListArtifacts(listArtifactsOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + + Describe(`GetArtifact(getArtifactOptions *GetArtifactOptions)`, func() { + getArtifactPath := "/testString/artifacts/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.Path).To(Equal(getArtifactPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.Header["Accept"]).ToNot(BeNil()) + Expect(req.Header["Accept"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["account"]).To(Equal([]string{"testString"})) + + res.Header().Set("Content-type", "*/*") + res.WriteHeader(200) + fmt.Fprintf(res, `Contents of response byte-stream...`) + })) + }) + It(`Invoke GetArtifact successfully`, func() { + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1(&globalcatalogv1.GlobalCatalogV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(testServiceErr).To(BeNil()) + Expect(testService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := testService.GetArtifact(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetArtifactOptions model + getArtifactOptionsModel := new(globalcatalogv1.GetArtifactOptions) + getArtifactOptionsModel.ObjectID = core.StringPtr("testString") + getArtifactOptionsModel.ArtifactID = core.StringPtr("testString") + getArtifactOptionsModel.Accept = core.StringPtr("testString") + getArtifactOptionsModel.Account = core.StringPtr("testString") + getArtifactOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = testService.GetArtifact(getArtifactOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + }) + It(`Invoke GetArtifact with error: Operation validation and request error`, func() { + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1(&globalcatalogv1.GlobalCatalogV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(testServiceErr).To(BeNil()) + Expect(testService).ToNot(BeNil()) + + // Construct an instance of the GetArtifactOptions model + getArtifactOptionsModel := new(globalcatalogv1.GetArtifactOptions) + getArtifactOptionsModel.ObjectID = core.StringPtr("testString") + getArtifactOptionsModel.ArtifactID = core.StringPtr("testString") + getArtifactOptionsModel.Accept = core.StringPtr("testString") + getArtifactOptionsModel.Account = core.StringPtr("testString") + getArtifactOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := testService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := testService.GetArtifact(getArtifactOptionsModel) + 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 GetArtifactOptions model with no property values + getArtifactOptionsModelNew := new(globalcatalogv1.GetArtifactOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = testService.GetArtifact(getArtifactOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + + Describe(`UploadArtifact(uploadArtifactOptions *UploadArtifactOptions)`, func() { + uploadArtifactPath := "/testString/artifacts/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.Path).To(Equal(uploadArtifactPath)) + Expect(req.Method).To(Equal("PUT")) + Expect(req.Header["Content-Type"]).ToNot(BeNil()) + Expect(req.Header["Content-Type"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["account"]).To(Equal([]string{"testString"})) + + res.WriteHeader(200) + })) + }) + It(`Invoke UploadArtifact successfully`, func() { + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1(&globalcatalogv1.GlobalCatalogV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(testServiceErr).To(BeNil()) + Expect(testService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + response, operationErr := testService.UploadArtifact(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the UploadArtifactOptions model + uploadArtifactOptionsModel := new(globalcatalogv1.UploadArtifactOptions) + uploadArtifactOptionsModel.ObjectID = core.StringPtr("testString") + uploadArtifactOptionsModel.ArtifactID = core.StringPtr("testString") + uploadArtifactOptionsModel.Artifact = CreateMockReader("This is a mock file.") + uploadArtifactOptionsModel.ContentType = core.StringPtr("testString") + uploadArtifactOptionsModel.Account = core.StringPtr("testString") + uploadArtifactOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = testService.UploadArtifact(uploadArtifactOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke UploadArtifact with error: Operation validation and request error`, func() { + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1(&globalcatalogv1.GlobalCatalogV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(testServiceErr).To(BeNil()) + Expect(testService).ToNot(BeNil()) + + // Construct an instance of the UploadArtifactOptions model + uploadArtifactOptionsModel := new(globalcatalogv1.UploadArtifactOptions) + uploadArtifactOptionsModel.ObjectID = core.StringPtr("testString") + uploadArtifactOptionsModel.ArtifactID = core.StringPtr("testString") + uploadArtifactOptionsModel.Artifact = CreateMockReader("This is a mock file.") + uploadArtifactOptionsModel.ContentType = core.StringPtr("testString") + uploadArtifactOptionsModel.Account = core.StringPtr("testString") + uploadArtifactOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := testService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := testService.UploadArtifact(uploadArtifactOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the UploadArtifactOptions model with no property values + uploadArtifactOptionsModelNew := new(globalcatalogv1.UploadArtifactOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = testService.UploadArtifact(uploadArtifactOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + + Describe(`DeleteArtifact(deleteArtifactOptions *DeleteArtifactOptions)`, func() { + deleteArtifactPath := "/testString/artifacts/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.Path).To(Equal(deleteArtifactPath)) + Expect(req.Method).To(Equal("DELETE")) + Expect(req.URL.Query()["account"]).To(Equal([]string{"testString"})) + + res.WriteHeader(200) + })) + }) + It(`Invoke DeleteArtifact successfully`, func() { + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1(&globalcatalogv1.GlobalCatalogV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(testServiceErr).To(BeNil()) + Expect(testService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + response, operationErr := testService.DeleteArtifact(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteArtifactOptions model + deleteArtifactOptionsModel := new(globalcatalogv1.DeleteArtifactOptions) + deleteArtifactOptionsModel.ObjectID = core.StringPtr("testString") + deleteArtifactOptionsModel.ArtifactID = core.StringPtr("testString") + deleteArtifactOptionsModel.Account = core.StringPtr("testString") + deleteArtifactOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = testService.DeleteArtifact(deleteArtifactOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteArtifact with error: Operation validation and request error`, func() { + testService, testServiceErr := globalcatalogv1.NewGlobalCatalogV1(&globalcatalogv1.GlobalCatalogV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(testServiceErr).To(BeNil()) + Expect(testService).ToNot(BeNil()) + + // Construct an instance of the DeleteArtifactOptions model + deleteArtifactOptionsModel := new(globalcatalogv1.DeleteArtifactOptions) + deleteArtifactOptionsModel.ObjectID = core.StringPtr("testString") + deleteArtifactOptionsModel.ArtifactID = core.StringPtr("testString") + deleteArtifactOptionsModel.Account = core.StringPtr("testString") + deleteArtifactOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := testService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := testService.DeleteArtifact(deleteArtifactOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteArtifactOptions model with no property values + deleteArtifactOptionsModelNew := new(globalcatalogv1.DeleteArtifactOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = testService.DeleteArtifact(deleteArtifactOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`Model constructor tests`, func() { + Context(`Using a service client instance`, func() { + testService, _ := globalcatalogv1.NewGlobalCatalogV1(&globalcatalogv1.GlobalCatalogV1Options{ + URL: "http://globalcatalogv1modelgenerator.com", + Authenticator: &core.NoAuthAuthenticator{}, + }) + It(`Invoke NewCreateCatalogEntryOptions successfully`, func() { + // Construct an instance of the Bullets model + bulletsModel := new(globalcatalogv1.Bullets) + Expect(bulletsModel).ToNot(BeNil()) + bulletsModel.Title = core.StringPtr("testString") + bulletsModel.Description = core.StringPtr("testString") + bulletsModel.Icon = core.StringPtr("testString") + bulletsModel.Quantity = core.Int64Ptr(int64(38)) + Expect(bulletsModel.Title).To(Equal(core.StringPtr("testString"))) + Expect(bulletsModel.Description).To(Equal(core.StringPtr("testString"))) + Expect(bulletsModel.Icon).To(Equal(core.StringPtr("testString"))) + Expect(bulletsModel.Quantity).To(Equal(core.Int64Ptr(int64(38)))) + + // Construct an instance of the Price model + priceModel := new(globalcatalogv1.Price) + Expect(priceModel).ToNot(BeNil()) + priceModel.QuantityTier = core.Int64Ptr(int64(38)) + priceModel.Price = core.Float64Ptr(72.5) + Expect(priceModel.QuantityTier).To(Equal(core.Int64Ptr(int64(38)))) + Expect(priceModel.Price).To(Equal(core.Float64Ptr(72.5))) + + // Construct an instance of the UIMetaMedia model + uiMetaMediaModel := new(globalcatalogv1.UIMetaMedia) + Expect(uiMetaMediaModel).ToNot(BeNil()) + uiMetaMediaModel.Caption = core.StringPtr("testString") + uiMetaMediaModel.ThumbnailURL = core.StringPtr("testString") + uiMetaMediaModel.Type = core.StringPtr("testString") + uiMetaMediaModel.URL = core.StringPtr("testString") + uiMetaMediaModel.Source = bulletsModel + Expect(uiMetaMediaModel.Caption).To(Equal(core.StringPtr("testString"))) + Expect(uiMetaMediaModel.ThumbnailURL).To(Equal(core.StringPtr("testString"))) + Expect(uiMetaMediaModel.Type).To(Equal(core.StringPtr("testString"))) + Expect(uiMetaMediaModel.URL).To(Equal(core.StringPtr("testString"))) + Expect(uiMetaMediaModel.Source).To(Equal(bulletsModel)) + + // Construct an instance of the Amount model + amountModel := new(globalcatalogv1.Amount) + Expect(amountModel).ToNot(BeNil()) + amountModel.Country = core.StringPtr("testString") + amountModel.Currency = core.StringPtr("testString") + amountModel.Prices = []globalcatalogv1.Price{*priceModel} + Expect(amountModel.Country).To(Equal(core.StringPtr("testString"))) + Expect(amountModel.Currency).To(Equal(core.StringPtr("testString"))) + Expect(amountModel.Prices).To(Equal([]globalcatalogv1.Price{*priceModel})) + + // Construct an instance of the Strings model + stringsModel := new(globalcatalogv1.Strings) + Expect(stringsModel).ToNot(BeNil()) + stringsModel.Bullets = []globalcatalogv1.Bullets{*bulletsModel} + stringsModel.Media = []globalcatalogv1.UIMetaMedia{*uiMetaMediaModel} + stringsModel.NotCreatableMsg = core.StringPtr("testString") + stringsModel.NotCreatableRobotMsg = core.StringPtr("testString") + stringsModel.DeprecationWarning = core.StringPtr("testString") + stringsModel.PopupWarningMessage = core.StringPtr("testString") + stringsModel.Instruction = core.StringPtr("testString") + Expect(stringsModel.Bullets).To(Equal([]globalcatalogv1.Bullets{*bulletsModel})) + Expect(stringsModel.Media).To(Equal([]globalcatalogv1.UIMetaMedia{*uiMetaMediaModel})) + Expect(stringsModel.NotCreatableMsg).To(Equal(core.StringPtr("testString"))) + Expect(stringsModel.NotCreatableRobotMsg).To(Equal(core.StringPtr("testString"))) + Expect(stringsModel.DeprecationWarning).To(Equal(core.StringPtr("testString"))) + Expect(stringsModel.PopupWarningMessage).To(Equal(core.StringPtr("testString"))) + Expect(stringsModel.Instruction).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the Broker model + brokerModel := new(globalcatalogv1.Broker) + Expect(brokerModel).ToNot(BeNil()) + brokerModel.Name = core.StringPtr("testString") + brokerModel.Guid = core.StringPtr("testString") + Expect(brokerModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(brokerModel.Guid).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the DRMetaData model + drMetaDataModel := new(globalcatalogv1.DRMetaData) + Expect(drMetaDataModel).ToNot(BeNil()) + drMetaDataModel.Dr = core.BoolPtr(true) + drMetaDataModel.Description = core.StringPtr("testString") + Expect(drMetaDataModel.Dr).To(Equal(core.BoolPtr(true))) + Expect(drMetaDataModel.Description).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the I18N model + i18NModel := new(globalcatalogv1.I18N) + Expect(i18NModel).ToNot(BeNil()) + i18NModel.SetProperty("foo", stringsModel) + Expect(i18NModel.GetProperty("foo")).To(Equal(stringsModel)) + Expect(i18NModel.GetProperties()).ToNot(BeEmpty()) + + // Construct an instance of the SourceMetaData model + sourceMetaDataModel := new(globalcatalogv1.SourceMetaData) + Expect(sourceMetaDataModel).ToNot(BeNil()) + sourceMetaDataModel.Path = core.StringPtr("testString") + sourceMetaDataModel.Type = core.StringPtr("testString") + sourceMetaDataModel.URL = core.StringPtr("testString") + Expect(sourceMetaDataModel.Path).To(Equal(core.StringPtr("testString"))) + Expect(sourceMetaDataModel.Type).To(Equal(core.StringPtr("testString"))) + Expect(sourceMetaDataModel.URL).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the StartingPrice model + startingPriceModel := new(globalcatalogv1.StartingPrice) + Expect(startingPriceModel).ToNot(BeNil()) + startingPriceModel.PlanID = core.StringPtr("testString") + startingPriceModel.DeploymentID = core.StringPtr("testString") + startingPriceModel.Unit = core.StringPtr("testString") + startingPriceModel.Amount = []globalcatalogv1.Amount{*amountModel} + Expect(startingPriceModel.PlanID).To(Equal(core.StringPtr("testString"))) + Expect(startingPriceModel.DeploymentID).To(Equal(core.StringPtr("testString"))) + Expect(startingPriceModel.Unit).To(Equal(core.StringPtr("testString"))) + Expect(startingPriceModel.Amount).To(Equal([]globalcatalogv1.Amount{*amountModel})) + + // Construct an instance of the URLS model + urlsModel := new(globalcatalogv1.URLS) + Expect(urlsModel).ToNot(BeNil()) + urlsModel.DocURL = core.StringPtr("testString") + urlsModel.InstructionsURL = core.StringPtr("testString") + urlsModel.ApiURL = core.StringPtr("testString") + urlsModel.CreateURL = core.StringPtr("testString") + urlsModel.SdkDownloadURL = core.StringPtr("testString") + urlsModel.TermsURL = core.StringPtr("testString") + urlsModel.CustomCreatePageURL = core.StringPtr("testString") + urlsModel.CatalogDetailsURL = core.StringPtr("testString") + urlsModel.DeprecationDocURL = core.StringPtr("testString") + urlsModel.DashboardURL = core.StringPtr("testString") + urlsModel.RegistrationURL = core.StringPtr("testString") + urlsModel.Apidocsurl = core.StringPtr("testString") + Expect(urlsModel.DocURL).To(Equal(core.StringPtr("testString"))) + Expect(urlsModel.InstructionsURL).To(Equal(core.StringPtr("testString"))) + Expect(urlsModel.ApiURL).To(Equal(core.StringPtr("testString"))) + Expect(urlsModel.CreateURL).To(Equal(core.StringPtr("testString"))) + Expect(urlsModel.SdkDownloadURL).To(Equal(core.StringPtr("testString"))) + Expect(urlsModel.TermsURL).To(Equal(core.StringPtr("testString"))) + Expect(urlsModel.CustomCreatePageURL).To(Equal(core.StringPtr("testString"))) + Expect(urlsModel.CatalogDetailsURL).To(Equal(core.StringPtr("testString"))) + Expect(urlsModel.DeprecationDocURL).To(Equal(core.StringPtr("testString"))) + Expect(urlsModel.DashboardURL).To(Equal(core.StringPtr("testString"))) + Expect(urlsModel.RegistrationURL).To(Equal(core.StringPtr("testString"))) + Expect(urlsModel.Apidocsurl).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the AliasMetaData model + aliasMetaDataModel := new(globalcatalogv1.AliasMetaData) + Expect(aliasMetaDataModel).ToNot(BeNil()) + aliasMetaDataModel.Type = core.StringPtr("testString") + aliasMetaDataModel.PlanID = core.StringPtr("testString") + Expect(aliasMetaDataModel.Type).To(Equal(core.StringPtr("testString"))) + Expect(aliasMetaDataModel.PlanID).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the CFMetaData model + cfMetaDataModel := new(globalcatalogv1.CFMetaData) + Expect(cfMetaDataModel).ToNot(BeNil()) + cfMetaDataModel.Type = core.StringPtr("testString") + cfMetaDataModel.IamCompatible = core.BoolPtr(true) + cfMetaDataModel.UniqueApiKey = core.BoolPtr(true) + cfMetaDataModel.Provisionable = core.BoolPtr(true) + cfMetaDataModel.Bindable = core.BoolPtr(true) + cfMetaDataModel.AsyncProvisioningSupported = core.BoolPtr(true) + cfMetaDataModel.AsyncUnprovisioningSupported = core.BoolPtr(true) + cfMetaDataModel.Requires = []string{"testString"} + cfMetaDataModel.PlanUpdateable = core.BoolPtr(true) + cfMetaDataModel.State = core.StringPtr("testString") + cfMetaDataModel.ServiceCheckEnabled = core.BoolPtr(true) + cfMetaDataModel.TestCheckInterval = core.Int64Ptr(int64(38)) + cfMetaDataModel.ServiceKeySupported = core.BoolPtr(true) + cfMetaDataModel.CfGuid = make(map[string]string) + Expect(cfMetaDataModel.Type).To(Equal(core.StringPtr("testString"))) + Expect(cfMetaDataModel.IamCompatible).To(Equal(core.BoolPtr(true))) + Expect(cfMetaDataModel.UniqueApiKey).To(Equal(core.BoolPtr(true))) + Expect(cfMetaDataModel.Provisionable).To(Equal(core.BoolPtr(true))) + Expect(cfMetaDataModel.Bindable).To(Equal(core.BoolPtr(true))) + Expect(cfMetaDataModel.AsyncProvisioningSupported).To(Equal(core.BoolPtr(true))) + Expect(cfMetaDataModel.AsyncUnprovisioningSupported).To(Equal(core.BoolPtr(true))) + Expect(cfMetaDataModel.Requires).To(Equal([]string{"testString"})) + Expect(cfMetaDataModel.PlanUpdateable).To(Equal(core.BoolPtr(true))) + Expect(cfMetaDataModel.State).To(Equal(core.StringPtr("testString"))) + Expect(cfMetaDataModel.ServiceCheckEnabled).To(Equal(core.BoolPtr(true))) + Expect(cfMetaDataModel.TestCheckInterval).To(Equal(core.Int64Ptr(int64(38)))) + Expect(cfMetaDataModel.ServiceKeySupported).To(Equal(core.BoolPtr(true))) + Expect(cfMetaDataModel.CfGuid).To(Equal(make(map[string]string))) + + // Construct an instance of the Callbacks model + callbacksModel := new(globalcatalogv1.Callbacks) + Expect(callbacksModel).ToNot(BeNil()) + callbacksModel.ControllerURL = core.StringPtr("testString") + callbacksModel.BrokerURL = core.StringPtr("testString") + callbacksModel.BrokerProxyURL = core.StringPtr("testString") + callbacksModel.DashboardURL = core.StringPtr("testString") + callbacksModel.DashboardDataURL = core.StringPtr("testString") + callbacksModel.DashboardDetailTabURL = core.StringPtr("testString") + callbacksModel.DashboardDetailTabExtURL = core.StringPtr("testString") + callbacksModel.ServiceMonitorApi = core.StringPtr("testString") + callbacksModel.ServiceMonitorApp = core.StringPtr("testString") + callbacksModel.ApiEndpoint = make(map[string]string) + Expect(callbacksModel.ControllerURL).To(Equal(core.StringPtr("testString"))) + Expect(callbacksModel.BrokerURL).To(Equal(core.StringPtr("testString"))) + Expect(callbacksModel.BrokerProxyURL).To(Equal(core.StringPtr("testString"))) + Expect(callbacksModel.DashboardURL).To(Equal(core.StringPtr("testString"))) + Expect(callbacksModel.DashboardDataURL).To(Equal(core.StringPtr("testString"))) + Expect(callbacksModel.DashboardDetailTabURL).To(Equal(core.StringPtr("testString"))) + Expect(callbacksModel.DashboardDetailTabExtURL).To(Equal(core.StringPtr("testString"))) + Expect(callbacksModel.ServiceMonitorApi).To(Equal(core.StringPtr("testString"))) + Expect(callbacksModel.ServiceMonitorApp).To(Equal(core.StringPtr("testString"))) + Expect(callbacksModel.ApiEndpoint).To(Equal(make(map[string]string))) + + // Construct an instance of the DeploymentBase model + deploymentBaseModel := new(globalcatalogv1.DeploymentBase) + Expect(deploymentBaseModel).ToNot(BeNil()) + deploymentBaseModel.Location = core.StringPtr("testString") + deploymentBaseModel.LocationURL = core.StringPtr("testString") + deploymentBaseModel.OriginalLocation = core.StringPtr("testString") + deploymentBaseModel.TargetCrn = core.StringPtr("testString") + deploymentBaseModel.ServiceCrn = core.StringPtr("testString") + deploymentBaseModel.MccpID = core.StringPtr("testString") + deploymentBaseModel.Broker = brokerModel + deploymentBaseModel.SupportsRcMigration = core.BoolPtr(true) + deploymentBaseModel.TargetNetwork = core.StringPtr("testString") + Expect(deploymentBaseModel.Location).To(Equal(core.StringPtr("testString"))) + Expect(deploymentBaseModel.LocationURL).To(Equal(core.StringPtr("testString"))) + Expect(deploymentBaseModel.OriginalLocation).To(Equal(core.StringPtr("testString"))) + Expect(deploymentBaseModel.TargetCrn).To(Equal(core.StringPtr("testString"))) + Expect(deploymentBaseModel.ServiceCrn).To(Equal(core.StringPtr("testString"))) + Expect(deploymentBaseModel.MccpID).To(Equal(core.StringPtr("testString"))) + Expect(deploymentBaseModel.Broker).To(Equal(brokerModel)) + Expect(deploymentBaseModel.SupportsRcMigration).To(Equal(core.BoolPtr(true))) + Expect(deploymentBaseModel.TargetNetwork).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the Overview model + overviewModel := new(globalcatalogv1.Overview) + Expect(overviewModel).ToNot(BeNil()) + overviewModel.DisplayName = core.StringPtr("testString") + overviewModel.LongDescription = core.StringPtr("testString") + overviewModel.Description = core.StringPtr("testString") + overviewModel.FeaturedDescription = core.StringPtr("testString") + Expect(overviewModel.DisplayName).To(Equal(core.StringPtr("testString"))) + Expect(overviewModel.LongDescription).To(Equal(core.StringPtr("testString"))) + Expect(overviewModel.Description).To(Equal(core.StringPtr("testString"))) + Expect(overviewModel.FeaturedDescription).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the PlanMetaData model + planMetaDataModel := new(globalcatalogv1.PlanMetaData) + Expect(planMetaDataModel).ToNot(BeNil()) + planMetaDataModel.Bindable = core.BoolPtr(true) + planMetaDataModel.Reservable = core.BoolPtr(true) + planMetaDataModel.AllowInternalUsers = core.BoolPtr(true) + planMetaDataModel.AsyncProvisioningSupported = core.BoolPtr(true) + planMetaDataModel.AsyncUnprovisioningSupported = core.BoolPtr(true) + planMetaDataModel.TestCheckInterval = core.Int64Ptr(int64(38)) + planMetaDataModel.SingleScopeInstance = core.StringPtr("testString") + planMetaDataModel.ServiceCheckEnabled = core.BoolPtr(true) + planMetaDataModel.CfGuid = make(map[string]string) + Expect(planMetaDataModel.Bindable).To(Equal(core.BoolPtr(true))) + Expect(planMetaDataModel.Reservable).To(Equal(core.BoolPtr(true))) + Expect(planMetaDataModel.AllowInternalUsers).To(Equal(core.BoolPtr(true))) + Expect(planMetaDataModel.AsyncProvisioningSupported).To(Equal(core.BoolPtr(true))) + Expect(planMetaDataModel.AsyncUnprovisioningSupported).To(Equal(core.BoolPtr(true))) + Expect(planMetaDataModel.TestCheckInterval).To(Equal(core.Int64Ptr(int64(38)))) + Expect(planMetaDataModel.SingleScopeInstance).To(Equal(core.StringPtr("testString"))) + Expect(planMetaDataModel.ServiceCheckEnabled).To(Equal(core.BoolPtr(true))) + Expect(planMetaDataModel.CfGuid).To(Equal(make(map[string]string))) + + // Construct an instance of the PricingSet model + pricingSetModel := new(globalcatalogv1.PricingSet) + Expect(pricingSetModel).ToNot(BeNil()) + pricingSetModel.Type = core.StringPtr("testString") + pricingSetModel.Origin = core.StringPtr("testString") + pricingSetModel.StartingPrice = startingPriceModel + Expect(pricingSetModel.Type).To(Equal(core.StringPtr("testString"))) + Expect(pricingSetModel.Origin).To(Equal(core.StringPtr("testString"))) + Expect(pricingSetModel.StartingPrice).To(Equal(startingPriceModel)) + + // Construct an instance of the SLAMetaData model + slaMetaDataModel := new(globalcatalogv1.SLAMetaData) + Expect(slaMetaDataModel).ToNot(BeNil()) + slaMetaDataModel.Terms = core.StringPtr("testString") + slaMetaDataModel.Tenancy = core.StringPtr("testString") + slaMetaDataModel.Provisioning = core.StringPtr("testString") + slaMetaDataModel.Responsiveness = core.StringPtr("testString") + slaMetaDataModel.Dr = drMetaDataModel + Expect(slaMetaDataModel.Terms).To(Equal(core.StringPtr("testString"))) + Expect(slaMetaDataModel.Tenancy).To(Equal(core.StringPtr("testString"))) + Expect(slaMetaDataModel.Provisioning).To(Equal(core.StringPtr("testString"))) + Expect(slaMetaDataModel.Responsiveness).To(Equal(core.StringPtr("testString"))) + Expect(slaMetaDataModel.Dr).To(Equal(drMetaDataModel)) + + // Construct an instance of the TemplateMetaData model + templateMetaDataModel := new(globalcatalogv1.TemplateMetaData) + Expect(templateMetaDataModel).ToNot(BeNil()) + templateMetaDataModel.Services = []string{"testString"} + templateMetaDataModel.DefaultMemory = core.Int64Ptr(int64(38)) + templateMetaDataModel.StartCmd = core.StringPtr("testString") + templateMetaDataModel.Source = sourceMetaDataModel + templateMetaDataModel.RuntimeCatalogID = core.StringPtr("testString") + templateMetaDataModel.CfRuntimeID = core.StringPtr("testString") + templateMetaDataModel.TemplateID = core.StringPtr("testString") + templateMetaDataModel.ExecutableFile = core.StringPtr("testString") + templateMetaDataModel.Buildpack = core.StringPtr("testString") + templateMetaDataModel.EnvironmentVariables = make(map[string]string) + Expect(templateMetaDataModel.Services).To(Equal([]string{"testString"})) + Expect(templateMetaDataModel.DefaultMemory).To(Equal(core.Int64Ptr(int64(38)))) + Expect(templateMetaDataModel.StartCmd).To(Equal(core.StringPtr("testString"))) + Expect(templateMetaDataModel.Source).To(Equal(sourceMetaDataModel)) + Expect(templateMetaDataModel.RuntimeCatalogID).To(Equal(core.StringPtr("testString"))) + Expect(templateMetaDataModel.CfRuntimeID).To(Equal(core.StringPtr("testString"))) + Expect(templateMetaDataModel.TemplateID).To(Equal(core.StringPtr("testString"))) + Expect(templateMetaDataModel.ExecutableFile).To(Equal(core.StringPtr("testString"))) + Expect(templateMetaDataModel.Buildpack).To(Equal(core.StringPtr("testString"))) + Expect(templateMetaDataModel.EnvironmentVariables).To(Equal(make(map[string]string))) + + // Construct an instance of the UIMetaData model + uiMetaDataModel := new(globalcatalogv1.UIMetaData) + Expect(uiMetaDataModel).ToNot(BeNil()) + uiMetaDataModel.Strings = i18NModel + uiMetaDataModel.Urls = urlsModel + uiMetaDataModel.EmbeddableDashboard = core.StringPtr("testString") + uiMetaDataModel.EmbeddableDashboardFullWidth = core.BoolPtr(true) + uiMetaDataModel.NavigationOrder = []string{"testString"} + uiMetaDataModel.NotCreatable = core.BoolPtr(true) + uiMetaDataModel.PrimaryOfferingID = core.StringPtr("testString") + uiMetaDataModel.AccessibleDuringProvision = core.BoolPtr(true) + uiMetaDataModel.SideBySideIndex = core.Int64Ptr(int64(38)) + uiMetaDataModel.EndOfServiceTime = CreateMockDateTime() + uiMetaDataModel.Hidden = core.BoolPtr(true) + uiMetaDataModel.HideLiteMetering = core.BoolPtr(true) + uiMetaDataModel.NoUpgradeNextStep = core.BoolPtr(true) + Expect(uiMetaDataModel.Strings).To(Equal(i18NModel)) + Expect(uiMetaDataModel.Urls).To(Equal(urlsModel)) + Expect(uiMetaDataModel.EmbeddableDashboard).To(Equal(core.StringPtr("testString"))) + Expect(uiMetaDataModel.EmbeddableDashboardFullWidth).To(Equal(core.BoolPtr(true))) + Expect(uiMetaDataModel.NavigationOrder).To(Equal([]string{"testString"})) + Expect(uiMetaDataModel.NotCreatable).To(Equal(core.BoolPtr(true))) + Expect(uiMetaDataModel.PrimaryOfferingID).To(Equal(core.StringPtr("testString"))) + Expect(uiMetaDataModel.AccessibleDuringProvision).To(Equal(core.BoolPtr(true))) + Expect(uiMetaDataModel.SideBySideIndex).To(Equal(core.Int64Ptr(int64(38)))) + Expect(uiMetaDataModel.EndOfServiceTime).To(Equal(CreateMockDateTime())) + Expect(uiMetaDataModel.Hidden).To(Equal(core.BoolPtr(true))) + Expect(uiMetaDataModel.HideLiteMetering).To(Equal(core.BoolPtr(true))) + Expect(uiMetaDataModel.NoUpgradeNextStep).To(Equal(core.BoolPtr(true))) + + // Construct an instance of the Image model + imageModel := new(globalcatalogv1.Image) + Expect(imageModel).ToNot(BeNil()) + imageModel.Image = core.StringPtr("testString") + imageModel.SmallImage = core.StringPtr("testString") + imageModel.MediumImage = core.StringPtr("testString") + imageModel.FeatureImage = core.StringPtr("testString") + Expect(imageModel.Image).To(Equal(core.StringPtr("testString"))) + Expect(imageModel.SmallImage).To(Equal(core.StringPtr("testString"))) + Expect(imageModel.MediumImage).To(Equal(core.StringPtr("testString"))) + Expect(imageModel.FeatureImage).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the ObjectMetadataSet model + objectMetadataSetModel := new(globalcatalogv1.ObjectMetadataSet) + Expect(objectMetadataSetModel).ToNot(BeNil()) + objectMetadataSetModel.RcCompatible = core.BoolPtr(true) + objectMetadataSetModel.Service = cfMetaDataModel + objectMetadataSetModel.Plan = planMetaDataModel + objectMetadataSetModel.Alias = aliasMetaDataModel + objectMetadataSetModel.Template = templateMetaDataModel + objectMetadataSetModel.Ui = uiMetaDataModel + objectMetadataSetModel.Compliance = []string{"testString"} + objectMetadataSetModel.Sla = slaMetaDataModel + objectMetadataSetModel.Callbacks = callbacksModel + objectMetadataSetModel.OriginalName = core.StringPtr("testString") + objectMetadataSetModel.Version = core.StringPtr("testString") + objectMetadataSetModel.Other = make(map[string]interface{}) + objectMetadataSetModel.Pricing = pricingSetModel + objectMetadataSetModel.Deployment = deploymentBaseModel + Expect(objectMetadataSetModel.RcCompatible).To(Equal(core.BoolPtr(true))) + Expect(objectMetadataSetModel.Service).To(Equal(cfMetaDataModel)) + Expect(objectMetadataSetModel.Plan).To(Equal(planMetaDataModel)) + Expect(objectMetadataSetModel.Alias).To(Equal(aliasMetaDataModel)) + Expect(objectMetadataSetModel.Template).To(Equal(templateMetaDataModel)) + Expect(objectMetadataSetModel.Ui).To(Equal(uiMetaDataModel)) + Expect(objectMetadataSetModel.Compliance).To(Equal([]string{"testString"})) + Expect(objectMetadataSetModel.Sla).To(Equal(slaMetaDataModel)) + Expect(objectMetadataSetModel.Callbacks).To(Equal(callbacksModel)) + Expect(objectMetadataSetModel.OriginalName).To(Equal(core.StringPtr("testString"))) + Expect(objectMetadataSetModel.Version).To(Equal(core.StringPtr("testString"))) + Expect(objectMetadataSetModel.Other).To(Equal(make(map[string]interface{}))) + Expect(objectMetadataSetModel.Pricing).To(Equal(pricingSetModel)) + Expect(objectMetadataSetModel.Deployment).To(Equal(deploymentBaseModel)) + + // Construct an instance of the OverviewUI model + overviewUiModel := new(globalcatalogv1.OverviewUI) + Expect(overviewUiModel).ToNot(BeNil()) + overviewUiModel.SetProperty("foo", overviewModel) + Expect(overviewUiModel.GetProperty("foo")).To(Equal(overviewModel)) + Expect(overviewUiModel.GetProperties()).ToNot(BeEmpty()) + + // Construct an instance of the Provider model + providerModel := new(globalcatalogv1.Provider) + Expect(providerModel).ToNot(BeNil()) + providerModel.Email = core.StringPtr("testString") + providerModel.Name = core.StringPtr("testString") + providerModel.Contact = core.StringPtr("testString") + providerModel.SupportEmail = core.StringPtr("testString") + providerModel.Phone = core.StringPtr("testString") + Expect(providerModel.Email).To(Equal(core.StringPtr("testString"))) + Expect(providerModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(providerModel.Contact).To(Equal(core.StringPtr("testString"))) + Expect(providerModel.SupportEmail).To(Equal(core.StringPtr("testString"))) + Expect(providerModel.Phone).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the CreateCatalogEntryOptions model + createCatalogEntryOptionsName := "testString" + createCatalogEntryOptionsKind := "service" + var createCatalogEntryOptionsOverviewUi *globalcatalogv1.OverviewUI = nil + var createCatalogEntryOptionsImages *globalcatalogv1.Image = nil + createCatalogEntryOptionsDisabled := true + createCatalogEntryOptionsTags := []string{"testString"} + var createCatalogEntryOptionsProvider *globalcatalogv1.Provider = nil + createCatalogEntryOptionsID := "testString" + createCatalogEntryOptionsModel := testService.NewCreateCatalogEntryOptions(createCatalogEntryOptionsName, createCatalogEntryOptionsKind, createCatalogEntryOptionsOverviewUi, createCatalogEntryOptionsImages, createCatalogEntryOptionsDisabled, createCatalogEntryOptionsTags, createCatalogEntryOptionsProvider, createCatalogEntryOptionsID) + createCatalogEntryOptionsModel.SetName("testString") + createCatalogEntryOptionsModel.SetKind("service") + createCatalogEntryOptionsModel.SetOverviewUi(overviewUiModel) + createCatalogEntryOptionsModel.SetImages(imageModel) + createCatalogEntryOptionsModel.SetDisabled(true) + createCatalogEntryOptionsModel.SetTags([]string{"testString"}) + createCatalogEntryOptionsModel.SetProvider(providerModel) + createCatalogEntryOptionsModel.SetID("testString") + createCatalogEntryOptionsModel.SetParentID("testString") + createCatalogEntryOptionsModel.SetGroup(true) + createCatalogEntryOptionsModel.SetActive(true) + createCatalogEntryOptionsModel.SetMetadata(objectMetadataSetModel) + createCatalogEntryOptionsModel.SetAccount("testString") + createCatalogEntryOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createCatalogEntryOptionsModel).ToNot(BeNil()) + Expect(createCatalogEntryOptionsModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(createCatalogEntryOptionsModel.Kind).To(Equal(core.StringPtr("service"))) + Expect(createCatalogEntryOptionsModel.OverviewUi).To(Equal(overviewUiModel)) + Expect(createCatalogEntryOptionsModel.Images).To(Equal(imageModel)) + Expect(createCatalogEntryOptionsModel.Disabled).To(Equal(core.BoolPtr(true))) + Expect(createCatalogEntryOptionsModel.Tags).To(Equal([]string{"testString"})) + Expect(createCatalogEntryOptionsModel.Provider).To(Equal(providerModel)) + Expect(createCatalogEntryOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(createCatalogEntryOptionsModel.ParentID).To(Equal(core.StringPtr("testString"))) + Expect(createCatalogEntryOptionsModel.Group).To(Equal(core.BoolPtr(true))) + Expect(createCatalogEntryOptionsModel.Active).To(Equal(core.BoolPtr(true))) + Expect(createCatalogEntryOptionsModel.Metadata).To(Equal(objectMetadataSetModel)) + Expect(createCatalogEntryOptionsModel.Account).To(Equal(core.StringPtr("testString"))) + Expect(createCatalogEntryOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeleteArtifactOptions successfully`, func() { + // Construct an instance of the DeleteArtifactOptions model + objectID := "testString" + artifactID := "testString" + deleteArtifactOptionsModel := testService.NewDeleteArtifactOptions(objectID, artifactID) + deleteArtifactOptionsModel.SetObjectID("testString") + deleteArtifactOptionsModel.SetArtifactID("testString") + deleteArtifactOptionsModel.SetAccount("testString") + deleteArtifactOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteArtifactOptionsModel).ToNot(BeNil()) + Expect(deleteArtifactOptionsModel.ObjectID).To(Equal(core.StringPtr("testString"))) + Expect(deleteArtifactOptionsModel.ArtifactID).To(Equal(core.StringPtr("testString"))) + Expect(deleteArtifactOptionsModel.Account).To(Equal(core.StringPtr("testString"))) + Expect(deleteArtifactOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeleteCatalogEntryOptions successfully`, func() { + // Construct an instance of the DeleteCatalogEntryOptions model + id := "testString" + deleteCatalogEntryOptionsModel := testService.NewDeleteCatalogEntryOptions(id) + deleteCatalogEntryOptionsModel.SetID("testString") + deleteCatalogEntryOptionsModel.SetAccount("testString") + deleteCatalogEntryOptionsModel.SetForce(true) + deleteCatalogEntryOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteCatalogEntryOptionsModel).ToNot(BeNil()) + Expect(deleteCatalogEntryOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteCatalogEntryOptionsModel.Account).To(Equal(core.StringPtr("testString"))) + Expect(deleteCatalogEntryOptionsModel.Force).To(Equal(core.BoolPtr(true))) + Expect(deleteCatalogEntryOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetArtifactOptions successfully`, func() { + // Construct an instance of the GetArtifactOptions model + objectID := "testString" + artifactID := "testString" + getArtifactOptionsModel := testService.NewGetArtifactOptions(objectID, artifactID) + getArtifactOptionsModel.SetObjectID("testString") + getArtifactOptionsModel.SetArtifactID("testString") + getArtifactOptionsModel.SetAccept("testString") + getArtifactOptionsModel.SetAccount("testString") + getArtifactOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getArtifactOptionsModel).ToNot(BeNil()) + Expect(getArtifactOptionsModel.ObjectID).To(Equal(core.StringPtr("testString"))) + Expect(getArtifactOptionsModel.ArtifactID).To(Equal(core.StringPtr("testString"))) + Expect(getArtifactOptionsModel.Accept).To(Equal(core.StringPtr("testString"))) + Expect(getArtifactOptionsModel.Account).To(Equal(core.StringPtr("testString"))) + Expect(getArtifactOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetAuditLogsOptions successfully`, func() { + // Construct an instance of the GetAuditLogsOptions model + id := "testString" + getAuditLogsOptionsModel := testService.NewGetAuditLogsOptions(id) + getAuditLogsOptionsModel.SetID("testString") + getAuditLogsOptionsModel.SetAccount("testString") + getAuditLogsOptionsModel.SetAscending("testString") + getAuditLogsOptionsModel.SetStartat("testString") + getAuditLogsOptionsModel.SetOffset(int64(38)) + getAuditLogsOptionsModel.SetLimit(int64(38)) + getAuditLogsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getAuditLogsOptionsModel).ToNot(BeNil()) + Expect(getAuditLogsOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getAuditLogsOptionsModel.Account).To(Equal(core.StringPtr("testString"))) + Expect(getAuditLogsOptionsModel.Ascending).To(Equal(core.StringPtr("testString"))) + Expect(getAuditLogsOptionsModel.Startat).To(Equal(core.StringPtr("testString"))) + Expect(getAuditLogsOptionsModel.Offset).To(Equal(core.Int64Ptr(int64(38)))) + Expect(getAuditLogsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(38)))) + Expect(getAuditLogsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetCatalogEntryOptions successfully`, func() { + // Construct an instance of the GetCatalogEntryOptions model + id := "testString" + getCatalogEntryOptionsModel := testService.NewGetCatalogEntryOptions(id) + getCatalogEntryOptionsModel.SetID("testString") + getCatalogEntryOptionsModel.SetAccount("testString") + getCatalogEntryOptionsModel.SetInclude("testString") + getCatalogEntryOptionsModel.SetLanguages("testString") + getCatalogEntryOptionsModel.SetComplete("testString") + getCatalogEntryOptionsModel.SetDepth(int64(38)) + getCatalogEntryOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getCatalogEntryOptionsModel).ToNot(BeNil()) + Expect(getCatalogEntryOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getCatalogEntryOptionsModel.Account).To(Equal(core.StringPtr("testString"))) + Expect(getCatalogEntryOptionsModel.Include).To(Equal(core.StringPtr("testString"))) + Expect(getCatalogEntryOptionsModel.Languages).To(Equal(core.StringPtr("testString"))) + Expect(getCatalogEntryOptionsModel.Complete).To(Equal(core.StringPtr("testString"))) + Expect(getCatalogEntryOptionsModel.Depth).To(Equal(core.Int64Ptr(int64(38)))) + Expect(getCatalogEntryOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetChildObjectsOptions successfully`, func() { + // Construct an instance of the GetChildObjectsOptions model + id := "testString" + kind := "testString" + getChildObjectsOptionsModel := testService.NewGetChildObjectsOptions(id, kind) + getChildObjectsOptionsModel.SetID("testString") + getChildObjectsOptionsModel.SetKind("testString") + getChildObjectsOptionsModel.SetAccount("testString") + getChildObjectsOptionsModel.SetInclude("testString") + getChildObjectsOptionsModel.SetQ("testString") + getChildObjectsOptionsModel.SetSortBy("testString") + getChildObjectsOptionsModel.SetDescending("testString") + getChildObjectsOptionsModel.SetLanguages("testString") + getChildObjectsOptionsModel.SetComplete("testString") + getChildObjectsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getChildObjectsOptionsModel).ToNot(BeNil()) + Expect(getChildObjectsOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getChildObjectsOptionsModel.Kind).To(Equal(core.StringPtr("testString"))) + Expect(getChildObjectsOptionsModel.Account).To(Equal(core.StringPtr("testString"))) + Expect(getChildObjectsOptionsModel.Include).To(Equal(core.StringPtr("testString"))) + Expect(getChildObjectsOptionsModel.Q).To(Equal(core.StringPtr("testString"))) + Expect(getChildObjectsOptionsModel.SortBy).To(Equal(core.StringPtr("testString"))) + Expect(getChildObjectsOptionsModel.Descending).To(Equal(core.StringPtr("testString"))) + Expect(getChildObjectsOptionsModel.Languages).To(Equal(core.StringPtr("testString"))) + Expect(getChildObjectsOptionsModel.Complete).To(Equal(core.StringPtr("testString"))) + Expect(getChildObjectsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetPricingOptions successfully`, func() { + // Construct an instance of the GetPricingOptions model + id := "testString" + getPricingOptionsModel := testService.NewGetPricingOptions(id) + getPricingOptionsModel.SetID("testString") + getPricingOptionsModel.SetAccount("testString") + getPricingOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getPricingOptionsModel).ToNot(BeNil()) + Expect(getPricingOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getPricingOptionsModel.Account).To(Equal(core.StringPtr("testString"))) + Expect(getPricingOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetVisibilityOptions successfully`, func() { + // Construct an instance of the GetVisibilityOptions model + id := "testString" + getVisibilityOptionsModel := testService.NewGetVisibilityOptions(id) + getVisibilityOptionsModel.SetID("testString") + getVisibilityOptionsModel.SetAccount("testString") + getVisibilityOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getVisibilityOptionsModel).ToNot(BeNil()) + Expect(getVisibilityOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getVisibilityOptionsModel.Account).To(Equal(core.StringPtr("testString"))) + Expect(getVisibilityOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewImage successfully`, func() { + image := "testString" + model, err := testService.NewImage(image) + Expect(model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewListArtifactsOptions successfully`, func() { + // Construct an instance of the ListArtifactsOptions model + objectID := "testString" + listArtifactsOptionsModel := testService.NewListArtifactsOptions(objectID) + listArtifactsOptionsModel.SetObjectID("testString") + listArtifactsOptionsModel.SetAccount("testString") + listArtifactsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listArtifactsOptionsModel).ToNot(BeNil()) + Expect(listArtifactsOptionsModel.ObjectID).To(Equal(core.StringPtr("testString"))) + Expect(listArtifactsOptionsModel.Account).To(Equal(core.StringPtr("testString"))) + Expect(listArtifactsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListCatalogEntriesOptions successfully`, func() { + // Construct an instance of the ListCatalogEntriesOptions model + listCatalogEntriesOptionsModel := testService.NewListCatalogEntriesOptions() + listCatalogEntriesOptionsModel.SetAccount("testString") + listCatalogEntriesOptionsModel.SetInclude("testString") + listCatalogEntriesOptionsModel.SetQ("testString") + listCatalogEntriesOptionsModel.SetSortBy("testString") + listCatalogEntriesOptionsModel.SetDescending("testString") + listCatalogEntriesOptionsModel.SetLanguages("testString") + listCatalogEntriesOptionsModel.SetComplete("testString") + listCatalogEntriesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listCatalogEntriesOptionsModel).ToNot(BeNil()) + Expect(listCatalogEntriesOptionsModel.Account).To(Equal(core.StringPtr("testString"))) + Expect(listCatalogEntriesOptionsModel.Include).To(Equal(core.StringPtr("testString"))) + Expect(listCatalogEntriesOptionsModel.Q).To(Equal(core.StringPtr("testString"))) + Expect(listCatalogEntriesOptionsModel.SortBy).To(Equal(core.StringPtr("testString"))) + Expect(listCatalogEntriesOptionsModel.Descending).To(Equal(core.StringPtr("testString"))) + Expect(listCatalogEntriesOptionsModel.Languages).To(Equal(core.StringPtr("testString"))) + Expect(listCatalogEntriesOptionsModel.Complete).To(Equal(core.StringPtr("testString"))) + Expect(listCatalogEntriesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewOverview successfully`, func() { + displayName := "testString" + longDescription := "testString" + description := "testString" + model, err := testService.NewOverview(displayName, longDescription, description) + Expect(model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewProvider successfully`, func() { + email := "testString" + name := "testString" + model, err := testService.NewProvider(email, name) + Expect(model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewRestoreCatalogEntryOptions successfully`, func() { + // Construct an instance of the RestoreCatalogEntryOptions model + id := "testString" + restoreCatalogEntryOptionsModel := testService.NewRestoreCatalogEntryOptions(id) + restoreCatalogEntryOptionsModel.SetID("testString") + restoreCatalogEntryOptionsModel.SetAccount("testString") + restoreCatalogEntryOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(restoreCatalogEntryOptionsModel).ToNot(BeNil()) + Expect(restoreCatalogEntryOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(restoreCatalogEntryOptionsModel.Account).To(Equal(core.StringPtr("testString"))) + Expect(restoreCatalogEntryOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewUpdateCatalogEntryOptions successfully`, func() { + // Construct an instance of the Bullets model + bulletsModel := new(globalcatalogv1.Bullets) + Expect(bulletsModel).ToNot(BeNil()) + bulletsModel.Title = core.StringPtr("testString") + bulletsModel.Description = core.StringPtr("testString") + bulletsModel.Icon = core.StringPtr("testString") + bulletsModel.Quantity = core.Int64Ptr(int64(38)) + Expect(bulletsModel.Title).To(Equal(core.StringPtr("testString"))) + Expect(bulletsModel.Description).To(Equal(core.StringPtr("testString"))) + Expect(bulletsModel.Icon).To(Equal(core.StringPtr("testString"))) + Expect(bulletsModel.Quantity).To(Equal(core.Int64Ptr(int64(38)))) + + // Construct an instance of the Price model + priceModel := new(globalcatalogv1.Price) + Expect(priceModel).ToNot(BeNil()) + priceModel.QuantityTier = core.Int64Ptr(int64(38)) + priceModel.Price = core.Float64Ptr(72.5) + Expect(priceModel.QuantityTier).To(Equal(core.Int64Ptr(int64(38)))) + Expect(priceModel.Price).To(Equal(core.Float64Ptr(72.5))) + + // Construct an instance of the UIMetaMedia model + uiMetaMediaModel := new(globalcatalogv1.UIMetaMedia) + Expect(uiMetaMediaModel).ToNot(BeNil()) + uiMetaMediaModel.Caption = core.StringPtr("testString") + uiMetaMediaModel.ThumbnailURL = core.StringPtr("testString") + uiMetaMediaModel.Type = core.StringPtr("testString") + uiMetaMediaModel.URL = core.StringPtr("testString") + uiMetaMediaModel.Source = bulletsModel + Expect(uiMetaMediaModel.Caption).To(Equal(core.StringPtr("testString"))) + Expect(uiMetaMediaModel.ThumbnailURL).To(Equal(core.StringPtr("testString"))) + Expect(uiMetaMediaModel.Type).To(Equal(core.StringPtr("testString"))) + Expect(uiMetaMediaModel.URL).To(Equal(core.StringPtr("testString"))) + Expect(uiMetaMediaModel.Source).To(Equal(bulletsModel)) + + // Construct an instance of the Amount model + amountModel := new(globalcatalogv1.Amount) + Expect(amountModel).ToNot(BeNil()) + amountModel.Country = core.StringPtr("testString") + amountModel.Currency = core.StringPtr("testString") + amountModel.Prices = []globalcatalogv1.Price{*priceModel} + Expect(amountModel.Country).To(Equal(core.StringPtr("testString"))) + Expect(amountModel.Currency).To(Equal(core.StringPtr("testString"))) + Expect(amountModel.Prices).To(Equal([]globalcatalogv1.Price{*priceModel})) + + // Construct an instance of the Strings model + stringsModel := new(globalcatalogv1.Strings) + Expect(stringsModel).ToNot(BeNil()) + stringsModel.Bullets = []globalcatalogv1.Bullets{*bulletsModel} + stringsModel.Media = []globalcatalogv1.UIMetaMedia{*uiMetaMediaModel} + stringsModel.NotCreatableMsg = core.StringPtr("testString") + stringsModel.NotCreatableRobotMsg = core.StringPtr("testString") + stringsModel.DeprecationWarning = core.StringPtr("testString") + stringsModel.PopupWarningMessage = core.StringPtr("testString") + stringsModel.Instruction = core.StringPtr("testString") + Expect(stringsModel.Bullets).To(Equal([]globalcatalogv1.Bullets{*bulletsModel})) + Expect(stringsModel.Media).To(Equal([]globalcatalogv1.UIMetaMedia{*uiMetaMediaModel})) + Expect(stringsModel.NotCreatableMsg).To(Equal(core.StringPtr("testString"))) + Expect(stringsModel.NotCreatableRobotMsg).To(Equal(core.StringPtr("testString"))) + Expect(stringsModel.DeprecationWarning).To(Equal(core.StringPtr("testString"))) + Expect(stringsModel.PopupWarningMessage).To(Equal(core.StringPtr("testString"))) + Expect(stringsModel.Instruction).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the Broker model + brokerModel := new(globalcatalogv1.Broker) + Expect(brokerModel).ToNot(BeNil()) + brokerModel.Name = core.StringPtr("testString") + brokerModel.Guid = core.StringPtr("testString") + Expect(brokerModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(brokerModel.Guid).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the DRMetaData model + drMetaDataModel := new(globalcatalogv1.DRMetaData) + Expect(drMetaDataModel).ToNot(BeNil()) + drMetaDataModel.Dr = core.BoolPtr(true) + drMetaDataModel.Description = core.StringPtr("testString") + Expect(drMetaDataModel.Dr).To(Equal(core.BoolPtr(true))) + Expect(drMetaDataModel.Description).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the I18N model + i18NModel := new(globalcatalogv1.I18N) + Expect(i18NModel).ToNot(BeNil()) + i18NModel.SetProperty("foo", stringsModel) + Expect(i18NModel.GetProperty("foo")).To(Equal(stringsModel)) + Expect(i18NModel.GetProperties()).ToNot(BeEmpty()) + + // Construct an instance of the SourceMetaData model + sourceMetaDataModel := new(globalcatalogv1.SourceMetaData) + Expect(sourceMetaDataModel).ToNot(BeNil()) + sourceMetaDataModel.Path = core.StringPtr("testString") + sourceMetaDataModel.Type = core.StringPtr("testString") + sourceMetaDataModel.URL = core.StringPtr("testString") + Expect(sourceMetaDataModel.Path).To(Equal(core.StringPtr("testString"))) + Expect(sourceMetaDataModel.Type).To(Equal(core.StringPtr("testString"))) + Expect(sourceMetaDataModel.URL).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the StartingPrice model + startingPriceModel := new(globalcatalogv1.StartingPrice) + Expect(startingPriceModel).ToNot(BeNil()) + startingPriceModel.PlanID = core.StringPtr("testString") + startingPriceModel.DeploymentID = core.StringPtr("testString") + startingPriceModel.Unit = core.StringPtr("testString") + startingPriceModel.Amount = []globalcatalogv1.Amount{*amountModel} + Expect(startingPriceModel.PlanID).To(Equal(core.StringPtr("testString"))) + Expect(startingPriceModel.DeploymentID).To(Equal(core.StringPtr("testString"))) + Expect(startingPriceModel.Unit).To(Equal(core.StringPtr("testString"))) + Expect(startingPriceModel.Amount).To(Equal([]globalcatalogv1.Amount{*amountModel})) + + // Construct an instance of the URLS model + urlsModel := new(globalcatalogv1.URLS) + Expect(urlsModel).ToNot(BeNil()) + urlsModel.DocURL = core.StringPtr("testString") + urlsModel.InstructionsURL = core.StringPtr("testString") + urlsModel.ApiURL = core.StringPtr("testString") + urlsModel.CreateURL = core.StringPtr("testString") + urlsModel.SdkDownloadURL = core.StringPtr("testString") + urlsModel.TermsURL = core.StringPtr("testString") + urlsModel.CustomCreatePageURL = core.StringPtr("testString") + urlsModel.CatalogDetailsURL = core.StringPtr("testString") + urlsModel.DeprecationDocURL = core.StringPtr("testString") + urlsModel.DashboardURL = core.StringPtr("testString") + urlsModel.RegistrationURL = core.StringPtr("testString") + urlsModel.Apidocsurl = core.StringPtr("testString") + Expect(urlsModel.DocURL).To(Equal(core.StringPtr("testString"))) + Expect(urlsModel.InstructionsURL).To(Equal(core.StringPtr("testString"))) + Expect(urlsModel.ApiURL).To(Equal(core.StringPtr("testString"))) + Expect(urlsModel.CreateURL).To(Equal(core.StringPtr("testString"))) + Expect(urlsModel.SdkDownloadURL).To(Equal(core.StringPtr("testString"))) + Expect(urlsModel.TermsURL).To(Equal(core.StringPtr("testString"))) + Expect(urlsModel.CustomCreatePageURL).To(Equal(core.StringPtr("testString"))) + Expect(urlsModel.CatalogDetailsURL).To(Equal(core.StringPtr("testString"))) + Expect(urlsModel.DeprecationDocURL).To(Equal(core.StringPtr("testString"))) + Expect(urlsModel.DashboardURL).To(Equal(core.StringPtr("testString"))) + Expect(urlsModel.RegistrationURL).To(Equal(core.StringPtr("testString"))) + Expect(urlsModel.Apidocsurl).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the AliasMetaData model + aliasMetaDataModel := new(globalcatalogv1.AliasMetaData) + Expect(aliasMetaDataModel).ToNot(BeNil()) + aliasMetaDataModel.Type = core.StringPtr("testString") + aliasMetaDataModel.PlanID = core.StringPtr("testString") + Expect(aliasMetaDataModel.Type).To(Equal(core.StringPtr("testString"))) + Expect(aliasMetaDataModel.PlanID).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the CFMetaData model + cfMetaDataModel := new(globalcatalogv1.CFMetaData) + Expect(cfMetaDataModel).ToNot(BeNil()) + cfMetaDataModel.Type = core.StringPtr("testString") + cfMetaDataModel.IamCompatible = core.BoolPtr(true) + cfMetaDataModel.UniqueApiKey = core.BoolPtr(true) + cfMetaDataModel.Provisionable = core.BoolPtr(true) + cfMetaDataModel.Bindable = core.BoolPtr(true) + cfMetaDataModel.AsyncProvisioningSupported = core.BoolPtr(true) + cfMetaDataModel.AsyncUnprovisioningSupported = core.BoolPtr(true) + cfMetaDataModel.Requires = []string{"testString"} + cfMetaDataModel.PlanUpdateable = core.BoolPtr(true) + cfMetaDataModel.State = core.StringPtr("testString") + cfMetaDataModel.ServiceCheckEnabled = core.BoolPtr(true) + cfMetaDataModel.TestCheckInterval = core.Int64Ptr(int64(38)) + cfMetaDataModel.ServiceKeySupported = core.BoolPtr(true) + cfMetaDataModel.CfGuid = make(map[string]string) + Expect(cfMetaDataModel.Type).To(Equal(core.StringPtr("testString"))) + Expect(cfMetaDataModel.IamCompatible).To(Equal(core.BoolPtr(true))) + Expect(cfMetaDataModel.UniqueApiKey).To(Equal(core.BoolPtr(true))) + Expect(cfMetaDataModel.Provisionable).To(Equal(core.BoolPtr(true))) + Expect(cfMetaDataModel.Bindable).To(Equal(core.BoolPtr(true))) + Expect(cfMetaDataModel.AsyncProvisioningSupported).To(Equal(core.BoolPtr(true))) + Expect(cfMetaDataModel.AsyncUnprovisioningSupported).To(Equal(core.BoolPtr(true))) + Expect(cfMetaDataModel.Requires).To(Equal([]string{"testString"})) + Expect(cfMetaDataModel.PlanUpdateable).To(Equal(core.BoolPtr(true))) + Expect(cfMetaDataModel.State).To(Equal(core.StringPtr("testString"))) + Expect(cfMetaDataModel.ServiceCheckEnabled).To(Equal(core.BoolPtr(true))) + Expect(cfMetaDataModel.TestCheckInterval).To(Equal(core.Int64Ptr(int64(38)))) + Expect(cfMetaDataModel.ServiceKeySupported).To(Equal(core.BoolPtr(true))) + Expect(cfMetaDataModel.CfGuid).To(Equal(make(map[string]string))) + + // Construct an instance of the Callbacks model + callbacksModel := new(globalcatalogv1.Callbacks) + Expect(callbacksModel).ToNot(BeNil()) + callbacksModel.ControllerURL = core.StringPtr("testString") + callbacksModel.BrokerURL = core.StringPtr("testString") + callbacksModel.BrokerProxyURL = core.StringPtr("testString") + callbacksModel.DashboardURL = core.StringPtr("testString") + callbacksModel.DashboardDataURL = core.StringPtr("testString") + callbacksModel.DashboardDetailTabURL = core.StringPtr("testString") + callbacksModel.DashboardDetailTabExtURL = core.StringPtr("testString") + callbacksModel.ServiceMonitorApi = core.StringPtr("testString") + callbacksModel.ServiceMonitorApp = core.StringPtr("testString") + callbacksModel.ApiEndpoint = make(map[string]string) + Expect(callbacksModel.ControllerURL).To(Equal(core.StringPtr("testString"))) + Expect(callbacksModel.BrokerURL).To(Equal(core.StringPtr("testString"))) + Expect(callbacksModel.BrokerProxyURL).To(Equal(core.StringPtr("testString"))) + Expect(callbacksModel.DashboardURL).To(Equal(core.StringPtr("testString"))) + Expect(callbacksModel.DashboardDataURL).To(Equal(core.StringPtr("testString"))) + Expect(callbacksModel.DashboardDetailTabURL).To(Equal(core.StringPtr("testString"))) + Expect(callbacksModel.DashboardDetailTabExtURL).To(Equal(core.StringPtr("testString"))) + Expect(callbacksModel.ServiceMonitorApi).To(Equal(core.StringPtr("testString"))) + Expect(callbacksModel.ServiceMonitorApp).To(Equal(core.StringPtr("testString"))) + Expect(callbacksModel.ApiEndpoint).To(Equal(make(map[string]string))) + + // Construct an instance of the DeploymentBase model + deploymentBaseModel := new(globalcatalogv1.DeploymentBase) + Expect(deploymentBaseModel).ToNot(BeNil()) + deploymentBaseModel.Location = core.StringPtr("testString") + deploymentBaseModel.LocationURL = core.StringPtr("testString") + deploymentBaseModel.OriginalLocation = core.StringPtr("testString") + deploymentBaseModel.TargetCrn = core.StringPtr("testString") + deploymentBaseModel.ServiceCrn = core.StringPtr("testString") + deploymentBaseModel.MccpID = core.StringPtr("testString") + deploymentBaseModel.Broker = brokerModel + deploymentBaseModel.SupportsRcMigration = core.BoolPtr(true) + deploymentBaseModel.TargetNetwork = core.StringPtr("testString") + Expect(deploymentBaseModel.Location).To(Equal(core.StringPtr("testString"))) + Expect(deploymentBaseModel.LocationURL).To(Equal(core.StringPtr("testString"))) + Expect(deploymentBaseModel.OriginalLocation).To(Equal(core.StringPtr("testString"))) + Expect(deploymentBaseModel.TargetCrn).To(Equal(core.StringPtr("testString"))) + Expect(deploymentBaseModel.ServiceCrn).To(Equal(core.StringPtr("testString"))) + Expect(deploymentBaseModel.MccpID).To(Equal(core.StringPtr("testString"))) + Expect(deploymentBaseModel.Broker).To(Equal(brokerModel)) + Expect(deploymentBaseModel.SupportsRcMigration).To(Equal(core.BoolPtr(true))) + Expect(deploymentBaseModel.TargetNetwork).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the Overview model + overviewModel := new(globalcatalogv1.Overview) + Expect(overviewModel).ToNot(BeNil()) + overviewModel.DisplayName = core.StringPtr("testString") + overviewModel.LongDescription = core.StringPtr("testString") + overviewModel.Description = core.StringPtr("testString") + overviewModel.FeaturedDescription = core.StringPtr("testString") + Expect(overviewModel.DisplayName).To(Equal(core.StringPtr("testString"))) + Expect(overviewModel.LongDescription).To(Equal(core.StringPtr("testString"))) + Expect(overviewModel.Description).To(Equal(core.StringPtr("testString"))) + Expect(overviewModel.FeaturedDescription).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the PlanMetaData model + planMetaDataModel := new(globalcatalogv1.PlanMetaData) + Expect(planMetaDataModel).ToNot(BeNil()) + planMetaDataModel.Bindable = core.BoolPtr(true) + planMetaDataModel.Reservable = core.BoolPtr(true) + planMetaDataModel.AllowInternalUsers = core.BoolPtr(true) + planMetaDataModel.AsyncProvisioningSupported = core.BoolPtr(true) + planMetaDataModel.AsyncUnprovisioningSupported = core.BoolPtr(true) + planMetaDataModel.TestCheckInterval = core.Int64Ptr(int64(38)) + planMetaDataModel.SingleScopeInstance = core.StringPtr("testString") + planMetaDataModel.ServiceCheckEnabled = core.BoolPtr(true) + planMetaDataModel.CfGuid = make(map[string]string) + Expect(planMetaDataModel.Bindable).To(Equal(core.BoolPtr(true))) + Expect(planMetaDataModel.Reservable).To(Equal(core.BoolPtr(true))) + Expect(planMetaDataModel.AllowInternalUsers).To(Equal(core.BoolPtr(true))) + Expect(planMetaDataModel.AsyncProvisioningSupported).To(Equal(core.BoolPtr(true))) + Expect(planMetaDataModel.AsyncUnprovisioningSupported).To(Equal(core.BoolPtr(true))) + Expect(planMetaDataModel.TestCheckInterval).To(Equal(core.Int64Ptr(int64(38)))) + Expect(planMetaDataModel.SingleScopeInstance).To(Equal(core.StringPtr("testString"))) + Expect(planMetaDataModel.ServiceCheckEnabled).To(Equal(core.BoolPtr(true))) + Expect(planMetaDataModel.CfGuid).To(Equal(make(map[string]string))) + + // Construct an instance of the PricingSet model + pricingSetModel := new(globalcatalogv1.PricingSet) + Expect(pricingSetModel).ToNot(BeNil()) + pricingSetModel.Type = core.StringPtr("testString") + pricingSetModel.Origin = core.StringPtr("testString") + pricingSetModel.StartingPrice = startingPriceModel + Expect(pricingSetModel.Type).To(Equal(core.StringPtr("testString"))) + Expect(pricingSetModel.Origin).To(Equal(core.StringPtr("testString"))) + Expect(pricingSetModel.StartingPrice).To(Equal(startingPriceModel)) + + // Construct an instance of the SLAMetaData model + slaMetaDataModel := new(globalcatalogv1.SLAMetaData) + Expect(slaMetaDataModel).ToNot(BeNil()) + slaMetaDataModel.Terms = core.StringPtr("testString") + slaMetaDataModel.Tenancy = core.StringPtr("testString") + slaMetaDataModel.Provisioning = core.StringPtr("testString") + slaMetaDataModel.Responsiveness = core.StringPtr("testString") + slaMetaDataModel.Dr = drMetaDataModel + Expect(slaMetaDataModel.Terms).To(Equal(core.StringPtr("testString"))) + Expect(slaMetaDataModel.Tenancy).To(Equal(core.StringPtr("testString"))) + Expect(slaMetaDataModel.Provisioning).To(Equal(core.StringPtr("testString"))) + Expect(slaMetaDataModel.Responsiveness).To(Equal(core.StringPtr("testString"))) + Expect(slaMetaDataModel.Dr).To(Equal(drMetaDataModel)) + + // Construct an instance of the TemplateMetaData model + templateMetaDataModel := new(globalcatalogv1.TemplateMetaData) + Expect(templateMetaDataModel).ToNot(BeNil()) + templateMetaDataModel.Services = []string{"testString"} + templateMetaDataModel.DefaultMemory = core.Int64Ptr(int64(38)) + templateMetaDataModel.StartCmd = core.StringPtr("testString") + templateMetaDataModel.Source = sourceMetaDataModel + templateMetaDataModel.RuntimeCatalogID = core.StringPtr("testString") + templateMetaDataModel.CfRuntimeID = core.StringPtr("testString") + templateMetaDataModel.TemplateID = core.StringPtr("testString") + templateMetaDataModel.ExecutableFile = core.StringPtr("testString") + templateMetaDataModel.Buildpack = core.StringPtr("testString") + templateMetaDataModel.EnvironmentVariables = make(map[string]string) + Expect(templateMetaDataModel.Services).To(Equal([]string{"testString"})) + Expect(templateMetaDataModel.DefaultMemory).To(Equal(core.Int64Ptr(int64(38)))) + Expect(templateMetaDataModel.StartCmd).To(Equal(core.StringPtr("testString"))) + Expect(templateMetaDataModel.Source).To(Equal(sourceMetaDataModel)) + Expect(templateMetaDataModel.RuntimeCatalogID).To(Equal(core.StringPtr("testString"))) + Expect(templateMetaDataModel.CfRuntimeID).To(Equal(core.StringPtr("testString"))) + Expect(templateMetaDataModel.TemplateID).To(Equal(core.StringPtr("testString"))) + Expect(templateMetaDataModel.ExecutableFile).To(Equal(core.StringPtr("testString"))) + Expect(templateMetaDataModel.Buildpack).To(Equal(core.StringPtr("testString"))) + Expect(templateMetaDataModel.EnvironmentVariables).To(Equal(make(map[string]string))) + + // Construct an instance of the UIMetaData model + uiMetaDataModel := new(globalcatalogv1.UIMetaData) + Expect(uiMetaDataModel).ToNot(BeNil()) + uiMetaDataModel.Strings = i18NModel + uiMetaDataModel.Urls = urlsModel + uiMetaDataModel.EmbeddableDashboard = core.StringPtr("testString") + uiMetaDataModel.EmbeddableDashboardFullWidth = core.BoolPtr(true) + uiMetaDataModel.NavigationOrder = []string{"testString"} + uiMetaDataModel.NotCreatable = core.BoolPtr(true) + uiMetaDataModel.PrimaryOfferingID = core.StringPtr("testString") + uiMetaDataModel.AccessibleDuringProvision = core.BoolPtr(true) + uiMetaDataModel.SideBySideIndex = core.Int64Ptr(int64(38)) + uiMetaDataModel.EndOfServiceTime = CreateMockDateTime() + uiMetaDataModel.Hidden = core.BoolPtr(true) + uiMetaDataModel.HideLiteMetering = core.BoolPtr(true) + uiMetaDataModel.NoUpgradeNextStep = core.BoolPtr(true) + Expect(uiMetaDataModel.Strings).To(Equal(i18NModel)) + Expect(uiMetaDataModel.Urls).To(Equal(urlsModel)) + Expect(uiMetaDataModel.EmbeddableDashboard).To(Equal(core.StringPtr("testString"))) + Expect(uiMetaDataModel.EmbeddableDashboardFullWidth).To(Equal(core.BoolPtr(true))) + Expect(uiMetaDataModel.NavigationOrder).To(Equal([]string{"testString"})) + Expect(uiMetaDataModel.NotCreatable).To(Equal(core.BoolPtr(true))) + Expect(uiMetaDataModel.PrimaryOfferingID).To(Equal(core.StringPtr("testString"))) + Expect(uiMetaDataModel.AccessibleDuringProvision).To(Equal(core.BoolPtr(true))) + Expect(uiMetaDataModel.SideBySideIndex).To(Equal(core.Int64Ptr(int64(38)))) + Expect(uiMetaDataModel.EndOfServiceTime).To(Equal(CreateMockDateTime())) + Expect(uiMetaDataModel.Hidden).To(Equal(core.BoolPtr(true))) + Expect(uiMetaDataModel.HideLiteMetering).To(Equal(core.BoolPtr(true))) + Expect(uiMetaDataModel.NoUpgradeNextStep).To(Equal(core.BoolPtr(true))) + + // Construct an instance of the Image model + imageModel := new(globalcatalogv1.Image) + Expect(imageModel).ToNot(BeNil()) + imageModel.Image = core.StringPtr("testString") + imageModel.SmallImage = core.StringPtr("testString") + imageModel.MediumImage = core.StringPtr("testString") + imageModel.FeatureImage = core.StringPtr("testString") + Expect(imageModel.Image).To(Equal(core.StringPtr("testString"))) + Expect(imageModel.SmallImage).To(Equal(core.StringPtr("testString"))) + Expect(imageModel.MediumImage).To(Equal(core.StringPtr("testString"))) + Expect(imageModel.FeatureImage).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the ObjectMetadataSet model + objectMetadataSetModel := new(globalcatalogv1.ObjectMetadataSet) + Expect(objectMetadataSetModel).ToNot(BeNil()) + objectMetadataSetModel.RcCompatible = core.BoolPtr(true) + objectMetadataSetModel.Service = cfMetaDataModel + objectMetadataSetModel.Plan = planMetaDataModel + objectMetadataSetModel.Alias = aliasMetaDataModel + objectMetadataSetModel.Template = templateMetaDataModel + objectMetadataSetModel.Ui = uiMetaDataModel + objectMetadataSetModel.Compliance = []string{"testString"} + objectMetadataSetModel.Sla = slaMetaDataModel + objectMetadataSetModel.Callbacks = callbacksModel + objectMetadataSetModel.OriginalName = core.StringPtr("testString") + objectMetadataSetModel.Version = core.StringPtr("testString") + objectMetadataSetModel.Other = make(map[string]interface{}) + objectMetadataSetModel.Pricing = pricingSetModel + objectMetadataSetModel.Deployment = deploymentBaseModel + Expect(objectMetadataSetModel.RcCompatible).To(Equal(core.BoolPtr(true))) + Expect(objectMetadataSetModel.Service).To(Equal(cfMetaDataModel)) + Expect(objectMetadataSetModel.Plan).To(Equal(planMetaDataModel)) + Expect(objectMetadataSetModel.Alias).To(Equal(aliasMetaDataModel)) + Expect(objectMetadataSetModel.Template).To(Equal(templateMetaDataModel)) + Expect(objectMetadataSetModel.Ui).To(Equal(uiMetaDataModel)) + Expect(objectMetadataSetModel.Compliance).To(Equal([]string{"testString"})) + Expect(objectMetadataSetModel.Sla).To(Equal(slaMetaDataModel)) + Expect(objectMetadataSetModel.Callbacks).To(Equal(callbacksModel)) + Expect(objectMetadataSetModel.OriginalName).To(Equal(core.StringPtr("testString"))) + Expect(objectMetadataSetModel.Version).To(Equal(core.StringPtr("testString"))) + Expect(objectMetadataSetModel.Other).To(Equal(make(map[string]interface{}))) + Expect(objectMetadataSetModel.Pricing).To(Equal(pricingSetModel)) + Expect(objectMetadataSetModel.Deployment).To(Equal(deploymentBaseModel)) + + // Construct an instance of the OverviewUI model + overviewUiModel := new(globalcatalogv1.OverviewUI) + Expect(overviewUiModel).ToNot(BeNil()) + overviewUiModel.SetProperty("foo", overviewModel) + Expect(overviewUiModel.GetProperty("foo")).To(Equal(overviewModel)) + Expect(overviewUiModel.GetProperties()).ToNot(BeEmpty()) + + // Construct an instance of the Provider model + providerModel := new(globalcatalogv1.Provider) + Expect(providerModel).ToNot(BeNil()) + providerModel.Email = core.StringPtr("testString") + providerModel.Name = core.StringPtr("testString") + providerModel.Contact = core.StringPtr("testString") + providerModel.SupportEmail = core.StringPtr("testString") + providerModel.Phone = core.StringPtr("testString") + Expect(providerModel.Email).To(Equal(core.StringPtr("testString"))) + Expect(providerModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(providerModel.Contact).To(Equal(core.StringPtr("testString"))) + Expect(providerModel.SupportEmail).To(Equal(core.StringPtr("testString"))) + Expect(providerModel.Phone).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the UpdateCatalogEntryOptions model + id := "testString" + updateCatalogEntryOptionsName := "testString" + updateCatalogEntryOptionsKind := "service" + var updateCatalogEntryOptionsOverviewUi *globalcatalogv1.OverviewUI = nil + var updateCatalogEntryOptionsImages *globalcatalogv1.Image = nil + updateCatalogEntryOptionsDisabled := true + updateCatalogEntryOptionsTags := []string{"testString"} + var updateCatalogEntryOptionsProvider *globalcatalogv1.Provider = nil + updateCatalogEntryOptionsModel := testService.NewUpdateCatalogEntryOptions(id, updateCatalogEntryOptionsName, updateCatalogEntryOptionsKind, updateCatalogEntryOptionsOverviewUi, updateCatalogEntryOptionsImages, updateCatalogEntryOptionsDisabled, updateCatalogEntryOptionsTags, updateCatalogEntryOptionsProvider) + updateCatalogEntryOptionsModel.SetID("testString") + updateCatalogEntryOptionsModel.SetName("testString") + updateCatalogEntryOptionsModel.SetKind("service") + updateCatalogEntryOptionsModel.SetOverviewUi(overviewUiModel) + updateCatalogEntryOptionsModel.SetImages(imageModel) + updateCatalogEntryOptionsModel.SetDisabled(true) + updateCatalogEntryOptionsModel.SetTags([]string{"testString"}) + updateCatalogEntryOptionsModel.SetProvider(providerModel) + updateCatalogEntryOptionsModel.SetParentID("testString") + updateCatalogEntryOptionsModel.SetGroup(true) + updateCatalogEntryOptionsModel.SetActive(true) + updateCatalogEntryOptionsModel.SetMetadata(objectMetadataSetModel) + updateCatalogEntryOptionsModel.SetAccount("testString") + updateCatalogEntryOptionsModel.SetMove("testString") + updateCatalogEntryOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateCatalogEntryOptionsModel).ToNot(BeNil()) + Expect(updateCatalogEntryOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateCatalogEntryOptionsModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(updateCatalogEntryOptionsModel.Kind).To(Equal(core.StringPtr("service"))) + Expect(updateCatalogEntryOptionsModel.OverviewUi).To(Equal(overviewUiModel)) + Expect(updateCatalogEntryOptionsModel.Images).To(Equal(imageModel)) + Expect(updateCatalogEntryOptionsModel.Disabled).To(Equal(core.BoolPtr(true))) + Expect(updateCatalogEntryOptionsModel.Tags).To(Equal([]string{"testString"})) + Expect(updateCatalogEntryOptionsModel.Provider).To(Equal(providerModel)) + Expect(updateCatalogEntryOptionsModel.ParentID).To(Equal(core.StringPtr("testString"))) + Expect(updateCatalogEntryOptionsModel.Group).To(Equal(core.BoolPtr(true))) + Expect(updateCatalogEntryOptionsModel.Active).To(Equal(core.BoolPtr(true))) + Expect(updateCatalogEntryOptionsModel.Metadata).To(Equal(objectMetadataSetModel)) + Expect(updateCatalogEntryOptionsModel.Account).To(Equal(core.StringPtr("testString"))) + Expect(updateCatalogEntryOptionsModel.Move).To(Equal(core.StringPtr("testString"))) + Expect(updateCatalogEntryOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewUpdateVisibilityOptions successfully`, func() { + // Construct an instance of the VisibilityDetailAccounts model + visibilityDetailAccountsModel := new(globalcatalogv1.VisibilityDetailAccounts) + Expect(visibilityDetailAccountsModel).ToNot(BeNil()) + visibilityDetailAccountsModel.Accountid = core.StringPtr("testString") + Expect(visibilityDetailAccountsModel.Accountid).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the VisibilityDetail model + visibilityDetailModel := new(globalcatalogv1.VisibilityDetail) + Expect(visibilityDetailModel).ToNot(BeNil()) + visibilityDetailModel.Accounts = visibilityDetailAccountsModel + Expect(visibilityDetailModel.Accounts).To(Equal(visibilityDetailAccountsModel)) + + // Construct an instance of the UpdateVisibilityOptions model + id := "testString" + updateVisibilityOptionsModel := testService.NewUpdateVisibilityOptions(id) + updateVisibilityOptionsModel.SetID("testString") + updateVisibilityOptionsModel.SetExtendable(true) + updateVisibilityOptionsModel.SetInclude(visibilityDetailModel) + updateVisibilityOptionsModel.SetExclude(visibilityDetailModel) + updateVisibilityOptionsModel.SetAccount("testString") + updateVisibilityOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateVisibilityOptionsModel).ToNot(BeNil()) + Expect(updateVisibilityOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateVisibilityOptionsModel.Extendable).To(Equal(core.BoolPtr(true))) + Expect(updateVisibilityOptionsModel.Include).To(Equal(visibilityDetailModel)) + Expect(updateVisibilityOptionsModel.Exclude).To(Equal(visibilityDetailModel)) + Expect(updateVisibilityOptionsModel.Account).To(Equal(core.StringPtr("testString"))) + Expect(updateVisibilityOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewUploadArtifactOptions successfully`, func() { + // Construct an instance of the UploadArtifactOptions model + objectID := "testString" + artifactID := "testString" + uploadArtifactOptionsModel := testService.NewUploadArtifactOptions(objectID, artifactID) + uploadArtifactOptionsModel.SetObjectID("testString") + uploadArtifactOptionsModel.SetArtifactID("testString") + uploadArtifactOptionsModel.SetArtifact(CreateMockReader("This is a mock file.")) + uploadArtifactOptionsModel.SetContentType("testString") + uploadArtifactOptionsModel.SetAccount("testString") + uploadArtifactOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(uploadArtifactOptionsModel).ToNot(BeNil()) + Expect(uploadArtifactOptionsModel.ObjectID).To(Equal(core.StringPtr("testString"))) + Expect(uploadArtifactOptionsModel.ArtifactID).To(Equal(core.StringPtr("testString"))) + Expect(uploadArtifactOptionsModel.Artifact).To(Equal(CreateMockReader("This is a mock file."))) + Expect(uploadArtifactOptionsModel.ContentType).To(Equal(core.StringPtr("testString"))) + Expect(uploadArtifactOptionsModel.Account).To(Equal(core.StringPtr("testString"))) + Expect(uploadArtifactOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewVisibilityDetail successfully`, func() { + var accounts *globalcatalogv1.VisibilityDetailAccounts = nil + _, err := testService.NewVisibilityDetail(accounts) + Expect(err).ToNot(BeNil()) + }) + }) + }) + Describe(`Utility function tests`, func() { + It(`Invoke CreateMockByteArray() successfully`, func() { + mockByteArray := CreateMockByteArray("This is a test") + Expect(mockByteArray).ToNot(BeNil()) + }) + It(`Invoke CreateMockUUID() successfully`, func() { + mockUUID := CreateMockUUID("9fab83da-98cb-4f18-a7ba-b6f0435c9673") + Expect(mockUUID).ToNot(BeNil()) + }) + It(`Invoke CreateMockReader() successfully`, func() { + mockReader := CreateMockReader("This is a test.") + Expect(mockReader).ToNot(BeNil()) + }) + It(`Invoke CreateMockDate() successfully`, func() { + mockDate := CreateMockDate() + Expect(mockDate).ToNot(BeNil()) + }) + It(`Invoke CreateMockDateTime() successfully`, func() { + mockDateTime := CreateMockDateTime() + Expect(mockDateTime).ToNot(BeNil()) + }) + }) +}) + +// +// Utility functions used by the generated test code +// + +func CreateMockByteArray(mockData string) *[]byte { + ba := make([]byte, 0) + ba = append(ba, mockData...) + return &ba +} + +func CreateMockUUID(mockData string) *strfmt.UUID { + uuid := strfmt.UUID(mockData) + return &uuid +} + +func CreateMockReader(mockData string) io.ReadCloser { + return ioutil.NopCloser(bytes.NewReader([]byte(mockData))) +} + +func CreateMockDate() *strfmt.Date { + d := strfmt.Date(time.Date(2009, time.November, 10, 23, 0, 0, 0, time.UTC)) + return &d +} + +func CreateMockDateTime() *strfmt.DateTime { + d := strfmt.DateTime(time.Date(2009, time.November, 10, 23, 0, 0, 0, time.UTC)) + return &d +} + +func SetTestEnvironment(testEnvironment map[string]string) { + for key, value := range testEnvironment { + os.Setenv(key, value) + } +} + +func ClearTestEnvironment(testEnvironment map[string]string) { + for key := range testEnvironment { + os.Unsetenv(key) + } +} diff --git a/go.mod b/go.mod index ae820f75..69007369 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,8 @@ module github.com/IBM/platform-services-go-sdk go 1.12 require ( - github.com/IBM/go-sdk-core/v3 v3.3.0 + github.com/IBM/go-sdk-core/v3 v3.3.1 + github.com/IBM/go-sdk-core/v4 v4.0.0 github.com/go-openapi/strfmt v0.19.4 github.com/joho/godotenv v1.3.0 github.com/onsi/ginkgo v1.12.0 diff --git a/go.sum b/go.sum index 5d998f50..5ecc03cd 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,7 @@ -github.com/IBM/go-sdk-core/v3 v3.3.0 h1:OM1ime6nSApZHp6WrCzKZ3gkjU3M5oOcoxRbQFl+nHI= -github.com/IBM/go-sdk-core/v3 v3.3.0/go.mod h1:lk9eOzNbNltPf3CBpcg1Ewkhw4qC3u2QCCKDRsUA2M0= +github.com/IBM/go-sdk-core/v3 v3.3.1 h1:DoXjP1+Wm8Yd4XJsvBMRcYLvQwSLFnzKlMjSrg3Rzpw= +github.com/IBM/go-sdk-core/v3 v3.3.1/go.mod h1:lk9eOzNbNltPf3CBpcg1Ewkhw4qC3u2QCCKDRsUA2M0= +github.com/IBM/go-sdk-core/v4 v4.0.0 h1:x3WT9m6sAii/Pdg2th8AKVcwG8Webd4/gRNi+TczZ/U= +github.com/IBM/go-sdk-core/v4 v4.0.0/go.mod h1:YzFxVat+8fRdyiDhwZIQdvjDAOHLa2/hx1UOXLT6J40= github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a h1:idn718Q4B6AGu/h5Sxe66HYVdqdGu2l9Iebqhi/AEoA= github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=