Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Global Search): remove deprecated method getSupportedTypes #253

Merged
merged 4 commits into from
Apr 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 1 addition & 110 deletions globalsearchv2/global_search_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

/*
* IBM OpenAPI SDK Code Generator Version: 3.67.0-df2073a1-20230222-221157
* IBM OpenAPI SDK Code Generator Version: 3.70.0-7df966bf-20230419-195904
*/

// Package globalsearchv2 : Operations and models for the GlobalSearchV2 service
Expand Down Expand Up @@ -220,9 +220,6 @@ func (globalSearch *GlobalSearchV2) SearchWithContext(ctx context.Context, searc
if searchOptions.AccountID != nil {
builder.AddQuery("account_id", fmt.Sprint(*searchOptions.AccountID))
}
if searchOptions.Boundary != nil {
builder.AddQuery("boundary", fmt.Sprint(*searchOptions.Boundary))
}
if searchOptions.Limit != nil {
builder.AddQuery("limit", fmt.Sprint(*searchOptions.Limit))
}
Expand Down Expand Up @@ -284,79 +281,6 @@ func (globalSearch *GlobalSearchV2) SearchWithContext(ctx context.Context, searc
return
}

// GetSupportedTypes : DEPRECATED. Get all GhoST indexes
// Retrieves a list of all GhoST indexes.
// Deprecated: this method is deprecated and may be removed in a future release.
func (globalSearch *GlobalSearchV2) GetSupportedTypes(getSupportedTypesOptions *GetSupportedTypesOptions) (result *SupportedTypesList, response *core.DetailedResponse, err error) {
return globalSearch.GetSupportedTypesWithContext(context.Background(), getSupportedTypesOptions)
}

// GetSupportedTypesWithContext is an alternate form of the GetSupportedTypes method which supports a Context parameter
// Deprecated: this method is deprecated and may be removed in a future release.
func (globalSearch *GlobalSearchV2) GetSupportedTypesWithContext(ctx context.Context, getSupportedTypesOptions *GetSupportedTypesOptions) (result *SupportedTypesList, response *core.DetailedResponse, err error) {
core.GetLogger().Warn("A deprecated operation has been invoked: GetSupportedTypes")
err = core.ValidateStruct(getSupportedTypesOptions, "getSupportedTypesOptions")
if err != nil {
return
}

builder := core.NewRequestBuilder(core.GET)
builder = builder.WithContext(ctx)
builder.EnableGzipCompression = globalSearch.GetEnableGzipCompression()
_, err = builder.ResolveRequestURL(globalSearch.Service.Options.URL, `/v2/resources/supported_types`, nil)
if err != nil {
return
}

for headerName, headerValue := range getSupportedTypesOptions.Headers {
builder.AddHeader(headerName, headerValue)
}

sdkHeaders := common.GetSdkHeaders("global_search", "V2", "GetSupportedTypes")
for headerName, headerValue := range sdkHeaders {
builder.AddHeader(headerName, headerValue)
}
builder.AddHeader("Accept", "application/json")

request, err := builder.Build()
if err != nil {
return
}

var rawResponse map[string]json.RawMessage
response, err = globalSearch.Service.Request(request, &rawResponse)
if err != nil {
return
}
if rawResponse != nil {
err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSupportedTypesList)
if err != nil {
return
}
response.Result = result
}

return
}

// GetSupportedTypesOptions : The GetSupportedTypes options.
type GetSupportedTypesOptions struct {

// Allows users to set headers on API requests
Headers map[string]string
}

// NewGetSupportedTypesOptions : Instantiate GetSupportedTypesOptions
func (*GlobalSearchV2) NewGetSupportedTypesOptions() *GetSupportedTypesOptions {
return &GetSupportedTypesOptions{}
}

// SetHeaders : Allow user to set Headers
func (options *GetSupportedTypesOptions) SetHeaders(param map[string]string) *GetSupportedTypesOptions {
options.Headers = param
return options
}

