Skip to content

Invalid API endpoint causes the API endpoint to be reset #208

@adi-g15-ibm

Description

@adi-g15-ibm

By default, ibmcloud API endpoint is set to https://cloud.ibm.com.

But when someone passed an invalid/wrong endpoint and it fails to set the endpoint, still it resets the endpoint.

Current Behaviour:

After an invalid usage of 'ibmcloud api INVALID_ENDPOINT', endpoint is reset, and you again have to set the endpoint to https://cloud.ibm.com, using ibmcloud api https://cloud.ibm.com

This might be intentional, but I felt it should not reset the API if usage failed, and just retained the last context/endpoint

➜  ~ ibmcloud api               
API endpoint: https://cloud.ibm.com
➜  ~ ibmcloud api watsonx
Setting api endpoint...
FAILED
Could not determine the API endpoint

# Endpoint has been reset
➜  ~ ibmcloud api        
No api endpoint set. Use 'ibmcloud api' to set an endpoint
Default api endpoint: https://cloud.ibm.com

# Need to set the endpoint manually to the default
➜  ~ ibmcloud api https://cloud.ibm.com       
Setting api endpoint...
OK

API endpoint: https://cloud.ibm.com
Not logged in. Use 'ibmcloud login' to log in.
➜  ~ ibmcloud api                      
API endpoint: https://cloud.ibm.com

Expected Behaviour

➜  ~ ibmcloud api               
API endpoint: https://cloud.ibm.com
➜  ~ ibmcloud api watsonx
Setting api endpoint...
FAILED
Could not determine the API endpoint

# Maybe better to not change anything, since the last command failed
➜  ~ ibmcloud api               
API endpoint: https://cloud.ibm.com

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions