globalsearchv2

package
v0.62.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 3, 2024 License: Apache-2.0 Imports: 9 Imported by: 3

Documentation

Overview

Package globalsearchv2 : Operations and models for the GlobalSearchV2 service

Index

Constants

View Source
const (
	SearchOptionsIsDeletedAnyConst   = "any"
	SearchOptionsIsDeletedFalseConst = "false"
	SearchOptionsIsDeletedTrueConst  = "true"
)

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 existing and deleted documents are returned. (_for administrators only_).

View Source
const (
	SearchOptionsIsReclaimedAnyConst   = "any"
	SearchOptionsIsReclaimedFalseConst = "false"
	SearchOptionsIsReclaimedTrueConst  = "true"
)

Constants associated with the SearchOptions.IsReclaimed property. Determines if reclaimed documents should be included in result set or not. Possible values are false (default), true or any. If false, only not reclaimed documents are returned; if true, only reclaimed documents are returned; If any, both reclaimed and not reclaimed documents are returned.

View Source
const (
	SearchOptionsIsPublicAnyConst   = "any"
	SearchOptionsIsPublicFalseConst = "false"
	SearchOptionsIsPublicTrueConst  = "true"
)

Constants associated with the SearchOptions.IsPublic property. Determines if public resources should be included in result set or not. Possible values are false (default), true or any. If false, do not search public resources; if true, search only public resources; If any, search also public resources.

View Source
const (
	SearchOptionsCanTagFalseConst = "false"
	SearchOptionsCanTagTrueConst  = "true"
)

Constants associated with the SearchOptions.CanTag property. Determines if the result set must return the resources that the user can tag or the resources that the user can view (only a GhoST admin can use this parameter). If false (default), only resources user can view are returned; if true, only resources that user has permissions for tagging are returned (_for administrators only_).

View Source
const DefaultServiceName = "global_search"

DefaultServiceName is the default key used to find external configuration information.

View Source
const DefaultServiceURL = "https://api.global-search-tagging.cloud.ibm.com"

DefaultServiceURL is the default URL to make service requests to.

Variables

This section is empty.

Functions

func GetServiceURLForRegion added in v0.17.1

func GetServiceURLForRegion(region string) (string, error)

GetServiceURLForRegion returns the service URL to be used for the specified region

func UnmarshalResultItem

func UnmarshalResultItem(m map[string]json.RawMessage, result interface{}) (err error)

UnmarshalResultItem unmarshals an instance of ResultItem from the specified map of raw messages.

func UnmarshalScanResult

func UnmarshalScanResult(m map[string]json.RawMessage, result interface{}) (err error)

UnmarshalScanResult unmarshals an instance of ScanResult from the specified map of raw messages.

Types

type GlobalSearchV2

type GlobalSearchV2 struct {
	Service *core.BaseService
}

GlobalSearchV2 : Search for resources with the global and shared resource properties repository that is integrated in the IBM Cloud platform. The search repository stores and searches cloud resources attributes, which categorize or classify resources. A resource is a physical or logical component that can be created or reserved for an application or service instance. They are owned by resource providers, such as IBM Kubernetes Service, or resource controller in IBM Cloud. Resources are uniquely identified by a Cloud Resource Name (CRN) or by an IMS ID. The properties of a resource include tags and system properties. Both properties are defined in an IBM Cloud billing account, and span across many regions.

API Version: 2.0.1

func NewGlobalSearchV2

func NewGlobalSearchV2(options *GlobalSearchV2Options) (service *GlobalSearchV2, err error)

NewGlobalSearchV2 : constructs an instance of GlobalSearchV2 with passed in options.

func NewGlobalSearchV2UsingExternalConfig

func NewGlobalSearchV2UsingExternalConfig(options *GlobalSearchV2Options) (globalSearch *GlobalSearchV2, err error)

NewGlobalSearchV2UsingExternalConfig : constructs an instance of GlobalSearchV2 with passed in options and external configuration.

