Skip to content

Commit 999913d

Browse files
authored
Merge pull request #325 from IBM-Cloud/dev
docs: Added how to handle empty object using --output json
2 parents ce40442 + e9590e0 commit 999913d

File tree

2 files changed

+21
-11
lines changed

2 files changed

+21
-11
lines changed

.secrets.baseline

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"files": "^.secrets.baseline$|go.sum",
44
"lines": null
55
},
6-
"generated_at": "2022-05-16T18:04:42Z",
6+
"generated_at": "2022-06-27T21:25:41Z",
77
"plugins_used": [
88
{
99
"name": "AWSKeyDetector"
@@ -31,6 +31,9 @@
3131
"ghe_instance": "github.ibm.com",
3232
"name": "GheDetector"
3333
},
34+
{
35+
"name": "GitHubTokenDetector"
36+
},
3437
{
3538
"hex_limit": 3,
3639
"name": "HexHighEntropyString"
@@ -353,7 +356,7 @@
353356
}
354357
]
355358
},
356-
"version": "0.13.1+ibm.48.dss",
359+
"version": "0.13.1+ibm.46.dss",
357360
"word_list": {
358361
"file": null,
359362
"hash": null

docs/plugin_developer_guide.md

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ IBM Cloud CLI SDK provides a set of APIs to register and manage plug-ins. It als
4848
Minor: 0,
4949
Build: 1,
5050
},
51-
51+
5252
PrivateEndpointSupported: true,
5353
5454
Commands: []plugin.Command{
@@ -729,6 +729,13 @@ $ibmcloud account orgs --output json
729729
[]
730730
```
731731

732+
If the output is expected to be an object but no object is returned the plugin should return the normal error: For example, if a service-id could not be found then an error is returned:
733+
```
734+
$ibmcloud iam service-id 15a15a0f-725e-453a-b3ac-755280ad7300 --output json
735+
FAILED
736+
Service ID '15a15a0f-725e-453a-b3ac-755280ad7300' was not found.
737+
```
738+
732739
### 2.12. Common options
733740

734741
Customers will be writing scripts that use multiple services. Consistency with option names will help them be successful.
@@ -960,8 +967,8 @@ config.SetRefreshToken(newRefreshToken)
960967

961968
### 5.3 VPC Compute Resource Identity Authentication
962969

963-
#### 5.3.1 Get the IAM Access Token
964-
The IBM CLoud CLI supports logging in as a VPC compute resource identity. The CLI will fetch a VPC instance identity token and exchange it for an IAM access token when logging in as a VPC compute resource identity. This access token is stored in configuration once a user successfully logs into the CLI.
970+
#### 5.3.1 Get the IAM Access Token
971+
The IBM CLoud CLI supports logging in as a VPC compute resource identity. The CLI will fetch a VPC instance identity token and exchange it for an IAM access token when logging in as a VPC compute resource identity. This access token is stored in configuration once a user successfully logs into the CLI.
965972

966973
Plug-ins can invoke `plugin.PluginContext.IsLoggedInAsCRI()` and `plugin.PluginContext.CRIType()` in the CLI SDK to detect whether the user has logged in as a VPC compute resource identity.
967974
You can get the IAM access token resulting from the user logging in as a VPC compute resource identity from the IBM CLoud SDK as follows:
@@ -1156,7 +1163,7 @@ When users are using CLI, they probably have already targeted region or resource
11561163
region = config.CurrentRegion().Name
11571164
ui.Say("Currently targeted region: " + region)
11581165
}
1159-
1166+
11601167
// get currently targeted resource group
11611168
group := ""
11621169
if config.HasTargetedResourceGroup() {
@@ -1173,23 +1180,23 @@ When users are using CLI, they probably have already targeted region or resource
11731180
11741181
## 9. Private Endpoint Support
11751182
1176-
Private endpoint enables customers to connect to IBM Cloud services over IBM's private network. Plug-ins should provide the private endpoint support whenever possible. If the user chooses to use the private endpoint, all the traffic between the CLI client and IBM Cloud services must go through the private network. If private endpoint is not supported by the plug-in, the CLI should fail any requests instead of falling back to using the public network.
1183+
Private endpoint enables customers to connect to IBM Cloud services over IBM's private network. Plug-ins should provide the private endpoint support whenever possible. If the user chooses to use the private endpoint, all the traffic between the CLI client and IBM Cloud services must go through the private network. If private endpoint is not supported by the plug-in, the CLI should fail any requests instead of falling back to using the public network.
11771184

11781185
**Choosing private endpoint**
11791186

1180-
IBM CLoud CLI users can select to go with private network by specifying `private.cloud.ibm.com` as the API endpoint of IBM Cloud CLI, either with command `ibmcloud api private.cloud.ibm.com` or `ibmcloud login -a private.cloud.ibm.com`.
1187+
IBM CLoud CLI users can select to go with private network by specifying `private.cloud.ibm.com` as the API endpoint of IBM Cloud CLI, either with command `ibmcloud api private.cloud.ibm.com` or `ibmcloud login -a private.cloud.ibm.com`.
11811188

1182-
Plug-ins can invoke `plugin.PluginContext.IsPrivateEndpointEnabled()` in the CLI SDK to detect whether the user has selected private endpoint or not.
1189+
Plug-ins can invoke `plugin.PluginContext.IsPrivateEndpointEnabled()` in the CLI SDK to detect whether the user has selected private endpoint or not.
11831190

11841191
**Publishing Plug-in with private endpoint support**
11851192

11861193
There is a field `private_endpoint_supported` in the plug-in metadata file indicating whether a plug-in supports private endpoint or not. The default value is `false`. When publishing a plug-in, it needs to be set to `true` if the plug-in has private endpoint support. Likewise, in the plug-in Golang code, the `plugin.PluginMetadata` struct needs to have the `PrivateEndpointSupported` field set the same as this field in the metadata file. Otherwise the core CLI will fail the plug-in commands if the user chooses to use private endpoint.
11871194

1188-
If the plug-in for an IBM Cloud service only has partial private endpoint support in specific regions, this field should still be set to be `true`. It is the plug-in's responsibility to get the region setting and decide whether to fail the command or not. The plug-in should not fall back to the public endpoint if the region does not have private endpoint support.
1195+
If the plug-in for an IBM Cloud service only has partial private endpoint support in specific regions, this field should still be set to be `true`. It is the plug-in's responsibility to get the region setting and decide whether to fail the command or not. The plug-in should not fall back to the public endpoint if the region does not have private endpoint support.
11891196
11901197
**Private endpoints of platform services**
11911198
1192-
The CLI SDK provides an API to retrieve both the public endpoint and private endpoint of core platform services.
1199+
The CLI SDK provides an API to retrieve both the public endpoint and private endpoint of core platform services.
11931200
11941201
`plugin.PluginContext.ConsoleEndpoint()` returns the public endpoint of IBM Cloud console API if the user selects to go with public endpoint. It returns private endpoint of IBM Cloud console API if the user chooses private endpoint when logging into IBM Cloud.
11951202

0 commit comments

Comments
 (0)