IBM / scc-go-sdk

GoLang SDK for IBM Cloud Security and Compliance Center
https://cloud.ibm.com/docs/security-compliance
Apache License 2.0
2 stars 9 forks source link

Default service URL should be a global one #55

Closed hardt-rmt closed 2 years ago

hardt-rmt commented 2 years ago

Describe the bug The SDK needs to have a global default service URL of https://us.compliance.cloud.ibm.com. At the moment when a user is running the SDK using terraform they need to declare an endpoint called IBMCLOUD_SCC_ADMIN_API_ENDPOINT in order to run the SDK. This endpoint can vary based on regions but if this endpoint is not declared, the SDK defaults to https://admin-service-api.cloud.ibm.com which returns an error.

To Reproduce Try running https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/data-sources/scc_account_location without exporting the IBMCLOUD_SCC_ADMIN_API_ENDPOINT in your environment. You will get an error message as shown in the screenshot below

Expected behavior The SDK should return the account location, locations, and location details

Screenshots

Screen Shot 2021-12-08 at 12 31 15 AM

Must gather (please complete the following information):

Additional context Add any other context about the problem here.
Were you able to avoid the problem by changing your application code slightly?

gary1998 commented 2 years ago

Viewing the admin-service code, looks like the code was generated before adding the regional URLs in the API definition document. I'd check the document and it has the regional URLs listed, and looks good to me. I'd suggest to regenerate the codebase using the latest version of openapi-sdkgen and see if the code has valid DefaultServiceURL and a valid function to get URL corresponding to different regions.

gary1998 commented 2 years ago

Default service URL is now updated, https://github.com/IBM/scc-go-sdk/blob/main/v3/adminserviceapiv1/admin_service_api_v1.go#L44

Closing this issue. Please feel free to re-open if the problem still persists.