func (*GlobalSearchV2) Clone added in v0.17.1

func (globalSearch *GlobalSearchV2) Clone() *GlobalSearchV2

Clone makes a copy of "globalSearch" suitable for processing requests.

func (*GlobalSearchV2) DisableRetries added in v0.12.2

func (globalSearch *GlobalSearchV2) DisableRetries()

DisableRetries disables automatic retries for requests invoked for this service instance.

func (*GlobalSearchV2) EnableRetries added in v0.12.2

func (globalSearch *GlobalSearchV2) EnableRetries(maxRetries int, maxRetryInterval time.Duration)

EnableRetries enables automatic retries for requests invoked for this service instance. If either parameter is specified as 0, then a default value is used instead.

func (*GlobalSearchV2) GetEnableGzipCompression added in v0.12.2

func (globalSearch *GlobalSearchV2) GetEnableGzipCompression() bool

GetEnableGzipCompression returns the service's EnableGzipCompression field

func (*GlobalSearchV2) GetServiceURL added in v0.12.2

func (globalSearch *GlobalSearchV2) GetServiceURL() string

GetServiceURL returns the service URL

func (*GlobalSearchV2) NewSearchOptions

func (*GlobalSearchV2) NewSearchOptions() *SearchOptions

NewSearchOptions : Instantiate SearchOptions

func (*GlobalSearchV2) Search

func (globalSearch *GlobalSearchV2) Search(searchOptions *SearchOptions) (result *ScanResult, response *core.DetailedResponse, err error)

Search : Find instances of resources (v3) Find IAM-enabled resources or storage and network resources that run on classic infrastructure in a specific account ID. You can apply query strings if necessary.

To filter results, you can insert a string by using the Lucene syntax and the query string is parsed into a series of terms and operators. A term can be a single word or a phrase, in which case the search is performed for all the words, in the same order. To filter for a specific value regardless of the property that contains it, type the search term without specifying a field. Only resources that belong to the account ID and that are accessible by the client are returned.

You must use `/v3/resources/search` when you need to fetch more than `10000` resource items. On the first call, the operation returns a live cursor on the data that you must use on all the subsequent calls to get the next batch of results until you get the empty result set.

By default, the fields that are returned for every resource are `crn`, `name`, `family`, `type`, and `account_id`. You can specify the subset of the fields you want in your request using the `fields` request body attribute. Set `"fields": ["*"]` to discover the set of fields which are available to request.

func (*GlobalSearchV2) SearchWithContext added in v0.12.2

func (globalSearch *GlobalSearchV2) SearchWithContext(ctx context.Context, searchOptions *SearchOptions) (result *ScanResult, response *core.DetailedResponse, err error)

SearchWithContext is an alternate form of the Search method which supports a Context parameter

func (*GlobalSearchV2) SetDefaultHeaders added in v0.12.2

func (globalSearch *GlobalSearchV2) SetDefaultHeaders(headers http.Header)

SetDefaultHeaders sets HTTP headers to be sent in every request

func (*GlobalSearchV2) SetEnableGzipCompression added in v0.12.2

func (globalSearch *GlobalSearchV2) SetEnableGzipCompression(enableGzip bool)

SetEnableGzipCompression sets the service's EnableGzipCompression field

func (*GlobalSearchV2) SetServiceURL

func (globalSearch *GlobalSearchV2) SetServiceURL(url string) error

SetServiceURL sets the service URL

type GlobalSearchV2Options

type GlobalSearchV2Options struct {
	ServiceName   string
	URL           string
	Authenticator core.Authenticator
}

GlobalSearchV2Options : Service options

type ResultItem

type ResultItem struct {
	// Resource identifier in CRN format.
	CRN *string `json:"crn" validate:"required"`
	// contains filtered or unexported fields
}

ResultItem : A resource returned in a search result, which is identified by its `crn`. It contains other properties that depend on the resource type.

func (*ResultItem) GetProperties

func (o *ResultItem) GetProperties() map[string]interface{}

GetProperties allows the user to retrieve the map of arbitrary properties from an instance of ResultItem

func (*ResultItem) GetProperty

func (o *ResultItem) GetProperty(key string) interface{}

GetProperty allows the user to retrieve an arbitrary property from an instance of ResultItem

func (*ResultItem) MarshalJSON

func (o *ResultItem) MarshalJSON() (buffer []byte, err error)

MarshalJSON performs custom serialization for instances of ResultItem

func (*ResultItem) SetProperties added in v0.31.3

func (o *ResultItem) SetProperties(m map[string]interface{})

SetProperties allows the user to set a map of arbitrary properties on an instance of ResultItem

func (*ResultItem) SetProperty

func (o *ResultItem) SetProperty(key string, value interface{})

SetProperty allows the user to set an arbitrary property on an instance of ResultItem

type ScanResult

type ScanResult struct {
	// The search cursor to use on all calls after the first one.
	SearchCursor *string `json:"search_cursor,omitempty"`

	// Value of the limit parameter specified by the user.
	Limit *int64 `json:"limit" validate:"required"`

	// The array of results. Each item represents a resource. For each resource, the requested `fields` are returned. If
	// you did not set the `fields` request body parameter, then the `account_id`, `name`, `type`, `family`, and `crn` are
	// returned. An empty array signals the end of the result set, which means there are no more results to fetch.
	Items []ResultItem `json:"items" validate:"required"`
}

ScanResult : The search scan response.

type SearchOptions

type SearchOptions struct {
	// The Lucene-formatted query string. Default to '*' if not set.
	Query *string `json:"query,omitempty"`

	// The list of the fields returned by the search. By default, the returned fields are the `account_id`, `name`, `type`,
	// `family`, and `crn`. For all queries, `crn` is always returned. You may set `"fields": ["*"]` to discover the set of
	// fields available to request.
	Fields []string `json:"fields,omitempty"`

	// An opaque cursor that is returned on each call and that must be set on the subsequent call to get the next batch of
	// items. If the search returns no items, then the search_cursor is not present in the response.
	SearchCursor *string `json:"search_cursor,omitempty"`

	// An alphanumeric string that is used to trace the request. The value  may include ASCII alphanumerics and any of
	// following segment separators: space ( ), comma (,), hyphen, (-), and underscore (_) and may have a length up to 1024
	// bytes. The value is considered invalid and must be ignored if that value includes any other character or is longer
	// than 1024 bytes or is fewer than 8 characters. If not specified or invalid, it is automatically replaced by a random
	// (version 4) UUID.
	XRequestID *string `json:"x-request-id,omitempty"`

	// An alphanumeric string that is used to trace the request as a part of a larger context: the same value is used for
	// downstream requests and retries of those requests. The value may include ASCII alphanumerics and any of following
	// segment separators: space ( ), comma (,), hyphen, (-), and underscore (_) and may have a length up to 1024 bytes.
	// The value is considered invalid and must be ignored if that value includes any other character or is longer than
	// 1024 bytes or is fewer than 8 characters. If not specified or invalid, it is automatically replaced by a random
	// (version 4) UUID.
	XCorrelationID *string `json:"x-correlation-id,omitempty"`

	// The account ID to filter resources.
	AccountID *string `json:"account_id,omitempty"`

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

	// A search timeout in milliseconds, bounding the search request to run within the specified time value and bail with
	// the hits accumulated up to that point when expired. Defaults to the system defined timeout.
	Timeout *int64 `json:"timeout,omitempty"`

	// Comma separated properties names that are used for sorting.
	Sort []string `json:"sort,omitempty"`

	// 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
	// existing and deleted documents are returned. (_for administrators only_).
	IsDeleted *string `json:"is_deleted,omitempty"`

	// Determines if reclaimed documents should be included in result set or not. Possible values are false (default), true
	// or any. If false, only not reclaimed documents are returned; if true, only reclaimed documents are returned; If any,
	// both reclaimed and not reclaimed documents are returned.
	IsReclaimed *string `json:"is_reclaimed,omitempty"`

	// Determines if public resources should be included in result set or not. Possible values are false (default), true or
	// any. If false, do not search public resources; if true, search only public resources; If any, search also public
	// resources.
	IsPublic *string `json:"is_public,omitempty"`

	// The user on whose behalf the search must be performed. Only a GhoST admin can impersonate a user, so be sure you set
	// a GhoST admin IAM token in the Authorization header if you set this parameter. (_for administrators only_).
	ImpersonateUser *string `json:"impersonate_user,omitempty"`

	// Determines if the result set must return the resources that the user can tag or the resources that the user can view
	// (only a GhoST admin can use this parameter). If false (default), only resources user can view are returned; if true,
	// only resources that user has permissions for tagging are returned (_for administrators only_).
	CanTag *string `json:"can_tag,omitempty"`

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

SearchOptions : The Search options.

func (*SearchOptions) SetAccountID

func (_options *SearchOptions) SetAccountID(accountID string) *SearchOptions

SetAccountID : Allow user to set AccountID

func (*SearchOptions) SetCanTag added in v0.31.3

func (_options *SearchOptions) SetCanTag(canTag string) *SearchOptions

SetCanTag : Allow user to set CanTag

func (*SearchOptions) SetFields

func (_options *SearchOptions) SetFields(fields []string) *SearchOptions

SetFields : Allow user to set Fields

func (*SearchOptions) SetHeaders

func (options *SearchOptions) SetHeaders(param map[string]string) *SearchOptions

SetHeaders : Allow user to set Headers

func (*SearchOptions) SetImpersonateUser added in v0.31.3

func (_options *SearchOptions) SetImpersonateUser(impersonateUser string) *SearchOptions

SetImpersonateUser : Allow user to set ImpersonateUser

func (*SearchOptions) SetIsDeleted added in v0.31.3

func (_options *SearchOptions) SetIsDeleted(isDeleted string) *SearchOptions

SetIsDeleted : Allow user to set IsDeleted

func (*SearchOptions) SetIsPublic added in v0.31.3

func (_options *SearchOptions) SetIsPublic(isPublic string) *SearchOptions

SetIsPublic : Allow user to set IsPublic

func (*SearchOptions) SetIsReclaimed added in v0.31.3

func (_options *SearchOptions) SetIsReclaimed(isReclaimed string) *SearchOptions

SetIsReclaimed : Allow user to set IsReclaimed

func (*SearchOptions) SetLimit

func (_options *SearchOptions) SetLimit(limit int64) *SearchOptions

SetLimit : Allow user to set Limit

func (*SearchOptions) SetQuery

func (_options *SearchOptions) SetQuery(query string) *SearchOptions

SetQuery : Allow user to set Query

func (*SearchOptions) SetSearchCursor

func (_options *SearchOptions) SetSearchCursor(searchCursor string) *SearchOptions

SetSearchCursor : Allow user to set SearchCursor

func (*SearchOptions) SetSort

func (_options *SearchOptions) SetSort(sort []string) *SearchOptions

SetSort : Allow user to set Sort

func (*SearchOptions) SetTimeout

func (_options *SearchOptions) SetTimeout(timeout int64) *SearchOptions

SetTimeout : Allow user to set Timeout

func (*SearchOptions) SetXCorrelationID added in v0.50.2

func (_options *SearchOptions) SetXCorrelationID(xCorrelationID string) *SearchOptions

SetXCorrelationID : Allow user to set XCorrelationID

func (*SearchOptions) SetXRequestID added in v0.50.2

func (_options *SearchOptions) SetXRequestID(xRequestID string) *SearchOptions

SetXRequestID : Allow user to set XRequestID

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL