Go client library to interact with various IBM Cloud Security and Compliance Center APIs.
The IBM Cloud Security and Compliance Center Go SDK allows developers to programmatically interact with the following IBM Cloud Security and Compliance Center.
- An IBM Cloud account.
- An IAM API key to allow the SDK to access your account. Create one here.
- Go version 1.12 or above.
The current version of this SDK: v5.5.1
If your application uses Go modules for dependency management (recommended), just add an import for each service
that you will use in your application.
Here is an example:
import (
"github.com/IBM/scc-go-sdk/v5/securityandcompliancecenterapiv3"
)
Next, run go build
or go mod tidy
to download and install the new dependencies and update your application's
go.mod
file.
In the example above, the securityandcompliancecenterapiv3
part of the import path is the package name
associated with the Findings service.
See the service table above to find the appropriate package name for the services used by your application.
Alternatively, you can use the go get
command to download and install the appropriate packages needed by your application:
go get -u github.com/IBM/scc-go-sdk/v5
Be sure to use the appropriate package name from the service table above for the services used by your application.
For general SDK usage information, please see this link
package main
import (
"github.com/IBM/go-sdk-core/v5/core"
scc "github.com/IBM/scc-go-sdk/v5/securityandcompliancecenterapiv3"
)
func main() {
// Initialize Client
apiClient, err := scc.NewSecurityAndComplianceCenterApiV3(
&scc.SecurityAndComplianceCenterApiV3Options{
URL: "https://{region}.compliance.cloud.ibm.com",
Authenticator: &core.IamAuthenticator{
ApiKey: "{ibmcloud_api_key}",
},
},
)
...
// Example: Grab a list of profiles
lpo := scc.ListProfilesOptions{
InstanceID: "{instance_id}",
}
profiles, res, err := apiClient.ListProfiles(&lpo)
...
}
To test out any changes to SDK locally, security_and_compliance_center_api_v3.env
should be in the base directory of the current version.
SECURITY_AND_COMPLIANCE_CENTER_API_URL=https://us-south.compliance.cloud.ibm.com
SECURITY_AND_COMPLIANCE_CENTER_API_IAM_APIKEY_URL=https://iam.cloud.ibm.com/identity/token
SECURITY_AND_COMPLIANCE_CENTER_API_IAM=<INSERT_SECRET_API_KEY>
SECURITY_AND_COMPLIANCE_CENTER_API_SERVICENAME=SECURITY AND COMPLIANCE CENTER
SECURITY_AND_COMPLIANCE_CENTER_API_ACCOUNTID=<INSERT_IBM_ACCOUNT_ID>
SECURITY_AND_COMPLIANCE_CENTER_API_INSTANCEID=<INSERT_SCC_INSTANCE_ID>
SECURITY_AND_COMPLIANCE_CENTER_API_ATTACHMENTID=<INSERT_SCC_PROFILE_ATTACHMENT_ID>
SECURITY_AND_COMPLIANCE_CENTER_API_PROFILEID=<INSERT_SCC_PROFILE_ID
SECURITY_AND_COMPLIANCE_CENTER_API_AUTHTYPE=noauth
If you are having difficulties using this SDK or have a question about the IBM Cloud services, please ask a question at Stack Overflow.
If you encounter an issue with the project, you are welcome to submit a bug report. Before that, please search for similar issues. It's possible that someone has already reported the problem.
Find more open source projects on the IBM Github Page
See CONTRIBUTING.
The IBM Cloud Security and Compliance Center Go SDK is released under the Apache 2.0 license. The license's full text can be found in LICENSE.