Go API client for Keyfactor Command
This reference serves to document REST-based methods to manage and integrate with Keyfactor. In addition, an embedded
interface allows for the execution of calls against the current Keyfactor API instance.
This API client was generated against Command version 24.4.2.
Please reference the Keyfactor Command API Change Log for information about API endpoint support for your specific version of Keyfactor Command.
Support for Keyfactor Command Go Client SDK
Keyfactor Command Go Client SDK is open source and supported on best effort level for this tool/library/client.
This means customers can report Bugs, Feature Requests, Documentation amendment or questions as well as requests for
customer information required for setup that needs Keyfactor access to obtain. Such requests do not follow normal SLA
commitments for response or resolution. If you have a support issue, please open a support ticket via the Keyfactor
Support Portal at https://support.keyfactor.com/
To report a problem or suggest a new feature, use the
Issues tab. If you want to contribute actual bug fixes or proposed enhancements, use the
Pull requests tab.
Overview
This API client was generated by the OpenAPI Generator project. By using
the OpenAPI-spec from a remote server, you can easily generate an API client.
Installation
Install the following dependencies:
go get "github.com/Keyfactor/keyfactor-go-client-sdk/v24"
Put the package under your project folder and add the following in import:
package main
import "github.com/Keyfactor/keyfactor-go-client-sdk/api/keyfactor/v24"
Configuration
Configuration of the API client is done through the github.com/Keyfactor/keyfactor-auth-client-go/auth_providers Go package.
Here is an example of configuring your API client:
import (
"context"
"os"
"github.com/Keyfactor/keyfactor-auth-client-go/auth_providers"
"github.com/Keyfactor/keyfactor-go-client-sdk/v24"
)
hostname := os.Getenv(auth_providers.EnvKeyfactorHostName)
apiPath := os.Getenv(auth_providers.EnvKeyfactorAPIPath)
clientId := os.Getenv(auth_providers.EnvKeyfactorClientID)
clientSecret := os.Getenv(auth_providers.EnvKeyfactorClientSecret)
tokenUrl := os.Getenv(auth_providers.EnvKeyfactorAuthTokenURL)
oAuthNoParamsConfig := auth_providers.CommandConfigOauth{}
oAuthNoParamsConfig.CommandAuthConfig.
WithCommandHostName(hostname).
WithCommandAPIPath(apiPath).
WithSkipVerify(false).
WithClientTimeout(10)
oAuthNoParamsConfig.
WithClientId(clientId).
WithClientSecret(clientSecret).
WithTokenUrl(tokenUrl).
Authenticate()
// Configure API client
client, err := keyfactor.NewAPIClient(oAuthNoParamsConfig.GetServerConfig())
ctx := context.Background()
// api := client.V1.ExampleApi // Access V1 API Service
// req := api.NewExampleRequest(ctx) // Generate request
// resp, http, err := req.Execute() // Execute request
// api := client.V2.ExampleApi // Access V2 API Service
// req := api.NewExampleRequest(ctx) // Generate request
// resp, http, err := req.Execute() // Execute request
Documentation for API Endpoints
All documentation for the APIs can be found in its respective API directory: