|
| 1 | +# Go API client for Keyfactor Command |
| 2 | + |
| 3 | +This reference serves to document REST-based methods to manage and integrate with Keyfactor. In addition, an embedded |
| 4 | +interface allows for the execution of calls against the current Keyfactor API instance. |
| 5 | + |
| 6 | +## Support for Keyfactor Command Go Client SDK |
| 7 | + |
| 8 | +Keyfactor Command Go Client SDK is open source and supported on best effort level for this tool/library/client. |
| 9 | +This means customers can report Bugs, Feature Requests, Documentation amendment or questions as well as requests for |
| 10 | +customer information required for setup that needs Keyfactor access to obtain. Such requests do not follow normal SLA |
| 11 | +commitments for response or resolution. If you have a support issue, please open a support ticket via the Keyfactor |
| 12 | +Support Portal at https://support.keyfactor.com/ |
| 13 | + |
| 14 | +###### To report a problem or suggest a new feature, use the **[Issues](../../issues)** tab. If you want to contribute actual bug fixes or proposed enhancements, use the **[Pull requests](../../pulls)** tab. |
| 15 | + |
| 16 | +--- |
| 17 | + |
| 18 | +## Overview |
| 19 | + |
| 20 | +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using |
| 21 | +the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. |
| 22 | + |
| 23 | + |
| 24 | +## Installation |
| 25 | + |
| 26 | +Install the following dependencies: |
| 27 | + |
| 28 | +```shell |
| 29 | +go get "github.com/Keyfactor/keyfactor-go-client-sdk/v3" |
| 30 | +``` |
| 31 | + |
| 32 | +Put the package under your project folder and add the following in import: |
| 33 | + |
| 34 | +```golang |
| 35 | +package main |
| 36 | + |
| 37 | +import "github.com/Keyfactor/keyfactor-go-client-sdk/api/keyfactor/v3" |
| 38 | +``` |
| 39 | + |
| 40 | +## Configuration |
| 41 | + |
| 42 | +Configuration of the API client is done through the [github.com/Keyfactor/keyfactor-auth-client-go/auth_providers](https://github.com/Keyfactor/keyfactor-auth-client-go) Go package. |
| 43 | + |
| 44 | +Here is an example of configuring your API client: |
| 45 | + |
| 46 | +```go |
| 47 | +import ( |
| 48 | + "os" |
| 49 | + "github.com/Keyfactor/keyfactor-auth-client-go/auth_providers" |
| 50 | + "github.com/Keyfactor/keyfactor-go-client-sdk/v3" |
| 51 | +) |
| 52 | + |
| 53 | +hostname := os.Getenv(auth_providers.EnvKeyfactorHostName) |
| 54 | +apiPath := os.Getenv(auth_providers.EnvKeyfactorAPIPath) |
| 55 | + |
| 56 | +clientId := os.Getenv(auth_providers.EnvKeyfactorClientID) |
| 57 | +clientSecret := os.Getenv(auth_providers.EnvKeyfactorClientSecret) |
| 58 | +tokenUrl := os.Getenv(auth_providers.EnvKeyfactorAuthTokenURL) |
| 59 | + |
| 60 | +oAuthNoParamsConfig := auth_providers.CommandConfigOauth{} |
| 61 | +oAuthNoParamsConfig.CommandAuthConfig. |
| 62 | + WithCommandHostName(hostname). |
| 63 | + WithCommandAPIPath(apiPath). |
| 64 | + WithSkipVerify(false). |
| 65 | + WithClientTimeout(10) |
| 66 | +oAuthNoParamsConfig. |
| 67 | + WithClientId(clientId). |
| 68 | + WithClientSecret(clientSecret). |
| 69 | + WithTokenUrl(tokenUrl). |
| 70 | + Authenticate() |
| 71 | + |
| 72 | +// Configure API client |
| 73 | +client, err := kf.NewAPIClient(oAuthNoParamsConfig.GetServerConfig()) |
| 74 | +``` |
| 75 | + |
| 76 | +## Documentation for API Endpoints |
| 77 | + |
| 78 | +All documentation for the APIs can be found in its respective API directory: |
| 79 | + |
| 80 | +- [v1 API Documentation](./api/keyfactor/v1/README.md) |
| 81 | +- [v2 API Documentation](./api/keyfactor/v2/README.md) |
| 82 | + |
0 commit comments