// ResultItem : A resource returned in a search result, which is identified by its `crn`. It contains other properties that depend on
// the resource type.
type ResultItem struct {
Expand Down Expand Up @@ -481,9 +405,6 @@ type SearchOptions struct {
// The account ID to filter resources.
AccountID *string `json:"account_id,omitempty"`

// The boundary where the search performs. This parameter must be set only for the cross-account searches.
Boundary *string `json:"boundary,omitempty"`

// The maximum number of hits to return. Defaults to 10.
Limit *int64 `json:"limit,omitempty"`

Expand Down Expand Up @@ -522,13 +443,6 @@ type SearchOptions struct {
Headers map[string]string
}

// Constants associated with the SearchOptions.Boundary property.
// The boundary where the search performs. This parameter must be set only for the cross-account searches.
const (
SearchOptionsBoundaryGlobalConst = "global"
SearchOptionsBoundaryUsRegulatedConst = "us-regulated"
)

// Constants associated with the SearchOptions.IsDeleted property.
// Determines if deleted documents should be included in result set or not. Possible values are false (default), true or
// any. If false, only existing documents are returned; if true, only deleted documents are returned; If any, both
Expand Down Expand Up @@ -603,12 +517,6 @@ func (_options *SearchOptions) SetAccountID(accountID string) *SearchOptions {
return _options
}

// SetBoundary : Allow user to set Boundary
func (_options *SearchOptions) SetBoundary(boundary string) *SearchOptions {
_options.Boundary = core.StringPtr(boundary)
return _options
}

// SetLimit : Allow user to set Limit
func (_options *SearchOptions) SetLimit(limit int64) *SearchOptions {
_options.Limit = core.Int64Ptr(limit)
Expand Down Expand Up @@ -662,20 +570,3 @@ func (options *SearchOptions) SetHeaders(param map[string]string) *SearchOptions
options.Headers = param
return options
}

// SupportedTypesList : A list of all GhoST indexes.
type SupportedTypesList struct {
// A list of all GhoST indexes.
SupportedTypes []string `json:"supported_types,omitempty"`
}

// UnmarshalSupportedTypesList unmarshals an instance of SupportedTypesList from the specified map of raw messages.
func UnmarshalSupportedTypesList(m map[string]json.RawMessage, result interface{}) (err error) {
obj := new(SupportedTypesList)
err = core.UnmarshalPrimitive(m, "supported_types", &obj.SupportedTypes)
if err != nil {
return
}
reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))
return
}
20 changes: 0 additions & 20 deletions globalsearchv2/global_search_v2_examples_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,25 +157,5 @@ var _ = Describe(`GlobalSearchV2 Examples Tests`, func() {
Expect(scanResult).ToNot(BeNil())

})
It(`GetSupportedTypes request example`, func() {
fmt.Println("\nGetSupportedTypes() result:")
// begin-get_supported_types

getSupportedTypesOptions := globalSearchService.NewGetSupportedTypesOptions()

supportedTypesList, response, err := globalSearchService.GetSupportedTypes(getSupportedTypesOptions)
if err != nil {
panic(err)
}
b, _ := json.MarshalIndent(supportedTypesList, "", " ")
fmt.Println(string(b))

// end-get_supported_types

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

})
})
})
18 changes: 0 additions & 18 deletions globalsearchv2/global_search_v2_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,22 +138,4 @@ var _ = Describe(`GlobalSearchV2 Integration Tests`, func() {
fmt.Fprintf(GinkgoWriter, "Total results returned by Search(): %d\n", len(searchResults))
})
})

Describe(`GetSupportedTypes - Get all supported resource types`, func() {
BeforeEach(func() {
shouldSkipTest()
})
It(`GetSupportedTypes(getSupportedTypesOptions *GetSupportedTypesOptions)`, func() {

getSupportedTypesOptions := &globalsearchv2.GetSupportedTypesOptions{}

supportedTypesList, response, err := globalSearchService.GetSupportedTypes(getSupportedTypesOptions)

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

fmt.Fprintf(GinkgoWriter, "GetSupportedTypes() result:\n%s\n", common.ToJSON(supportedTypesList))
})
})
})
Loading