Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

README.md

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 25.1.1.

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/v25"

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/v25"

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/v25"
)

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.NewUpdateExampleRequest(ctx) // Build new API request
// req = req.ExampleUpdateRequest(V1.ExampleUpdateRequest{ Name: "Hello" }) // Add a body to the API request (if applicable)
// resp, httpResp, err := req.Execute() // Execute request

// api := client.V2.ExampleApi // Access V2 API Service
// req := api.NewUpdateExampleRequest(ctx) // Build new API request
// req = req.ExampleUpdateRequest(V2.ExampleUpdateRequest{ Name: "Hello" }) // Add a body to the API request (if applicable)
// resp, httpResp, err := req.Execute() // Execute request

Documentation for API Endpoints

All documentation for the APIs can be found in its respective API directory: