Skip to content

Latest commit

 

History

History
161 lines (129 loc) · 10.2 KB

File metadata and controls

161 lines (129 loc) · 10.2 KB

Go API client for Keyfactor Command (API Version V2)

This page provides a utility through which the Keyfactor API endpoints can be called and results returned. It is intended to be used primarily for validation, testing and workflow development. It also serves secondarily as documentation for the API.

If you would like to view documentation containing details on the Keyfactor API and endpoints, please refer to the Web API section of the Keyfactor Command documentation.

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.

  • Keyfactor Command API Version: 24.4.2
  • API version: 2
  • Package version: 1.0.0
  • OpenAPI Generator Version: 7.12.0
  • Build package: org.openapitools.codegen.languages.GoClientCodegen

For more information on the Keyfactor Command API Documentation, please visit here.

For more information on OpenAPI Generator, please visit its documentation.

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:

import "github.com/Keyfactor/keyfactor-go-client-sdk/v24/api/keyfactor/v2"

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 (
	"os"
	"github.com/Keyfactor/keyfactor-auth-client-go/auth_providers"
	"github.com/Keyfactor/keyfactor-go-client-sdk/v24/api/keyfactor/v2"
)

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())

Documentation for API Endpoints

All URIs are relative to http://keyfactor.example.com

Class Method HTTP request Description
CertificateApi GetCertificatesIdentityAuditById Get /Certificates/IdentityAudit/{id} Audit identity permissions for certificate
EnrollmentApi CreateEnrollmentPFX Post /Enrollment/PFX Performs a PFX Enrollment based upon the provided request
PAMProviderApi CreatePamProviders Post /PamProviders Creates a new PAM provider with the associated properties
PAMProviderApi CreatePamProvidersTypes Post /PamProviders/Types Creates a new PAM provider type with the associated properties
PAMProviderApi DeletePamProvidersById Delete /PamProviders/{id} Deletes a PAM Provider
PAMProviderApi GetPamProviders Get /PamProviders Returns all PAM providers according to the provided filter and output parameters
PAMProviderApi GetPamProvidersById Get /PamProviders/{id} Returns a single PAM Provider that matches the associated id
PAMProviderApi GetPamProvidersTypes Get /PamProviders/Types Returns all PAM provider types in the Keyfactor instance
PAMProviderApi GetPamProvidersTypesById Get /PamProviders/Types/{id} Returns PAM provider Type for a specific PAM provider
PAMProviderApi UpdatePamProviders Put /PamProviders Updates an existing PAM provider according to the provided properties
SecurityRolesApi CreateSecurityRoles Post /Security/Roles Adds a new security role to the system.
SecurityRolesApi GetSecurityRoles Get /Security/Roles Returns all security roles according to the provided filter and output parameters.
SecurityRolesApi GetSecurityRolesById Get /Security/Roles/{id} Returns a single security role that matches the id.
SecurityRolesApi UpdateSecurityRoles Put /Security/Roles Updates an existing security role.
UserApi GetSSHUsers Get /SSH/Users Returns users matching the criteria from the provided query parameters
UserApi GetSSHUsersById Get /SSH/Users/{id} Looks up information about an existing SSH user.

Documentation For Models

Documentation for Utility Methods

Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:

  • PtrBool
  • PtrInt
  • PtrInt32
  • PtrInt64
  • PtrFloat
  • PtrFloat32
  • PtrFloat64
  • PtrString
  • PtrTime

Author