Skip to content

Commit 2ac6736

Browse files
fix(Global Search/Tagging): regenerated services with latest API definition (#116)
1 parent 37152dc commit 2ac6736

File tree

4 files changed

+101
-113
lines changed

4 files changed

+101
-113
lines changed

ibm_platform_services/global_search_v2.py

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,17 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
# IBM OpenAPI SDK Code Generator Version: 99-SNAPSHOT-b414353e-20210324-135924
17+
# IBM OpenAPI SDK Code Generator Version: 3.33.0-caf29bd0-20210603-225214
1818

1919
"""
2020
Search for resources with the global and shared resource properties repository integrated
21-
in the IBM Cloud Platform. The search repository stores and searches cloud resources
21+
in the IBM Cloud platform. The search repository stores and searches cloud resources
2222
attributes, which categorize or classify resources. A resource is a physical or logical
23-
component that can be provisioned or reserved for an application or service instance and
24-
is owned by resource providers, such as Cloud Foundry, IBM containers, or Resource
25-
Controller, in the IBM Cloud platform. Resources are uniquely identified by a CRN (Cloud
26-
Resource Naming identifier) or by an IMS ID. The properties of a resource include tags and
27-
system properties. Both properties are defined in an IBM Cloud billing account, and span
28-
across many regions.
23+
component that can be created or reserved for an application or service instance and is
24+
owned by resource providers, such as Cloud Foundry, IBM Kubernetes Service, or resource
25+
controller in IBM Cloud. Resources are uniquely identified by a Cloud Resource Name (CRN)
26+
or by an IMS ID. The properties of a resource include tags and system properties. Both
27+
properties are defined in an IBM Cloud billing account, and span across many regions.
2928
"""
3029

3130
from typing import Dict, List
@@ -98,21 +97,22 @@ def search(self,
9897
"""
9998
Find instances of resources (v3).
10099
101-
Find cloud foundry resources, resource controller-enabled resources, or storage
102-
and network resources running on classic infrastructure in a specific account ID.
103-
You can apply query strings if necessary. To filter results, you can insert a
104-
string using the Lucene syntax and the query string is parsed into a series of
105-
terms and operators. A term can be a single word or a phrase, in which case the
106-
search is performed for all the words, in the same order. To filter for a specific
107-
value regardless of the property that contains it, use an asterisk as the key
108-
name. Only resources that belong to the account ID and that are accessible by the
109-
client are returned. You must use this operation when you need to fetch more than
110-
`10000` resource items. The `/v2/resources/search` prohibits paginating through
111-
such a big number. On the first call, the operation returns a live cursor on the
112-
data that you must use on all the subsequent calls to get the next batch of
113-
results until you get the empty result set. By default, the fields returned for
114-
every resources are: "crn", "name", "family", "type", "account_id". You can
115-
specify the subset of the fields you want in your request.
100+
Find Cloud Foundry resources, IAM-enabled resources, or storage and network
101+
resources running on classic infrastructure in a specific account ID. You can
102+
apply query strings if necessary.
103+
To filter results, you can insert a string using the Lucene syntax and the query
104+
string is parsed into a series of terms and operators. A term can be a single
105+
word or a phrase, in which case the search is performed for all the words, in the
106+
same order. To filter for a specific value regardless of the property that
107+
contains it, type the search term without specifying a field. Only resources that
108+
belong to the account ID and that are accessible by the client are returned.
109+
You must use `/v3/resources/search` when you need to fetch more than `10000`
110+
resource items. The `/v2/resources/search` prohibits paginating through such a
111+
big number. On the first call, the operation returns a live cursor on the data
112+
that you must use on all the subsequent calls to get the next batch of results
113+
until you get the empty result set. By default, the fields returned for every
114+
resource are "crn", "name", "family", "type", and "account_id". You can specify
115+
the subset of the fields you want in your request.
116116
117117
:param str query: (optional) The Lucene-formatted query string. Default to
118118
'*' if not set.

ibm_platform_services/global_tagging_v1.py

Lines changed: 19 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
# IBM OpenAPI SDK Code Generator Version: 99-SNAPSHOT-a8493a65-20210115-083246
17+
# IBM OpenAPI SDK Code Generator Version: 3.33.0-caf29bd0-20210603-225214
1818

1919
"""
2020
Manage your tags with the Tagging API in IBM Cloud. You can attach, detach, delete a tag
@@ -115,15 +115,16 @@ def list_tags(self,
115115
provider, `ghost`, `ims` or `ghost,ims`, where the tag exists and the
116116
number of attached resources.
117117
:param List[str] providers: (optional) Select a provider. Supported values
118-
are `ghost` and `ims`. To list GhoST tags and infrastructure tags use
119-
`ghost,ims`. `service` and `access` tags can only be attached to GhoST
120-
onboarded resources, so you should not set this parameter when listing
121-
them.
118+
are `ghost` and `ims`. To list both Global Search and Tagging tags and
119+
infrastructure tags, use `ghost,ims`. `service` and `access` tags can only
120+
be attached to resources that are onboarded to Global Search and Tagging,
121+
so you should not set this parameter when listing them.
122122
:param str attached_to: (optional) If you want to return only the list of
123123
tags attached to a specified resource, pass the ID of the resource on this
124-
parameter. For GhoST onboarded resources, the resource ID is the CRN; for
125-
IMS resources, it is the IMS ID. When using this parameter, you must
126-
specify the appropriate provider (`ims` or `ghost`).
124+
parameter. For resources that are onboarded to Global Search and Tagging,
125+
the resource ID is the CRN; for IMS resources, it is the IMS ID. When using
126+
this parameter, you must specify the appropriate provider (`ims` or
127+
`ghost`).
127128
:param int offset: (optional) The offset is the index of the item from
128129
which you want to start returning data from.
129130
:param int limit: (optional) The number of tags to return.
@@ -311,7 +312,8 @@ def delete_tag(self,
311312
312313
:param str tag_name: The name of tag to be deleted.
313314
:param List[str] providers: (optional) Select a provider. Supported values
314-
are `ghost` and `ims`. To delete tag both in GhoST in IMS, use `ghost,ims`.
315+
are `ghost` and `ims`. To delete tags both in Global Search and Tagging and
316+
in IMS, use `ghost,ims`.
315317
:param str impersonate_user: (optional) The user on whose behalf the delete
316318
operation must be performed (_for administrators only_).
317319
:param str account_id: (optional) The ID of the billing account to delete
@@ -370,14 +372,7 @@ def attach_tag(self,
370372
"""
371373
Attach tags.
372374
373-
Attaches one or more tags to one or more resources. To attach a `user` tag on a
374-
resource, you must have the access listed in the [Granting users access to tag
375-
resources](https://cloud.ibm.com/docs/account?topic=account-access) documentation.
376-
To attach a `service` tag, you must be an authorized service. If that is the case,
377-
then you can attach a `service` tag with your registered `prefix` to any resource
378-
in any account. The account ID must be set through the `account_id` query
379-
parameter. To attach an `access` tag, you must be the resource administrator
380-
within the account. You can attach only `access` tags already existing.
375+
Attaches one or more tags to one or more resources.
381376
382377
:param List[Resource] resources: List of resources on which the tag or tags
383378
should be attached.
@@ -449,14 +444,7 @@ def detach_tag(self,
449444
"""
450445
Detach tags.
451446
452-
Detaches one or more tags from one or more resources. To detach a `user` tag on a
453-
resource you must have the permissions listed in the [Granting users access to tag
454-
resources](https://cloud.ibm.com/docs/account?topic=account-access) documentation.
455-
To detach a `service` tag you must be an authorized Service. If that is the case,
456-
then you can detach a `service` tag with your registered `prefix` from any
457-
resource in any account. The account ID must be set through the `account_id` query
458-
parameter. To detach an `access` tag, you must be the resource administrator
459-
within the account.
447+
Detaches one or more tags from one or more resources.
460448
461449
:param List[Resource] resources: List of resources on which the tag or tags
462450
should be detached.
@@ -530,10 +518,10 @@ class TagType(str, Enum):
530518
ACCESS = 'access'
531519
class Providers(str, Enum):
532520
"""
533-
Select a provider. Supported values are `ghost` and `ims`. To list GhoST tags and
534-
infrastructure tags use `ghost,ims`. `service` and `access` tags can only be
535-
attached to GhoST onboarded resources, so you should not set this parameter when
536-
listing them.
521+
Select a provider. Supported values are `ghost` and `ims`. To list both Global
522+
Search and Tagging tags and infrastructure tags, use `ghost,ims`. `service` and
523+
`access` tags can only be attached to resources that are onboarded to Global
524+
Search and Tagging, so you should not set this parameter when listing them.
537525
"""
538526
GHOST = 'ghost'
539527
IMS = 'ims'
@@ -586,8 +574,8 @@ class DeleteTagEnums:
586574

587575
class Providers(str, Enum):
588576
"""
589-
Select a provider. Supported values are `ghost` and `ims`. To delete tag both in
590-
GhoST in IMS, use `ghost,ims`.
577+
Select a provider. Supported values are `ghost` and `ims`. To delete tags both in
578+
Global Search and Tagging and in IMS, use `ghost,ims`.
591579
"""
592580
GHOST = 'ghost'
593581
IMS = 'ims'

test/unit/test_global_search_v2.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
# (C) Copyright IBM Corp. 2020.
2+
# (C) Copyright IBM Corp. 2021.
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.
@@ -28,12 +28,12 @@
2828
from ibm_platform_services.global_search_v2 import *
2929

3030

31-
service = GlobalSearchV2(
31+
_service = GlobalSearchV2(
3232
authenticator=NoAuthAuthenticator()
3333
)
3434

35-
base_url = 'https://api.global-search-tagging.cloud.ibm.com'
36-
service.set_service_url(base_url)
35+
_base_url = 'https://api.global-search-tagging.cloud.ibm.com'
36+
_service.set_service_url(_base_url)
3737

3838
##############################################################################
3939
# Start of Service: Search
@@ -60,7 +60,7 @@ def test_search_all_params(self):
6060
search()
6161
"""
6262
# Set up mock
63-
url = self.preprocess_url(base_url + '/v3/resources/search')
63+
url = self.preprocess_url(_base_url + '/v3/resources/search')
6464
mock_response = '{"search_cursor": "search_cursor", "limit": 5, "items": [{"crn": "crn"}]}'
6565
responses.add(responses.POST,
6666
url,
@@ -79,7 +79,7 @@ def test_search_all_params(self):
7979
sort = ['testString']
8080

8181
# Invoke method
82-
response = service.search(
82+
response = _service.search(
8383
query=query,
8484
fields=fields,
8585
search_cursor=search_cursor,
@@ -114,7 +114,7 @@ def test_search_required_params(self):
114114
test_search_required_params()
115115
"""
116116
# Set up mock
117-
url = self.preprocess_url(base_url + '/v3/resources/search')
117+
url = self.preprocess_url(_base_url + '/v3/resources/search')
118118
mock_response = '{"search_cursor": "search_cursor", "limit": 5, "items": [{"crn": "crn"}]}'
119119
responses.add(responses.POST,
120120
url,
@@ -128,7 +128,7 @@ def test_search_required_params(self):
128128
search_cursor = 'testString'
129129

130130
# Invoke method
131-
response = service.search(
131+
response = _service.search(
132132
query=query,
133133
fields=fields,
134134
search_cursor=search_cursor,
@@ -175,7 +175,7 @@ def test_get_supported_types_all_params(self):
175175
get_supported_types()
176176
"""
177177
# Set up mock
178-
url = self.preprocess_url(base_url + '/v2/resources/supported_types')
178+
url = self.preprocess_url(_base_url + '/v2/resources/supported_types')
179179
mock_response = '{"supported_types": ["supported_types"]}'
180180
responses.add(responses.GET,
181181
url,
@@ -184,7 +184,7 @@ def test_get_supported_types_all_params(self):
184184
status=200)
185185

186186
# Invoke method
187-
response = service.get_supported_types()
187+
response = _service.get_supported_types()
188188

189189

190190
# Check for correct operation
@@ -202,7 +202,7 @@ def test_get_supported_types_all_params(self):
202202
# Start of Model Tests
203203
##############################################################################
204204
# region
205-
class TestResultItem():
205+
class ResultItemUnitTests():
206206
"""
207207
Test Class for ResultItem
208208
"""
@@ -232,7 +232,7 @@ def test_result_item_serialization(self):
232232
result_item_model_json2 = result_item_model.to_dict()
233233
assert result_item_model_json2 == result_item_model_json
234234

235-
class TestScanResult():
235+
class ScanResultUnitTests():
236236
"""
237237
Test Class for ScanResult
238238
"""
@@ -269,7 +269,7 @@ def test_scan_result_serialization(self):
269269
scan_result_model_json2 = scan_result_model.to_dict()
270270
assert scan_result_model_json2 == scan_result_model_json
271271

272-
class TestSupportedTypesList():
272+
class SupportedTypesListUnitTests():
273273
"""
274274
Test Class for SupportedTypesList
275275
"""

0 commit comments

Comments
 (0)