|
| 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 | +This API client was generated against Command version 24.4.2. |
| 7 | + |
| 8 | +Please reference the [Keyfactor Command API Change Log](https://software.keyfactor.com/Core-OnPrem/Current/Content/WebAPI/ChangeLogs/APIChangeLog.htm) for information about API endpoint support for your specific version of Keyfactor Command. |
| 9 | + |
| 10 | +## Support for Keyfactor Command Go Client SDK |
| 11 | + |
| 12 | +Keyfactor Command Go Client SDK is open source and supported on best effort level for this tool/library/client. |
| 13 | +This means customers can report Bugs, Feature Requests, Documentation amendment or questions as well as requests for |
| 14 | +customer information required for setup that needs Keyfactor access to obtain. Such requests do not follow normal SLA |
| 15 | +commitments for response or resolution. If you have a support issue, please open a support ticket via the Keyfactor |
| 16 | +Support Portal at https://support.keyfactor.com/ |
| 17 | + |
| 18 | +###### 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. |
| 19 | + |
| 20 | +--- |
| 21 | + |
| 22 | +## Overview |
| 23 | + |
| 24 | +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using |
| 25 | +the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. |
| 26 | + |
| 27 | + |
| 28 | +## Installation |
| 29 | + |
| 30 | +Install the following dependencies: |
| 31 | + |
| 32 | +```shell |
| 33 | +go get "github.com/Keyfactor/keyfactor-go-client-sdk/v24" |
| 34 | +``` |
| 35 | + |
| 36 | +Put the package under your project folder and add the following in import: |
| 37 | + |
| 38 | +```golang |
| 39 | +package main |
| 40 | + |
| 41 | +import "github.com/Keyfactor/keyfactor-go-client-sdk/api/keyfactor/v24" |
| 42 | +``` |
| 43 | + |
| 44 | +## Configuration |
| 45 | + |
| 46 | +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. |
| 47 | + |
| 48 | +Here is an example of configuring your API client: |
| 49 | + |
| 50 | +```go |
| 51 | +import ( |
| 52 | + "context" |
| 53 | + "os" |
| 54 | + "github.com/Keyfactor/keyfactor-auth-client-go/auth_providers" |
| 55 | + "github.com/Keyfactor/keyfactor-go-client-sdk/v24" |
| 56 | +) |
| 57 | + |
| 58 | +hostname := os.Getenv(auth_providers.EnvKeyfactorHostName) |
| 59 | +apiPath := os.Getenv(auth_providers.EnvKeyfactorAPIPath) |
| 60 | + |
| 61 | +clientId := os.Getenv(auth_providers.EnvKeyfactorClientID) |
| 62 | +clientSecret := os.Getenv(auth_providers.EnvKeyfactorClientSecret) |
| 63 | +tokenUrl := os.Getenv(auth_providers.EnvKeyfactorAuthTokenURL) |
| 64 | + |
| 65 | +oAuthNoParamsConfig := auth_providers.CommandConfigOauth{} |
| 66 | +oAuthNoParamsConfig.CommandAuthConfig. |
| 67 | + WithCommandHostName(hostname). |
| 68 | + WithCommandAPIPath(apiPath). |
| 69 | + WithSkipVerify(false). |
| 70 | + WithClientTimeout(10) |
| 71 | +oAuthNoParamsConfig. |
| 72 | + WithClientId(clientId). |
| 73 | + WithClientSecret(clientSecret). |
| 74 | + WithTokenUrl(tokenUrl). |
| 75 | + Authenticate() |
| 76 | + |
| 77 | +// Configure API client |
| 78 | +client, err := keyfactor.NewAPIClient(oAuthNoParamsConfig.GetServerConfig()) |
| 79 | +ctx := context.Background() |
| 80 | + |
| 81 | +// api := client.V1.ExampleApi // Access V1 API Service |
| 82 | +// req := api.NewExampleRequest(ctx) // Generate request |
| 83 | +// resp, http, err := req.Execute() // Execute request |
| 84 | + |
| 85 | +// api := client.V2.ExampleApi // Access V2 API Service |
| 86 | +// req := api.NewExampleRequest(ctx) // Generate request |
| 87 | +// resp, http, err := req.Execute() // Execute request |
| 88 | + |
| 89 | + |
| 90 | +``` |
| 91 | + |
| 92 | +## Documentation for API Endpoints |
| 93 | + |
| 94 | +All documentation for the APIs can be found in its respective API directory: |
| 95 | + |
| 96 | +- [v1 API Documentation](./api/keyfactor/v1/README.md) |
| 97 | +- [v2 API Documentation](./api/keyfactor/v2/README.md) |
| 98 | + |
0 commit comments