ibm_cloud_global_tagging 0.1.3 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +6 -4
  3. data/README.md +387 -55
  4. data/Rakefile +7 -3
  5. data/docs/AliveResponse.md +20 -0
  6. data/docs/AliveResponseError.md +20 -0
  7. data/docs/AttachTagRequest.md +24 -0
  8. data/docs/AttachTagRequestNot.md +15 -0
  9. data/docs/CreateTagBody.md +18 -0
  10. data/docs/CreateTagResults.md +18 -0
  11. data/docs/CreateTagResultsResultsInner.md +20 -0
  12. data/docs/DeleteTagResults.md +18 -0
  13. data/docs/DeleteTagResultsItem.md +20 -0
  14. data/docs/DeleteTagsResult.md +22 -0
  15. data/docs/DeleteTagsResultItem.md +20 -0
  16. data/docs/DetachAllResourceTagsResults.md +18 -0
  17. data/docs/DetachTagRequest.md +24 -0
  18. data/docs/Error.md +28 -0
  19. data/docs/Errors.md +18 -0
  20. data/docs/GetAllResourceTagsResultsInner.md +20 -0
  21. data/docs/HealthResponse.md +26 -0
  22. data/docs/HealthSummary.md +40 -0
  23. data/docs/QueryString.md +18 -0
  24. data/docs/Resource.md +20 -0
  25. data/docs/RestoreTagsRequest.md +18 -0
  26. data/docs/RestoreTagsResults.md +18 -0
  27. data/docs/RestoreTagsResultsItem.md +24 -0
  28. data/docs/SetTagsRequest.md +20 -0
  29. data/docs/SetTagsResults.md +18 -0
  30. data/docs/Tag.md +18 -0
  31. data/docs/TagList.md +24 -0
  32. data/docs/TagResults.md +18 -0
  33. data/docs/TagResultsItem.md +22 -0
  34. data/docs/TagsApi.md +533 -0
  35. data/git_push.sh +57 -0
  36. data/ibm_cloud_global_tagging.gemspec +38 -36
  37. data/lib/ibm_cloud_global_tagging/api/tags_api.rb +731 -0
  38. data/lib/ibm_cloud_global_tagging/api_client.rb +397 -0
  39. data/lib/ibm_cloud_global_tagging/api_error.rb +58 -0
  40. data/lib/ibm_cloud_global_tagging/api_model_base.rb +88 -0
  41. data/lib/ibm_cloud_global_tagging/configuration.rb +308 -0
  42. data/lib/ibm_cloud_global_tagging/models/alive_response.rb +159 -0
  43. data/lib/ibm_cloud_global_tagging/models/alive_response_error.rb +159 -0
  44. data/lib/ibm_cloud_global_tagging/models/attach_tag_request.rb +268 -0
  45. data/lib/ibm_cloud_global_tagging/models/attach_tag_request_not.rb +102 -0
  46. data/lib/ibm_cloud_global_tagging/models/create_tag_body.rb +186 -0
  47. data/lib/ibm_cloud_global_tagging/models/create_tag_results.rb +151 -0
  48. data/lib/ibm_cloud_global_tagging/models/create_tag_results_results_inner.rb +158 -0
  49. data/lib/ibm_cloud_global_tagging/models/delete_tag_results.rb +151 -0
  50. data/lib/ibm_cloud_global_tagging/models/delete_tag_results_item.rb +193 -0
  51. data/lib/ibm_cloud_global_tagging/models/delete_tags_result.rb +171 -0
  52. data/lib/ibm_cloud_global_tagging/models/delete_tags_result_item.rb +159 -0
  53. data/lib/ibm_cloud_global_tagging/models/detach_all_resource_tags_results.rb +149 -0
  54. data/lib/ibm_cloud_global_tagging/models/detach_tag_request.rb +268 -0
  55. data/lib/ibm_cloud_global_tagging/models/error.rb +291 -0
  56. data/lib/ibm_cloud_global_tagging/models/errors.rb +151 -0
  57. data/lib/ibm_cloud_global_tagging/models/get_all_resource_tags_results_inner.rb +158 -0
  58. data/lib/ibm_cloud_global_tagging/models/health_response.rb +191 -0
  59. data/lib/ibm_cloud_global_tagging/models/health_summary.rb +259 -0
  60. data/lib/ibm_cloud_global_tagging/models/query_string.rb +175 -0
  61. data/lib/ibm_cloud_global_tagging/models/resource.rb +217 -0
  62. data/lib/ibm_cloud_global_tagging/models/restore_tags_request.rb +186 -0
  63. data/lib/ibm_cloud_global_tagging/models/restore_tags_results.rb +151 -0
  64. data/lib/ibm_cloud_global_tagging/models/restore_tags_results_item.rb +185 -0
  65. data/lib/ibm_cloud_global_tagging/models/set_tags_request.rb +224 -0
  66. data/lib/ibm_cloud_global_tagging/models/set_tags_results.rb +151 -0
  67. data/lib/ibm_cloud_global_tagging/models/tag.rb +166 -0
  68. data/lib/ibm_cloud_global_tagging/models/tag_list.rb +238 -0
  69. data/lib/ibm_cloud_global_tagging/models/tag_results.rb +151 -0
  70. data/lib/ibm_cloud_global_tagging/models/tag_results_item.rb +186 -0
  71. data/lib/ibm_cloud_global_tagging/version.rb +13 -1
  72. data/lib/ibm_cloud_global_tagging.rb +67 -7
  73. data/spec/api/tags_api_spec.rb +148 -0
  74. data/spec/models/alive_response_error_spec.rb +42 -0
  75. data/spec/models/alive_response_spec.rb +42 -0
  76. data/spec/models/attach_tag_request_not_spec.rb +21 -0
  77. data/spec/models/attach_tag_request_spec.rb +54 -0
  78. data/spec/models/create_tag_body_spec.rb +36 -0
  79. data/spec/models/create_tag_results_results_inner_spec.rb +42 -0
  80. data/spec/models/create_tag_results_spec.rb +36 -0
  81. data/spec/models/delete_tag_results_item_spec.rb +46 -0
  82. data/spec/models/delete_tag_results_spec.rb +36 -0
  83. data/spec/models/delete_tags_result_item_spec.rb +42 -0
  84. data/spec/models/delete_tags_result_spec.rb +48 -0
  85. data/spec/models/detach_all_resource_tags_results_spec.rb +36 -0
  86. data/spec/models/detach_tag_request_spec.rb +54 -0
  87. data/spec/models/error_spec.rb +70 -0
  88. data/spec/models/errors_spec.rb +36 -0
  89. data/spec/models/get_all_resource_tags_results_inner_spec.rb +42 -0
  90. data/spec/models/health_response_spec.rb +60 -0
  91. data/spec/models/health_summary_spec.rb +102 -0
  92. data/spec/models/query_string_spec.rb +36 -0
  93. data/spec/models/resource_spec.rb +42 -0
  94. data/spec/models/restore_tags_request_spec.rb +36 -0
  95. data/spec/models/restore_tags_results_item_spec.rb +54 -0
  96. data/spec/models/restore_tags_results_spec.rb +36 -0
  97. data/spec/models/set_tags_request_spec.rb +42 -0
  98. data/spec/models/set_tags_results_spec.rb +36 -0
  99. data/spec/models/tag_list_spec.rb +54 -0
  100. data/spec/models/tag_results_item_spec.rb +48 -0
  101. data/spec/models/tag_results_spec.rb +36 -0
  102. data/spec/models/tag_spec.rb +36 -0
  103. data/spec/spec_helper.rb +111 -0
  104. metadata +153 -97
  105. data/.bumpversion.cfg +0 -13
  106. data/.gitignore +0 -13
  107. data/.rspec +0 -3
  108. data/.travis.yml +0 -49
  109. data/lib/ibm_cloud_global_tagging/common.rb +0 -22
  110. data/lib/ibm_cloud_global_tagging/global_tagging_v1.rb +0 -304
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 64339a5379fa9b4f40d1f9edcd18b755ab834d12edfeaa5974b22374c61919d4
4
- data.tar.gz: 15c14eee54dcdf1971d739268ffe85089714c18a1ae1b81d979ace2661693dd5
3
+ metadata.gz: d6de0982798c7c829a0f6f331b60599b96d9ecc92864dd198e92c20c2963cfbe
4
+ data.tar.gz: fe43678a3ac21e53f716c3e36c7cb43fc7a0a291d0156bf9592fb65699d27d2b
5
5
  SHA512:
6
- metadata.gz: 4ba464af43fd711ee281729e4f1c2e1154773b7c5f39ab1921de71905f98f22df4f13b272d4f0b9d0e165b5ce4ebebd379a67ee8725b28a7ae8ef984533b3550
7
- data.tar.gz: eb22eee9a23f97cb0f9cb9383d10befc14bdf2086be59af0d673398e3993a1e585542bd16184e68a27f406476fa48fa455a909ad0269c064b0eba57ffec526c0
6
+ metadata.gz: 7e770e12fef7784d61503b9dfb71abc05371200a21a51b7f9386aec3c8ac8494bff6de7970d46c4f7565c6aace78c351c0deb422c7c12ac6e5cb3b4b90a49030
7
+ data.tar.gz: 3a269e181b234943c5eb4acc841bfc52c91685809c781997e5725b3dbfcc49a849aa1808d85a28efb5d1efce93cbbff6e82d6a02e362b123695aad585654d59f
data/Gemfile CHANGED
@@ -1,7 +1,9 @@
1
- source "https://rubygems.org"
1
+ source 'https://rubygems.org'
2
2
 
3
- # Specify your gem's dependencies in ibm_cloud_global_tagging.gemspec
4
3
  gemspec
5
4
 
6
- gem "rake", "~> 13.0"
7
- gem "rspec", "~> 3.0"
5
+ group :development, :test do
6
+ gem 'rake', '~> 13.0.1'
7
+ gem 'pry-byebug'
8
+ gem 'rubocop', '~> 0.66.0'
9
+ end
data/README.md CHANGED
@@ -1,84 +1,416 @@
1
- [![Build Status](https://travis-ci.com/IBM-Cloud/ibm-cloud-sdk-ruby.svg?token=eW5FVD71iyte6tTby8gr&branch=master)](https://travis.ibm.com/IBM-Cloud/ibm-cloud-sdk-ruby)
2
- [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
3
- # IBM Cloud Global Tagging Ruby SDK
1
+ # ibm_cloud_global_tagging
4
2
 
5
- Ruby client library to interact with various [IBM Cloud Platform Services APIs](https://cloud.ibm.com/apidocs?category=platform-services).
3
+ IbmCloudGlobalTagging - the Ruby gem for the Global Tagging
6
4
 
7
- Disclaimer: this SDK is being released initially as a **pre-release** version.
8
- Changes might occur which impact applications that use this SDK.
5
+ ## Introduction
9
6
 
10
- ## Table of Contents
7
+ You can manage your tags in IBM Cloud by using the Global Tagging API. With this API, you can create, delete, search, attach, or detach tags.
11
8
 
12
- <!--
13
- The TOC below is generated using the `markdown-toc` node package.
9
+ Tags are uniquely identified by a Cloud Resource Naming (CRN) identifier. Tags have a name, which must be unique within a billing account. You can make tags in `key:value` or `label` format.
14
10
 
15
- https://github.com/jonschlinkert/markdown-toc
11
+ SDKs for Java, Node, Python, and Go are available to make it easier to programmatically access the API from your code. The client libraries that are provided by the SDKs implement best practices for using the API and reduce the amount of code that you need to write. The tab for each language includes code examples that demonstrate how to use the client libraries. For more information about using the SDKs, see the [IBM Cloud SDK Common project](https://github.com/IBM/ibm-cloud-sdk-common) on GitHub.
16
12
 
17
- You should regenerate the TOC after making changes to this file.
13
+ Installing the Java SDK
18
14
 
19
- npx markdown-toc -i README.md
20
- -->
15
+ Maven
21
16
 
22
- <!-- toc -->
17
+ ```xml
18
+ <dependency>
19
+ <groupId>com.ibm.cloud</groupId>
20
+ <artifactId>global-tagging</artifactId>
21
+ <version>{version}</version>
22
+ </dependency>
23
+ ```
23
24
 
24
- - [Overview](#overview)
25
- - [Prerequisites](#prerequisites)
26
- - [Installation](#installation)
27
- - [Using the SDK](#using-the-sdk)
28
- - [Questions](#questions)
29
- - [Issues](#issues)
30
- - [Open source @ IBM](#open-source--ibm)
31
- - [Contributing](#contributing)
32
- - [License](#license)
25
+ Gradle
33
26
 
34
- <!-- tocstop -->
27
+ ```bash
28
+ compile 'com.ibm.cloud:global-tagging:{version}'
29
+ ```
35
30
 
36
- ## Overview
31
+ Replace `{version}` in these examples with the release version.
37
32
 
38
- The IBM Cloud Platform Services Ruby SDK allows developers to programmatically interact with the following
39
- IBM Cloud services:
33
+ View on GitHub
40
34
 
41
- Service Name | Imported Class Name
42
- --- | ---
43
- <!-- [Example Service](https://cloud.ibm.com/apidocs/example-service) | exampleservicev1 -->
35
+ [https://github.com/IBM/platform-services-java-sdk](https://github.com/IBM/platform-services-java-sdk)
44
36
 
45
- ## Prerequisites
37
+ Installing the Node SDK
46
38
 
47
- [ibm-cloud-onboarding]: https://cloud.ibm.com/registration
39
+ ```bash
40
+ npm install @ibm-cloud/platform-services
41
+ ```
48
42
 
49
- * An [IBM Cloud][ibm-cloud-onboarding] account.
50
- * An IAM API key to allow the SDK to access your account. Create one [here](https://cloud.ibm.com/iam/apikeys).
51
- * Ruby 2.3.0 or above.
43
+ View on GitHub
52
44
 
53
- ## Installation
45
+ [https://github.com/IBM/platform-services-node-sdk](https://github.com/IBM/platform-services-node-sdk)
54
46
 
55
- To install, use `gem`
47
+ Installing the Python SDK
56
48
 
57
49
  ```bash
58
- gem install "ibm_cloud_global_tagging"
50
+ pip install --upgrade \"ibm-platform-services\"
51
+ ```
52
+
53
+ View on GitHub
54
+
55
+ [https://github.com/IBM/platform-services-python-sdk](https://github.com/IBM/platform-services-python-sdk)
56
+
57
+ Installing the Go SDK
58
+
59
+ Go modules (recommended): Add the following import in your code, and then run `go build` or `go mod tidy`
60
+
61
+ ```go
62
+ import (
63
+ \"github.com/IBM/platform-services-go-sdk/globaltaggingv1\"
64
+ )
65
+ ```
66
+
67
+ Go get
68
+
69
+ ```bash
70
+ go get -u github.com/IBM/platform-services-go-sdk/globaltaggingv1
71
+ ```
72
+
73
+ View on GitHub
74
+
75
+ [https://github.com/IBM/platform-services-go-sdk](https://github.com/IBM/platform-services-go-sdk)
76
+
77
+ ### Types of tags
78
+
79
+ The Tagging API supports three types of tag: `service`, `user`, and `access`.
80
+
81
+ - Service tags are intended for services that want to attach a tag to a resource in an exclusive way: nobody else can go and detach it. A service tag is a privileged construct that only authorized services can manage. So, a regular user is not authorized to attach and detach service tags on a resource even if they have access to manage tags on the resource itself.
82
+
83
+ Service tags are supported only for resources that are onboarded to Global Search and Tagging, which means you cannot attach a service tag to a classic infrastructure (IMS) resource. Each resource can have a maximum of 1000 service tags.
84
+
85
+ - User tags are added by an authorized user in the account. Any user with the correct access role in an account can list and can delete both service and user tags in the account as long as they are not attached to any resource. Users can delete service tags because the operation is non-disruptive in that the tags aren't attached to any resource.
86
+
87
+ The Tagging API supports multiple services assigning a tag prefix at service registration time to avoid conflicts. So, a service tag name always has the form `service_prefix:tag_label`. Each resource can have maximum of 1000 user tags.
88
+
89
+ - Access management tags are used to manage access to resources, and they can be created in advance for use in access policies, which control access to resources where those tags will be attached. Only the account administrator can create access management tags, and they can delete them only when the tags aren't attached to any resources in the account. Only the resource administrator can attach and detach access management tags on the resource itself.
90
+
91
+ The name of an access management tag must be in the form of a `key:value` pair, where `value` cannot contain the `:` character. Access management tags are supported only for IAM-managed resources, which means you cannot use them to manage access to classic infrastructure (IMS) and Cloud Foundry resources. Each resource can have a maximum of 250 access tags (which is the account limit).
92
+
93
+ ### Filtering tags
94
+
95
+ Global Search and Tagging stores the different type of tags attached to a resource within a different attribute of the resource document:
96
+
97
+ - Service tags are stored within `service_tags` attribute.
98
+ - User tags are stored within the `tags` attribute.
99
+ - Access management tags are stored within the `access_tags` attribute.
100
+
101
+ So, you can add filters to those attributes when [searching for resources](https://cloud.ibm.com/apidocs/search).
102
+
103
+ For example, the following filter matches all resources tagged with the *your_service:your_tag* service tag.
104
+
105
+ ```
106
+ service_tags:\"your_service:your_tag\"
59
107
  ```
60
108
 
61
- ## Using the SDK
62
- For general SDK usage information, please see [this link](https://github.com/IBM/ibm-cloud-sdk-common/blob/master/gems/ibm_cloud_global_tagging/README.md)
109
+ The following filter matches all resources that are tagged with any service tag starting with *your_service:*.
110
+ ```
111
+ service_tags:your_service:*
112
+ ```
113
+
114
+ The following filter matches all resources that are tagged with the *my_tag* user tag.
115
+
116
+ ```
117
+ tags: \"my_tag\"
118
+ ```
119
+
120
+ Finally, the following filter matches all resources that are tagged with the *env:public* access management tag.
121
+
122
+ ```
123
+ access_tags: \"env:public\"
124
+ ```
125
+
126
+ ## Endpoint URLs
127
+
128
+ The Global Tagging API uses the following public global endpoint URL. When you call the API, add the path for each method to form the complete API endpoint for your requests.
129
+
130
+ ```
131
+ https://tags.global-search-tagging.cloud.ibm.com
132
+ ```
133
+
134
+ If you enabled service endpoints in your account, you can send API requests over the IBM Cloud® private network at the following base endpoint URLs. For more information, see [Enabling VRF and service endpoints](https://cloud.ibm.com/docs/account?topic=account-vrf-service-endpoint).
135
+
136
+ - Private endpoint URL for VPC infrastructure (Dallas, Washington, Sydney, London, Frankfurt, Madrid, San Paulo, Tokyo, Osaka, Toronto, Montreal, Chennai, Mumbai regions): `https://tags.private.global-search-tagging.cloud.ibm.com`
137
+ - Private endpoint URL for classic infrastructure:
138
+ - Dallas `https://tags.private.us-south.global-search-tagging.cloud.ibm.com`
139
+ - Washington `https://tags.private.us-east.global-search-tagging.cloud.ibm.com`
140
+ - Sydney `https://tags.private.au-syd.global-search-tagging.cloud.ibm.com`
141
+ - London `https://tags.private.eu-gb.global-search-tagging.cloud.ibm.com`
142
+ - Frankfurt `https://tags.private.eu-de.global-search-tagging.cloud.ibm.com`
143
+
144
+ Example API request
145
+
146
+ ```
147
+ curl -X POST \"https://tags.global-search-tagging.cloud.ibm.com/v3/tags/attach\" --header \"Accept: application/json\" --header \"Content-Type: application/json\" --header \"Authorization: Bearer {IAM token}\" -d '{\"tag_names\": [\"{tagName}\"], \"resources\": [ { \"resource_id\": \"{resourceCRN}\" } ] }'
148
+ ```
149
+
150
+ Replace `{IAM token}`, `{tagName}` and `{resourceCRN}` in this example with the values for your particular API call.
151
+
152
+ ## Authentication
153
+
154
+ Authorization to the Global Tagging API is enforced by using an IBM Cloud Identity and Access Management (IAM) access token. The token is used to determine the actions that a user or service ID has access to when they use the API.
155
+
156
+ Obtaining an IAM token for an authenticated user or service ID is described in the [IAM Identity Services API](https://cloud.ibm.com/apidocs/iam-identity-token-api) documentation.
157
+
158
+ To use the API, add a valid IAM token to the HTTP Authorization request header, for example, `--header \"Authorization: Bearer <TOKEN>\"`.
159
+
160
+ When you use the SDK, configure an IAM authenticator with the IAM API key. The authenticator automatically obtains the IAM access token for the API key and includes it with each request. You can construct an authenticator in either of two ways:
161
+ - Programmatically by constructing an IAM authenticator instance and supplying your IAM API key
162
+ - By defining the API key in external configuration properties and then using the SDK authenticator factory to construct an IAM authenticator that uses the configured IAM API key
163
+
164
+ In this example of using external configuration properties, an IAM authenticator instance is created with the configured API key, and then the service client is constructed with this authenticator instance and the configured service URL.
165
+
166
+ For more information, see the Authentication section of the [IBM Cloud SDK Common](https://github.com/IBM/ibm-cloud-sdk-common/blob/main/README.md) documentation.
167
+
168
+ To call each method, you'll need to be assigned a role that includes the required IAM actions. Each method lists the associated action. For more information about IAM actions and how they map to roles, see [Assigning access to account management services](https://cloud.ibm.com/docs/account?topic=account-account-services).
169
+
170
+ To retrieve your access token:
171
+
172
+ ```bash
173
+ curl -X POST \\
174
+ \"https://iam.cloud.ibm.com/identity/token\" \\
175
+ --header 'Content-Type: application/x-www-form-urlencoded' \\
176
+ --header 'Accept: application/json' \\
177
+ --data-urlencode 'grant_type=urn:ibm:params:oauth:grant-type:apikey' \\
178
+ --data-urlencode 'apikey=<API_KEY>'
179
+ ```
180
+
181
+ Replace `<API_KEY>` with your IAM API key.
182
+
183
+ Setting client options through external configuration
184
+
185
+ Example environment variables, where `<SERVICE_URL>` is the endpoint URL and `<API_KEY>` is your IAM API key
186
+ ```sh
187
+ export GLOBAL_TAGGING_URL=<SERVICE_URL>
188
+ export GLOBAL_TAGGING_AUTHTYPE=iam
189
+ export GLOBAL_TAGGING_APIKEY=<API_KEY>
190
+ ```
191
+
192
+ Example of constructing the service client
193
+ ```go
194
+ import {
195
+ \"github.com/IBM/platform-services-go-sdk/globaltaggingv1\"
196
+ }
197
+ ...
198
+ serviceClientOptions := &globaltaggingv1.GlobalTaggingV1Options{}
199
+ serviceClient, err := globaltaggingv1.NewGlobalTaggingV1UsingExternalConfig(serviceClientOptions)
200
+ ```
201
+
202
+ Setting client options through external configuration
203
+
204
+ Example environment variables, where `<SERVICE_URL>` is the endpoint URL and `<API_KEY>` is your IAM API key
205
+ ```sh
206
+ export GLOBAL_TAGGING_URL=<SERVICE_URL>
207
+ export GLOBAL_TAGGING_AUTHTYPE=iam
208
+ export GLOBAL_TAGGING_APIKEY=<API_KEY>
209
+ ```
210
+
211
+ Example of constructing the service client
212
+ ```java
213
+ import com.ibm.cloud.platform_services.global_tagging.v1.GlobalTagging;
214
+ ...
215
+ GlobalTagging serviceClient = GlobalTagging.newInstance();
216
+ ```
217
+
218
+ Setting client options through external configuration
219
+
220
+ Example environment variables, where `<SERVICE_URL>` is the endpoint URL and `<API_KEY>` is your IAM API key
221
+ ```sh
222
+ export GLOBAL_TAGGING_URL=<SERVICE_URL>
223
+ export GLOBAL_TAGGING_AUTHTYPE=iam
224
+ export GLOBAL_TAGGING_APIKEY=<API_KEY>
225
+ ```
226
+
227
+ Example of constructing the service client
228
+ ```javascript
229
+ const GlobalTaggingV1 = require('@ibm-cloud/platform-services/global-tagging/v1');
230
+ ...
231
+ const serviceClient = GlobalTaggingV1.newInstance({});
232
+ ```
233
+
234
+ Setting client options through external configuration
235
+
236
+ Example environment variables, where `<SERVICE_URL>` is the endpoint URL and `<API_KEY>` is your IAM API key
237
+ ```sh
238
+ export GLOBAL_TAGGING_URL=<SERVICE_URL>
239
+ export GLOBAL_TAGGING_AUTHTYPE=iam
240
+ export GLOBAL_TAGGING_APIKEY=<API_KEY>
241
+ ```
242
+
243
+ Example of constructing the service client
244
+ ```python
245
+ from ibm_platform_services import GlobalTaggingV1
246
+ ...
247
+ global_tagging_service = GlobalTaggingV1.new_instance()
248
+ ```
249
+
250
+ ## Auditing
251
+
252
+ You can monitor API activity within your account by using the IBM Cloud Activity Tracker. Whenever an API method is called, an event is generated that you can then track and audit from within Activity Tracker. The specific event type is listed for each individual method.
253
+
254
+ For more information about how to track tagging activity, see [Auditing events for account management](https://cloud.ibm.com/docs/activity-tracker?topic=activity-tracker-at_events_acc_mgt).
255
+
256
+ ## Error handling
257
+
258
+ The resource manager uses standard HTTP response codes to indicate whether a method completed successfully. A `200` type response always indicates success. A `400` type response is a failure, and a `500` type response is an internal system error.
259
+
260
+ | HTTP error code | Description | Recovery |
261
+ |-----------------|-------------|----------|
262
+ | `200` | Success | The request was successful. |
263
+ | `400` | Bad Request | The input parameters in the request body are either incomplete or in the wrong format. Be sure to include all required parameters in your request. |
264
+ | `401` | Unauthorized | You are not authorized to make this request. Log in to IBM Cloud and try again. If this error persists, contact the account owner to check your permissions. |
265
+ | `404` | Not Found | The requested resource could not be found. |
266
+ | `409` | Conflict | The entity is already in the requested state. |
267
+ | `410` | Gone | The resource is valid but has been removed already in a previous call |
268
+ | `500` | Internal Server Error | *offering_name* is currently unavailable. Your request could not be processed. Wait a few minutes and try again. |
269
+
270
+ ## Related APIs
271
+
272
+ After tagging resources, you can search for them by the tag name or resource groups or building even more complex search strings. For more information about advanced search capabilities that use the Lucene query syntax, see the [Global Search API](https://cloud.ibm.com/apidocs/search).
273
+
274
+ This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
275
+
276
+ - API version: 1.2.0
277
+ - Package version: 0.2.0
278
+ - Generator version: 7.23.0
279
+ - Build package: org.openapitools.codegen.languages.RubyClientCodegen
280
+
281
+ ## Installation
282
+
283
+ ### Build a gem
284
+
285
+ To build the Ruby code into a gem:
286
+
287
+ ```shell
288
+ gem build ibm_cloud_global_tagging.gemspec
289
+ ```
290
+
291
+ Then either install the gem locally:
292
+
293
+ ```shell
294
+ gem install ./ibm_cloud_global_tagging-0.2.0.gem
295
+ ```
296
+
297
+ (for development, run `gem install --dev ./ibm_cloud_global_tagging-0.2.0.gem` to install the development dependencies)
298
+
299
+ or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
300
+
301
+ Finally add this to the Gemfile:
302
+
303
+ gem 'ibm_cloud_global_tagging', '~> 0.2.0'
304
+
305
+ ### Install from Git
306
+
307
+ If the Ruby gem is hosted at a git repository: https://github.com/GIT_USER_ID/GIT_REPO_ID, then add the following in the Gemfile:
308
+
309
+ gem 'ibm_cloud_global_tagging', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git'
310
+
311
+ ### Include the Ruby code directly
312
+
313
+ Include the Ruby code directly using `-I` as follows:
314
+
315
+ ```shell
316
+ ruby -Ilib script.rb
317
+ ```
318
+
319
+ ## Getting Started
320
+
321
+ Please follow the [installation](#installation) procedure and then run the following code:
322
+
323
+ ```ruby
324
+ # Load the gem
325
+ require 'ibm_cloud_global_tagging'
326
+
327
+ # Setup authorization
328
+ IbmCloudGlobalTagging.configure do |config|
329
+ # Configure API key authorization: IAM
330
+ config.api_key['Authorization'] = 'YOUR API KEY'
331
+ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
332
+ # config.api_key_prefix['Authorization'] = 'Bearer'
333
+ end
334
+
335
+ api_instance = IbmCloudGlobalTagging::TagsApi.new
336
+ attach_tag_request = IbmCloudGlobalTagging::AttachTagRequest.new # AttachTagRequest | Array of tag names and list of resource IDs on which the tags should be attached or a valid Global Search string that dynamically identifies the resources to attach tags to. In that case the query cannot resolve to more than 100 resources, otherwise the entire operation will fail. The caller must have the permission to manage tags on those resources. The operation will fail for the other resources and a specific error is returned in the operation response. For resources that are onboarded to Global Search and Tagging, the resource ID is the CRN; for IMS resources, it is the IMS ID. The maximum number of resource IDs where the tag will be attached is 100. You can specify up to 100 tags to be attached.
337
+ opts = {
338
+ x_ims_auth_token: 'x_ims_auth_token_example', # String | The infrastructure authentication token, which can be used for attaching an infrastructure tag. It is deprecated in favor of IAM authentication token.
339
+ creator_iam_id: 'creator_iam_id_example', # String | The user on whose behalf the attach operation must be performed (_for administrators only_).
340
+ created_at: 'created_at_example', # String | The time when the tag creation must be recorded (_for administrators only_).
341
+ x_request_id: 'x_request_id_example', # String | 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.
342
+ x_correlation_id: 'x_correlation_id_example', # String | 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.
343
+ account_id: 'account_id_example', # String | The ID of the billing account of the tagged resource. It is a required parameter if `tag_type` is set to `service`. Otherwise, it is inferred from the authorization IAM token.
344
+ tag_type: 'user', # String | The type of the tag. Supported values are `user`, `service` and `access`. `service` and `access` are not supported for IMS resources.
345
+ replace: true, # Boolean | Flag to request replacement of all attached tags. Set `true` if you want to replace all tags attached to the resource with the current ones. Default value is false.
346
+ update: true # Boolean | Flag to request update of attached tags in the format `key:value`. Here's how it works for each tag in the request body: If the tag to attach is in the format `key:value`, the System will atomically detach all existing tags starting with `key:` and attach the new `key:value` tag. If no such tags exist, a new `key:value` tag will be attached. If the tag is not in the `key:value` format (e.g., a simple label), the System will attach the label as usual. The update query parameter is available for user and access management tags, but not for service tags.
347
+ }
348
+
349
+ begin
350
+ #Attach tags
351
+ result = api_instance.attach_tag(attach_tag_request, opts)
352
+ p result
353
+ rescue IbmCloudGlobalTagging::ApiError => e
354
+ puts "Exception when calling TagsApi->attach_tag: #{e}"
355
+ end
356
+
357
+ ```
358
+
359
+ ## Documentation for API Endpoints
360
+
361
+ All URIs are relative to *https://tags.global-search-tagging.cloud.ibm.com*
362
+
363
+ Class | Method | HTTP request | Description
364
+ ------------ | ------------- | ------------- | -------------
365
+ *IbmCloudGlobalTagging::TagsApi* | [**attach_tag**](docs/TagsApi.md#attach_tag) | **POST** /v3/tags/attach | Attach tags
366
+ *IbmCloudGlobalTagging::TagsApi* | [**create_tag**](docs/TagsApi.md#create_tag) | **POST** /v3/tags | Create an access management tag
367
+ *IbmCloudGlobalTagging::TagsApi* | [**delete_tag**](docs/TagsApi.md#delete_tag) | **DELETE** /v3/tags/{tag_name} | Delete an unused tag
368
+ *IbmCloudGlobalTagging::TagsApi* | [**delete_tag_all**](docs/TagsApi.md#delete_tag_all) | **DELETE** /v3/tags | Delete all unused tags
369
+ *IbmCloudGlobalTagging::TagsApi* | [**detach_tag**](docs/TagsApi.md#detach_tag) | **POST** /v3/tags/detach | Detach tags
370
+ *IbmCloudGlobalTagging::TagsApi* | [**list_tags**](docs/TagsApi.md#list_tags) | **GET** /v3/tags | Get all tags
371
+
372
+
373
+ ## Documentation for Models
374
+
375
+ - [IbmCloudGlobalTagging::AliveResponse](docs/AliveResponse.md)
376
+ - [IbmCloudGlobalTagging::AliveResponseError](docs/AliveResponseError.md)
377
+ - [IbmCloudGlobalTagging::AttachTagRequest](docs/AttachTagRequest.md)
378
+ - [IbmCloudGlobalTagging::AttachTagRequestNot](docs/AttachTagRequestNot.md)
379
+ - [IbmCloudGlobalTagging::CreateTagBody](docs/CreateTagBody.md)
380
+ - [IbmCloudGlobalTagging::CreateTagResults](docs/CreateTagResults.md)
381
+ - [IbmCloudGlobalTagging::CreateTagResultsResultsInner](docs/CreateTagResultsResultsInner.md)
382
+ - [IbmCloudGlobalTagging::DeleteTagResults](docs/DeleteTagResults.md)
383
+ - [IbmCloudGlobalTagging::DeleteTagResultsItem](docs/DeleteTagResultsItem.md)
384
+ - [IbmCloudGlobalTagging::DeleteTagsResult](docs/DeleteTagsResult.md)
385
+ - [IbmCloudGlobalTagging::DeleteTagsResultItem](docs/DeleteTagsResultItem.md)
386
+ - [IbmCloudGlobalTagging::DetachAllResourceTagsResults](docs/DetachAllResourceTagsResults.md)
387
+ - [IbmCloudGlobalTagging::DetachTagRequest](docs/DetachTagRequest.md)
388
+ - [IbmCloudGlobalTagging::Error](docs/Error.md)
389
+ - [IbmCloudGlobalTagging::Errors](docs/Errors.md)
390
+ - [IbmCloudGlobalTagging::GetAllResourceTagsResultsInner](docs/GetAllResourceTagsResultsInner.md)
391
+ - [IbmCloudGlobalTagging::HealthResponse](docs/HealthResponse.md)
392
+ - [IbmCloudGlobalTagging::HealthSummary](docs/HealthSummary.md)
393
+ - [IbmCloudGlobalTagging::QueryString](docs/QueryString.md)
394
+ - [IbmCloudGlobalTagging::Resource](docs/Resource.md)
395
+ - [IbmCloudGlobalTagging::RestoreTagsRequest](docs/RestoreTagsRequest.md)
396
+ - [IbmCloudGlobalTagging::RestoreTagsResults](docs/RestoreTagsResults.md)
397
+ - [IbmCloudGlobalTagging::RestoreTagsResultsItem](docs/RestoreTagsResultsItem.md)
398
+ - [IbmCloudGlobalTagging::SetTagsRequest](docs/SetTagsRequest.md)
399
+ - [IbmCloudGlobalTagging::SetTagsResults](docs/SetTagsResults.md)
400
+ - [IbmCloudGlobalTagging::Tag](docs/Tag.md)
401
+ - [IbmCloudGlobalTagging::TagList](docs/TagList.md)
402
+ - [IbmCloudGlobalTagging::TagResults](docs/TagResults.md)
403
+ - [IbmCloudGlobalTagging::TagResultsItem](docs/TagResultsItem.md)
63
404
 
64
- ## Questions
65
405
 
66
- If you are having difficulties using this SDK or have a question about the IBM Cloud services,
67
- please ask a question
68
- [Stack Overflow](http://stackoverflow.com/questions/ask?tags=ibm-cloud).
406
+ ## Documentation for Authorization
69
407
 
70
- ## Issues
71
- If you encounter an issue with the project, you are welcome to submit a
72
- [bug report](https://github.com/IBM-Cloud/ibm-cloud-sdk-ruby/issues).
73
- Before that, please search for similar issues. It's possible that someone has already reported the problem.
74
408
 
75
- ## Open source @ IBM
76
- Find more open source projects on the [IBM Github Page](http://ibm.github.io/)
409
+ Authentication schemes defined for the API:
410
+ ### IAM
77
411
 
78
- ## Contributing
79
- See [CONTRIBUTING.md](https://github.com/IBM-Cloud/ibm-cloud-sdk-ruby/blob/master/gems/ibm_cloud_global_tagging/CONTRIBUTING.md).
80
412
 
81
- ## License
413
+ - **Type**: API key
414
+ - **API key parameter name**: Authorization
415
+ - **Location**: HTTP header
82
416
 
83
- This SDK is released under the Apache 2.0 license.
84
- The license's full text can be found in [LICENSE](https://github.com/IBM-Cloud/ibm-cloud-sdk-ruby/blob/master/gems/ibm_cloud_global_tagging/LICENSE).
data/Rakefile CHANGED
@@ -1,6 +1,10 @@
1
1
  require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
3
2
 
4
- RSpec::Core::RakeTask.new(:spec)
3
+ begin
4
+ require 'rspec/core/rake_task'
5
5
 
6
- task :default => :spec
6
+ RSpec::Core::RakeTask.new(:spec)
7
+ task default: :spec
8
+ rescue LoadError
9
+ # no rspec available
10
+ end
@@ -0,0 +1,20 @@
1
+ # IbmCloudGlobalTagging::AliveResponse
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **deploy_version** | **String** | deploy version | [optional] |
8
+ | **http_code** | **Integer** | code http | [optional] |
9
+
10
+ ## Example
11
+
12
+ ```ruby
13
+ require 'ibm_cloud_global_tagging'
14
+
15
+ instance = IbmCloudGlobalTagging::AliveResponse.new(
16
+ deploy_version: null,
17
+ http_code: null
18
+ )
19
+ ```
20
+
@@ -0,0 +1,20 @@
1
+ # IbmCloudGlobalTagging::AliveResponseError
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **message** | **String** | message text | [optional] |
8
+ | **stack** | **String** | error stack | [optional] |
9
+
10
+ ## Example
11
+
12
+ ```ruby
13
+ require 'ibm_cloud_global_tagging'
14
+
15
+ instance = IbmCloudGlobalTagging::AliveResponseError.new(
16
+ message: null,
17
+ stack: null
18
+ )
19
+ ```
20
+
@@ -0,0 +1,24 @@
1
+ # IbmCloudGlobalTagging::AttachTagRequest
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **tag_name** | **String** | The name of the tag to attach | [optional] |
8
+ | **tag_names** | **Array&lt;String&gt;** | An array of tag names to attach | [optional] |
9
+ | **resources** | [**Array&lt;Resource&gt;**](Resource.md) | List of resources on which the tagging operation operates on | [optional] |
10
+ | **query** | [**QueryString**](QueryString.md) | | [optional] |
11
+
12
+ ## Example
13
+
14
+ ```ruby
15
+ require 'ibm_cloud_global_tagging'
16
+
17
+ instance = IbmCloudGlobalTagging::AttachTagRequest.new(
18
+ tag_name: null,
19
+ tag_names: null,
20
+ resources: null,
21
+ query: null
22
+ )
23
+ ```
24
+
@@ -0,0 +1,15 @@
1
+ # IbmCloudGlobalTagging::AttachTagRequestNot
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+
8
+ ## Example
9
+
10
+ ```ruby
11
+ require 'ibm_cloud_global_tagging'
12
+
13
+ instance = IbmCloudGlobalTagging::AttachTagRequestNot.new()
14
+ ```
15
+
@@ -0,0 +1,18 @@
1
+ # IbmCloudGlobalTagging::CreateTagBody
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **tag_names** | **Array&lt;String&gt;** | An array of tag names to create | |
8
+
9
+ ## Example
10
+
11
+ ```ruby
12
+ require 'ibm_cloud_global_tagging'
13
+
14
+ instance = IbmCloudGlobalTagging::CreateTagBody.new(
15
+ tag_names: null
16
+ )
17
+ ```
18
+
@@ -0,0 +1,18 @@
1
+ # IbmCloudGlobalTagging::CreateTagResults
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **results** | [**Array&lt;CreateTagResultsResultsInner&gt;**](CreateTagResultsResultsInner.md) | Array of results of a create_tag request. | [optional] |
8
+
9
+ ## Example
10
+
11
+ ```ruby
12
+ require 'ibm_cloud_global_tagging'
13
+
14
+ instance = IbmCloudGlobalTagging::CreateTagResults.new(
15
+ results: null
16
+ )
17
+ ```
18
+
@@ -0,0 +1,20 @@
1
+ # IbmCloudGlobalTagging::CreateTagResultsResultsInner
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **tag_name** | **String** | The name of the tag created | [optional] |
8
+ | **is_error** | **Boolean** | true if the tag was not created (for example, the tag already exists). | [optional] |
9
+
10
+ ## Example
11
+
12
+ ```ruby
13
+ require 'ibm_cloud_global_tagging'
14
+
15
+ instance = IbmCloudGlobalTagging::CreateTagResultsResultsInner.new(
16
+ tag_name: null,
17
+ is_error: null
18
+ )
19
+ ```
20
+