keyfactor

package module
v25.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 17, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

README

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:

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSecurityClaimByTypeAndValueAndScheme

func GetSecurityClaimByTypeAndValueAndScheme(ctx context.Context, client *APIClient, claimType string, claimValue string, authenticationScheme string) (*v1.SecurityRoleClaimDefinitionsRoleClaimDefinitionQueryResponse, error)

The v1 APIClient exposes a method to query security claims by type and value. To retrieve a unique security claim from Command it is required to also find a claim with the matching authentication scheme, which is not queryable via the QueryString parameter. That must be done as a separate operation from the API call. This function will query the security claims by type and value, then filter the results by the authentication scheme to return a unique claim if it exists.

func GetSecurityPermissionSetByName

func GetSecurityPermissionSetByName(ctx context.Context, client *APIClient, permissionSetName string) (*v1.PermissionSetsPermissionSetResponse, error)

Queries security permissions by name and returns the first matching permission set.

func GetSecurityRoleByName

func GetSecurityRoleByName(ctx context.Context, client *APIClient, roleName string) (*v2.SecuritySecurityRolesSecurityRoleQueryResponse, error)

The v2 APIClient exposes a method to query a role by name. This function will query the security roles and filter security roles by name.

Types

type APIClient

type APIClient struct {
	V1 *v1.APIClient
	V2 *v2.APIClient
}

func NewAPIClient

func NewAPIClient(cfg *auth_providers.Server) (*APIClient, error)

Directories

Path Synopsis
api

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL